스테퍼 모터의 작동 방식을 22.5 도의 회전 각도로 시각화하는 스테퍼 모터 코드가 있습니다. 그래도 작동합니다. 하지만 대화식으로 만들려고합니다. 즉, 오른쪽 버튼을 클릭하면 모터가 그런 식으로 회전합니다. 완전한 생각이 아니며 제안에 개방적입니다. 아이디어가 있으십니까? 버튼으로스텝퍼 모터의 예를 대화 형으로 만드는 방법
편집 나는 하드 와이어드 버튼, 사용자 입력의 단지 어떤 형태를 의미하지 않는다. 그것은 마우스 클릭이나 키보드 누르거나 뭐든간에.
PS : 나는 EMU8086
코드를 사용하고 있습니다 :
; this is an example of out instruction.
; it writes values to virtual i/o port
; that controls the stepper-motor.
; c:\emu8086\devices\stepper_motor.exe is on port 7
#start=stepper_motor.exe#
name "stepper"
#make_bin#
steps_before_direction_change = 10h ; 16 (decimal)
jmp start
; ========= data ===============
; bin data for clock-wise
; half-step rotation:
datcw db 6
db 4
db 3
db 2
; bin data for counter-clock-wise
; half-step rotation:
datccw db 3
db 1
db 6
db 2
; bin data for clock-wise
; full-step rotation:
datcw_fs db 1
db 3
db 6
db 0
; bin data for counter-clock-wise
; full-step rotation:
datccw_fs db 4
db 6
db 3
db 0
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
당신은 키보드 입력을 의미합니까? 또는 8086 에뮬레이터에서 마우스 포인터 GUI를 구현하려고합니까? 키보드 또는 마우스 입력을 수락하는 것은 해당 입력 (즉, OUT 명령 실행)과 관련이 없으므로보다 적절한 질문 제목이됩니다. –
@PeterCordes : EMU8086에는 스테퍼 모터, 버튼 생성 등을 수행하는 포트를 통해 액세스되는 가상 장치가 있습니다. –