| Posted: 12:54am 10 Jan 2023 |
|
|
|
Putting PWM SYNC to work.
' Stepper motor continuous drive
SetPin gp0,pwm 'CH 0a SetPin gp1,pwm 'CH 0b SetPin gp2,pwm 'CH 1a SetPin gp3,pwm 'CH 1b
PW = 25 'pulse width % F2 = 50 * 2 'frequency Hz
Poke word &h40050000,3 Poke word &h40050014,3
PWM 0,F2,PW,PW-100,1 PWM 1,F2,PW-100,PW,1
PWM sync 0,50
' Three phase motor drive
SetPin gp0,pwm 'CH 0a SetPin gp1,pwm 'CH 0b SetPin gp2,pwm 'CH 1a SetPin gp3,pwm 'CH 1b SetPin gp4,pwm 'CH 2a SetPin gp5,pwm 'CH 2b
PW = 100 / 3 'pulse width % F2 = 50 * 2 'frequency Hz
Poke word &h40050000,3 Poke word &h40050014,3 Poke word &h40050028,3
PWM 0,F2,PW,PW-100,1 PWM 1,F2,PW-100,PW,1 PWM 2,F2,PW,PW-100,1
PWM sync 0,100/3,200/3 |