單片機(jī)/智能儀表外圍電路設(shè)計(jì)(步進(jìn)電機(jī))
編寫試驗(yàn)程序,通過(guò)單片機(jī)P0口控制步進(jìn)電機(jī)運(yùn)轉(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
評(píng)論