Hello,
I am working on CC2530 PWM output Timer 1 on P0_2 port but when I start a program below ,I don't get pwm signals on P0_2.
This is my code :
P0DIR |= 0x04; // P0_2 port P0SEL &= ~0x04; P0_2 ^= 1; // P0_2 set to be outputT1CTL |= 0x0f; // divide with 128 and to do i up-down mode
T1CC0L = 0xff; // PWM signal periodT1CC0H = 0x7f;T1CC1L = 0x78; // PWM duty cycleT1CC1H = 0x10;T1CCTL1 |= 0x1c;
PERCFG |= 0x00;
Please can someone tell me what I am doing wrong and where is mistake...Thank You
I have not worked with PWM using Timer1 so I hesitate to comment on your use of the T1CC1 register except: your static short T1CC1 = 0x0240; statement is working on a static variable that has the same name as the timer register -- probably not what you intended.
Which Timer You used and how do You solved that PWM is changing Duty cycle from exaple from 10% to 90%?
Hi,
How can I modify code if I want to output PWM signal on P1.3? Thanks.
Have a look in the User's Guide chapter 7.
/Fredrik
--PS. If I answered your question, please hit Verify Answer !
I am using following code to get timer signal at P0_3. It is working OK.
But it takes 2ms for 1 time ON and 1 time OFF. I need that it will take 2ms for 5 times ON and 5 times OFF.
For better understanding I have attached file.
PERCFG &= ~0x40; //select Timer 1 Alternative at Port 0 Location PERCFG |= 0x03; //Move USART0 and USART1 to Alternative 2 Location P2DIR = (P2DIR & ~0xC0) | 0X80; //Give priority to Timer 1 P0SEL |= 0x08; // SET P0_3 AS PERIPHERAL T1CC0L = 0xFF; //PWM signal period T1CC0H = 0x7F; T1CC1L = 0x00; //PWM Duty Cycle, Channel 1 (P0_3) T1CC1H = 0x01; T1CCTL1 = 0x34; //Channel 1 in compare Mode, Set output on Compare down, T1CTL |= 0x01; //Start the timer in free running Mode
Waiting for beneficial reply.
Thanks5824.TIMER SPEED.xls