Hi,
I have to control 8 rc servos position , I found an example in controlSuite ( ecap_apwm_cpu01 ) , I changed ECap1Regs.CAP1 and ECap1Regs.CAP2 registers to control movement of connected servo to GPIO-05 ( pin no 52 on docking station ) .
this is a part of my code :
// Setup APWM mode on CAP1, set period and compare registers ECap1Regs.ECCTL2.bit.CAP_APWM = 1; // Enable APWM mode ECap1Regs.CAP1 = 2500000; //0x01312D00; // Set Period value ECap1Regs.CAP2 = 102000; //0x00989680; // Set Compare value ECap1Regs.ECCLR.all = 0x0FF; // Clear pending __interrupts ECap1Regs.ECEINT.bit.CTR_EQ_CMP = 1; // enable Compare Equal Int // Start counters ECap1Regs.ECCTL2.bit.TSCTRSTOP = 1;
ECap1Regs.CAP2 value range is from 102000 to 400000 .
my first question is am I in the right way to control a rc servo ?
my second question is how to control more servos with eCap module ? I did not found anything like InitAPwm2Gpio to control next servo connected to GPIO-06 .
Best Regards,
Amir .