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%?
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.
--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.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.