Hallo
I work with a phyCORE-XC167 with XC167CI (16). IÂ'generetead PWM (CAPCOM6), so I have the timer T12 Stopped So that I can given the frequency for T12 I give the period Then I set the Output CC60 and COUT60 Then i giving the Value to compared And finally , I started the timer T12
#################### #################### //Programm sbit P1L_0 = P1L^0 ; // declare portpin to use sbit DP1L_0 = DP1L^0 ; // declare direction bit to use sbit P1L_1 = P1L^1 ; sbit DP1L_1 = DP1L^1 ;
void main (void) {
DP1L_0 = 1 ; //init Direction to output DP1L_1 = 1 ; //init Direction to output
//PWM Konfiguration
CCU6_TCTR0 = 0x0010 ; // T12 ist gestoppt
CCU6_T12PR = 800; //Die Periode der Timer
CCU6_TCTR0 = 0x0009; //T12PRE=1 und T12CLK=001 CCU6_T12MSEL = 0x0003; //Compare output on pins COUT6x and CC6x. CCU6_TCTR4 = 0x0002 ; // Start the Timer
while(1) // endlosschleife
{ CCU6_T12 = 400; // Count value to compared } } ################# #################
but i have no reaction in the Output ?
Thanks in advance
Many thanks for your help
I think you may have some misunderstandings on how the CCU6 works. Perhaps reading the manual again along with looking at the values below will help you gain a better understanding.
Enclosed is an example of a PWM (CC60 and COUT60) with a duty cycle of 50% along with dead time generation and where COUT60 is the complement of the CC60 output level.
#include <XC167.h> #include <intrins.h> void main (void) { /* PWM Configuration */ ALTSEL0P1L = 0x0003; _bfld_ (P1L, 0x03,0x03); _bfld_ (DP1L,0x03,0x03); CCU6_TCTR0 = 0x0009; /* T12 = fper/512 */ CCU6_T12PR = 800; /* choose a period value */ CCU6_CC60SR = 400; /* 50% duty cycle */ CCU6_T12DTC = 0x010F; /* enable dead time control for CC60/COUT60 */ CCU6_T12MSEL = 0x0003; /* Compare output on COUT60 and CC60 */ CCU6_MODCTR = 0x0003; /* T12 modulates CC60, COUT60 */ CCU6_PSLR = 0x0002; /* passive level of COUT60 output is one */ CCU6_TCTR4 = 0x0042; /* load period, duty cycle and start T12 */ while(1) { ; } }
First, thank you Ok, I will read The manul Again. And thanks for your help
Nice week
Hello First, thank you for the answer. This code has not worked. With the debugger, I found the following problems.
1: No Pwm on output. 2, the frequency is not changed at 78KHz. 3: CCU6_T12PR does not have the value of code! = 800 but (CCU6_T12PR = 0x0000). 4: CCU6_PSLR has not the value of code
I can only change the frequency if I stop the timer T12?
What about STE12 in CCU6_TCTR0? What about T12R in CCU6_TCTR0? To stop Timer T12 What about T12RR in CCU6_TCTR4? T12 Stops Counting What about T12RS in CCU6_TCTR4? T12 Starts Counting What is T12STR in CCU6_TCTR4? T12 requesting the transfer Schadow
//Code