windozeuser
Member
I have on my hands a dragon board from Wytec, that uses the HSC12 microntroller. It has a 24 Mhz bus, because the Debug12 runs a PLL loader to speed up the bus.
I need someone that is knowledgeable with HSC12 and controlling a servo with the PWM module of the HSC12.
I cannot use PORT T timer because it's going to be used by another function. So I will have to use the PWM that is outputted on PWM4 PORT P Pin 4
I have this code:
I dont understand how to calculate duty cycle, what to put in PWMDTY4, to get the duty cycle for the servo
using a futabo servo, 1.3ms CCW, 1.5ms (center), and 1.7ms (Cw) at 50Hz
Any help would be appreciated!
I need someone that is knowledgeable with HSC12 and controlling a servo with the PWM module of the HSC12.
I cannot use PORT T timer because it's going to be used by another function. So I will have to use the PWM that is outputted on PWM4 PORT P Pin 4
I have this code:
Code:
dotit
MOVB #$04, PWMPRCLK ;ClockA=Fbus/2**4=24MHz/16=1.5MHz
MOVB #125, PWMSCLA ;ClockSA=1.5MHz/2x125=1.5Mhz/250=6000Hz
MOVB #$10, PWMCLK ;Use clockSA for chan 4 PWM
MOVB #$10,PWMPOL ;High then low for polarity
MOVB #$0,PWMCAE ;Left aligned
MOVB #$0, PWMCTL ;Co n c a t
MOVB #120, PWMPER4 ;PWM_Freq=ClockSA/100=6000Hz/100=50 Hz.
MOVB #0,PWMCNT4 ;Start the counter with zero
BSET PWME,%00010000 ;Enable chan 4 PWM
servo
MOVB #6, PWMDTY4 ; need value here to make duty cycle
bra servo
I dont understand how to calculate duty cycle, what to put in PWMDTY4, to get the duty cycle for the servo
using a futabo servo, 1.3ms CCW, 1.5ms (center), and 1.7ms (Cw) at 50Hz
Any help would be appreciated!