Hi all, I am trying to use CC60 and COUT60 on the XC167 for simple PWM generation, not for anything fancy like motor control. I am debugging using the HiTop and Tantino. My problem is that I can see T12 running, and can see CC60ST toggling in E8A8. However, the port pins P1L_P0 and P1L_P1 remain low. I have disabled the EBC (EBCMOD0 = 0x7400 & EBCMOD1 = 0x00FF. The port pins are set to output, and I have tried setting the alt function to 0 and 1 (due to conflicting instructions depending on which docs you read), but still no output. I'm sure it must be something simple given that I am generating the CC60ST signal, this only has to go through the modulation part (that I am not using) and to the output pin. I have also checked the output pin by toggling it as a general I/O in my task scheduler, that works fine. Here is a snippet of my config code if it helps: Hoping someone has the answer - Cheers, void Initialise_PWM_CAPCOMs( void ) { Union_16_bit_value r_16; /* Set the PWM channels and output ports */ /* Set up PWM for 83.333KHz for temporarily driving the VT generation by connecting this PWM output to T5IN. */ CCU6_CC60SR = TIMER12_50PERCENT_DUTY;/* Set the shadow register and this will get transferred to the main register automatically */ /*CCU6_PSLR structure... unsigned int PSL_CC60 :1; unsigned int PSL_COUT60 :1; unsigned int PSL_CC61 :1; unsigned int PSL_COUT61 :1; unsigned int PSL_CC62 :1; unsigned int PSL_COUT62 :1; unsigned int pad0 :1; unsigned int PSL63 :1; unsigned int pad1 :8;*/ r_16.value = CLEAR_ALL_FIELDS; CCU6_PSLR = r_16.value; /* Set the timers (T12) to drive the PWM channels */ /* structure for CCU6_T12DTC.... unsigned int DTM :6; unsigned int pad0 :2; unsigned int DTE0 :1; unsigned int DTE1 :1; unsigned int DTE2 :1; unsigned int pad1 :1; unsigned int DTR0 :1; unsigned int DTR1 :1; unsigned int DTR2 :1; unsigned int pad2 :1;*/ r_16.value = CLEAR_ALL_FIELDS; r_16.ccu6_t12dtc.DTM = 1;/* Dead time has to be a min of 1 even if not used */ CCU6_T12DTC = r_16.value; /* CCU6_MODCTR structure unsigned int CC60_T12MODEN :1; unsigned int COUT60_T12MODEN :1; unsigned int CC61_T12MODEN :1; unsigned int COUT61_T12MODEN :1; unsigned int CC62_T12MODEN :1; unsigned int COUT62_T12MODEN :1; unsigned int pad0 :1; unsigned int MCMEN :1; unsigned int CC60_T13MODEN :1; unsigned int COUT60_T13MODEN :1; unsigned int CC61_T13MODEN :1; unsigned int COUT61_T13MODEN :1; unsigned int CC62_T13MODEN :1; unsigned int COUT62_T13MODEN :1; unsigned int pad1 :1; unsigned int ECT13O :1;*/ r_16.value = CLEAR_ALL_FIELDS; r_16.ccu6_modctr.CC60_T12MODEN = 1; r_16.ccu6_modctr.COUT60_T12MODEN = 1; CCU6_MODCTR = r_16.value; /*ccu6_t12msel structure... unsigned int MSEL60 :4; unsigned int MSEL61 :4; unsigned int MSEL62 :4; unsigned int HSYNC :3; unsigned int DBYP :1;*/ r_16.value = CLEAR_ALL_FIELDS; r_16.ccu6_t12msel.MSEL60 = 3;/*Compare output on pins CC60 and COUT60*/ CCU6_T12MSEL = r_16.value; /* Set up timer12 for PWMs*/ CCU6_T12PR = TIMER12_PERIOD;/*timer 12 Period Register. Actual period = value+1*/ /* Set up timer13 */ CCU6_T13PR = 0x0001;/*timer 13 must have a value of 1 or greater even though it is not in use at the moment*/ /*CCU6_TCTR0 structure... unsigned int T12CLK :3; unsigned int T12PRE :1; unsigned int T12R :1; unsigned int STE12 :1; unsigned int CDIR :1; unsigned int CTM :1; unsigned int T13CLK :3; unsigned int T13PRE :1; unsigned int T13R :1; unsigned int STE13 :1; unsigned int pad0 :1; unsigned int pad1 :1;*/ r_16.value = CLEAR_ALL_FIELDS; r_16.ccu6_tctr0.T12CLK = 2;/* divide the clock (40MHz by 4). */ CCU6_TCTR0 = r_16.value; /* CCU6_TCTR2 structure.... unsigned int T12SSC :1; unsigned int T13SSC :1; unsigned int T13TEC :3; unsigned int T13TED :2; unsigned int pad0 :9;*/ r_16.value = CLEAR_ALL_FIELDS; r_16.ccu6_tctr2.T13TED = 1;/* Must be at least 1 even if not used */ CCU6_TCTR2 = r_16.value; /* Now set the shadow transfer of TCTR4 before setting the run bit */ /*ccu6_tctr4 structure... unsigned int T12RR :1; unsigned int T12RS :1; unsigned int T12RES :1; unsigned int DTRES :1; unsigned int pad0 :2; unsigned int T12STR :1; unsigned int T12STD :1; unsigned int T13RR :1; unsigned int T13RS :1; unsigned int T13RES :1; unsigned int pad1 :3; unsigned int T13STR :1; unsigned int T13STD :1;*/ r_16.value = CLEAR_ALL_FIELDS; r_16.ccu6_tctr4.T12STR = 1; CCU6_TCTR4 = r_16.value; /* Now set timer 12 into run mode */ r_16.value = CLEAR_ALL_FIELDS; r_16.ccu6_tctr4.T12STR = 1;/* Leave this bit set */ r_16.ccu6_tctr4.T12RS = 1; CCU6_TCTR4 = r_16.value;
Hello Paul, if you interested I can send you 2 very simple examples for the CAPCOM6. One for center aligned mode and one for edge aligned mode. You can use them as startup for your own tries. If so please leave your e-mail here, I will send them to you. And if possible use DAvE as Reinhard says, it will be really a big help for the setup. Stefan
Hi all, The use of Dave has verified that the alternate function bit must be set, as well as MODEN12 for the output to work. I now have a pwm output. Thanks for reading and offering assistance. paul.ingle@zytek.co.uk
Hello I've just start working with XC167 and I would like to know if you can help me. I need to measure so much and differents times and I have some problems because I have used all the timers, but I know I can use up 16 software timers with CAPTURE COMPARE UNITS but I don't know where can I get a sample code for that. Can you help me, please? Thanks a lot.