mga kuya, pwede ko patabang sa among project sa assembly? gihatagan mo ug 3 ka program sa amu teacher, dapat daw amu isumpay.
STEPPER MOTOR:
Code:
#start=stepper_motor.exe#
name "stepper"
#make_bin#
steps_before_direction_change = 20h ; 32 (decimal)
jmp start
; ========= data ===============
; bin data for clock-wise
; half-step rotation:
datcw db 0000_0110b
db 0000_0100b
db 0000_0011b
db 0000_0010b
; bin data for counter-clock-wise
; half-step rotation:
datccw db 0000_0011b
db 0000_0001b
db 0000_0110b
db 0000_0010b
; bin data for clock-wise
; full-step rotation:
datcw_fs db 0000_0001b
db 0000_0011b
db 0000_0110b
db 0000_0000b
; bin data for counter-clock-wise
; full-step rotation:
datccw_fs db 0000_0100b
db 0000_0110b
db 0000_0011b
db 0000_0000b
start:
mov bx, offset datcw ; start from clock-wise half-step.
mov si, 0
mov cx, 0 ; step counter
next_step:
; motor sets top bit when it's ready to accept new command
wait: in al, 7
test al, 10000000b
jz wait
mov al, [bx][si]
out 7, al
inc si
cmp si, 4
jb next_step
mov si, 0
inc cx
cmp cx, steps_before_direction_change
jb next_step
mov cx, 0
add bx, 4 ; next bin data
cmp bx, offset datccw_fs
jbe next_step
mov bx, offset datcw ; return to clock-wise half-step.
jmp next_step
THERMOMETER:
Code:
#start=thermometer.exe#
; temperature rises fast, thus emulator should be set to run at the maximum speed.
; if closed, the thermometer window can be re-opened from emulator's "virtual devices" menu.
#make_bin#
name "thermo"
; set data segment to code segment:
mov ax, cs
mov ds, ax
start:
in al, 125
cmp al, 60
jl low
cmp al, 80
jle ok
jg high
low:
mov al, 1
out 127, al ; turn heater "on".
jmp ok
high:
mov al, 0
out 127, al ; turn heater "off".
ok:
jmp start ; endless loop.
LED:
Code:
#start=led_display.exe#
#make_bin#
name "led"
mov ax, 1234
out 199, ax
mov ax, -5678
out 199, ax
; Eternal loop to write
; values to port:
mov ax, 0
x1:
out 199, ax
inc ax
jmp x1
hlt
mao ni ang problem:
Assume that you have a fan (represented by the stepper motor) with the speed modes Low, Med, and High. Control the speed of the fan depending on the temperature on the thermometer. If it is very hot, then the fan should be set to High. Change the mode according to the reflected temperature. If it is colder than 10 degrees, the fan should be turned off. Use the heater for raising the temperature. Add the LED display to write out the current temperature on the thermometer.
willing mi mubayad, ayaw lang nang dako kay istudyante pa mi. hehe.