电动机,dsPIC,自动控制,程序
TB5:
Clr Tx
Clr NXL Clr NXH
TB6:
Bset SR,#C
Mov YBL,W2
Mov YAL,W0
Sub w2,w0,w6 Mov YBH,w2
Mov YAH,w0
Subb w2,w0,w5 Bra n,TB7 Bra z,TB11
bclr DIR,#1 Goto TB8
TB7:
Bset DIR,#1 Mov w6,ACCAL Mov w5,ACCAH Clr ACCAU
Neg A Mov ACCAL,w6 Mov ACCAH,w5 TB8:
Mov w6,ACCAL Mov w5,ACCAH Clr ACCAU
Sftac A,#2 Mov ACCAL, w6 Mov ACCAH, w5 Mov w6, NYL Mov w5, NYH
Sftac A,#2 Mov ACCAL, w0 Mov #68,w1
Mul.uu w0,w1,w2 Clr w4 Clr w5
Ff1l w3,w4 Bra nc,TB9 Ff1l w2,w5 Bra c,TB11 Mov #-16, w4