Hello, Can anyone tell me if could be possible to create a differents PWM with variable duty cycle by using CAPCOM1/2? How would you configure output pines? I have tried it in Dave, but I dont see. Thanks.
hello
Sorry above information is unclear. I just want to produce 50micro second period PWM or u can say 20Khz. What should be the timer reload value?
Vivek
I am bit confuse about the period. How can we generate 50micro second period using CAPCOM2 in XC164CS? Can anyone hwlp me plz?
It has it.I've noticed that the P9.4 had configured as general output.
I have one question: The CC20IO (P9.4) output hasn't got "compare mode 3". Why?
Hello Chris, I've noticed that CC2_T7 register serves to control the wave period and CC2_CC16 to control duty cycle. :) In my case: CC2_CC16 = 0xFFFF -> Duty Cycle = 0 % CC2_CC16 = 0x48E5 -> Duty Cycle = 100 % Thanks ;-)
What does CC2_CC16 register mean? I tried to search into user manual, but I don't find it.
CC2 => Capture Compare Module 2 CC16 => Capture Compare Channel 16
How can I control the period of the PWM signal?
You have chosen Compare Mode 3: Set Output Pin on each Match. Reset output pin on each timer overflow; Only one interrupt per timer period. Allocated to T7
Basically CC2_T7 is your period in this case.
So when the CC2_CC16 compare value is equal to CC2_T7 then the PWM output goes high and the PWM output goes low when the CC2_T7 overflows (0xFFFF -> 0x48E5). 0x48E5 is your reload value.
Ok, I see that it is possible. Nikolay, your post hasn't hel me at all (thank you :)), but anyway, I has downloaded a proyect using CAPCOM2 fron Infineon website. I tested it in my starter kit and It works correctly. It apperares a PWM signal I used pin 9.0 as output (channel 16). Anyway, I don't undersand 2 things: 1-. What does CC2_CC16 register mean? I tried to search into user manual, but I don't find it.
2-. How can I control the periode of the PWM singal? Tnaks I put the used code here:
CC2_IOC = 0x0000; // load CAPCOM2 I/O control register CC2_T78CON = 0x0005; // load CAPCOM2 timer 7 and timer 8 control // register CC2_T7 = 0x48E5; // load CAPCOM2 timer 7 register CC2_T7REL = 0x48E5; // load CAPCOM2 timer 7 reload register CC2_T8 = 0x0000; // load CAPCOM2 timer 8 register CC2_T8REL = 0x0000; // load CAPCOM2 timer 8 reload register CC2_CC16 = 0xA472; // load CAPCOM2 channel 16 register CC2_CC17 = 0x0000; // load CAPCOM2 channel 17 register CC2_CC18 = 0x0000; // load CAPCOM2 channel 18 register CC2_CC19 = 0x0000; // load CAPCOM2 channel 19 register CC2_CC20 = 0x0000; // load CAPCOM2 channel 20 register CC2_CC21 = 0x0000; // load CAPCOM2 channel 21 register CC2_CC22 = 0x0000; // load CAPCOM2 channel 22 register CC2_CC23 = 0x0000; // load CAPCOM2 channel 23 register CC2_CC24 = 0x0000; // load CAPCOM2 channel 24 register CC2_CC25 = 0x0000; // load CAPCOM2 channel 25 register CC2_CC26 = 0x0000; // load CAPCOM2 channel 26 register CC2_CC27 = 0x0000; // load CAPCOM2 channel 27 register CC2_CC28 = 0x0000; // load CAPCOM2 channel 28 register CC2_CC29 = 0x0000; // load CAPCOM2 channel 29 register CC2_CC30 = 0x0000; // load CAPCOM2 channel 30 register CC2_CC31 = 0x0000; // load CAPCOM2 channel 31 register CC2_M4 = 0x0007; // load CAPCOM2 mode register 4 CC2_M5 = 0x0000; // load CAPCOM2 mode register 5 CC2_M6 = 0x0000; // load CAPCOM2 mode register 6 CC2_M7 = 0x0000; // load CAPCOM2 mode register 7 CC2_DRM = 0x0000; // load CAPCOM2 double-register mode register CC2_SEM = 0x0000; // load CAPCOM2 single event mode register CC2_SEE = 0x0000; // load CAPCOM2 single event enable register CC2_OUT = 0x0000; // load CAPCOM2 compare output register ALTSEL1P9 |= 0x0001; // select alternate output function DP9 |= 0x0001; //set direction register CC2_T78CON_T7R = 1; // set CAPCOM2 timer 7 run bit
Hello,
Try to look here: http://www.keil.com/forum/docs/thread12212.asp
-- Nikolay.
View all questions in Keil forum