电动机,dsPIC,自动控制,程序
mov W0, [++W14]
clr W14 MOV #0x0001, w0
MOV w0, OC7CON BSET OC7CON, #1 MOV #0x0009, w0
MOV w0, OC8CON BSET OC8CON, #1 Mov #0xFFFC,w0
Mov w0,TRISG Mov #0x5544,w0
Mov w0,IPC8 Clr IFS2 Clr Testx Clr Testy
Bset SR,#C
Mov XBL,W2 Mov XAL,W0
Sub w2,w0,w6 Mov XBH,w2
Mov XAH,w0
Subb w2,w0,w5
Bra n,TB1
Bra z,TB5
bclr DIR,#0
Goto TB2
TB1:
Bset DIR,#0
Mov w6,ACCAL Mov w5,ACCAH
Clr ACCAU
Neg A
Mov ACCAL,w6
Mov ACCAH,w5
TB2:
Mov w6,ACCAL Mov w5,ACCAH
Clr ACCAU
Sftac A,#2
Mov ACCAL, w6
Mov ACCAH, w5
Mov w6, NXL
Mov w5, NXH
Sftac A,#2