單片機/智能儀表外圍電路設(shè)計(步進電機)
編寫試驗程序,通過單片機P0口控制步進電機運轉(zhuǎn),接線圖和各步電平見下。
本文引用地址:http://butianyuan.cn/article/201611/315738.htm參考程序:
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN: MOV R1,#08H
MOV DPTR,#TAB
LOOP: CLR A
MOVC A,@A+DPTR
MOV P0,A
INC DPTR
LCALL DELAY
DJNZ R1,LOOP
AJMP MAIN
TAB: DB 0EH,0CH,0DH,09H,0BH,03H,07H,06H
DELAY: MOV R5,#0FEH
DELAY1: MOV R4,#0FFH
DELAY2: DJNZ R4,DELAY2
DJNZ R5,DELAY1
RET
END
評論