6-2 步进电动机实现两轴联动直线运动程序(6)
发布时间:2021-06-08
发布时间:2021-06-08
电动机,dsPIC,自动控制,程序
Mov w0,PR3 Mov DIR,w0
Mov w0,PORTG BSET T2CON, #TON BSET T3CON, #TON Bset IEC2,#OC7IE Bset IEC2,#OC8IE abc:
Goto abc __OC7Interrupt: Push.s Push w0
Inc Testx
Btsc Testx,#0
Goto H2
Dec NXL BRA C,H1
DEC NXH
H1:
Mov NXL,w0
Ior NXH,wreg Bra NZ,H2 Bclr T2CON, #TON H2:
Bclr IFS2,#OC7IF Pop w0
Pop.s Retfie
__OC8Interrupt: Push.s Push w0
Inc Testy
Btsc Testy,#0
Goto H4
Dec NYL BRA C,H3
DEC NYH
H3:
Mov NYL,w0
Ior NYH,wreg Bra NZ,H4 Bclr T3CON, #TON H4: