We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HI, I've been using the PWM module to generate a timing signal for my project using the LPC 2129 the problem is that while the simualtion for the same circuit is flawless it refuses to work in the hardware. Example codes on the other hand work fine but my timing code refuses to work. I've put up the code as well pls help
#include <LPC21XX.H> //void delay(void); //int del; int main(void) { //unsigned int delay; PINSEL0 = 0x000A8002; //Enable pins PWM2 PWMPR = 0x00000000; //Load prescaler PWMPCR = 0x00005650; //PWM channel 4&6 double edge control, 1,2 single, output enabled PWMMCR = 0x00010000; //On match with timer 5 reset the counter PWMMR0 = 0x0000004B; PWMMR1 = 0x000000E1; PWMMR2 = 0x00000195; PWMMR3 = 0x000000C3; PWMMR4 = 0x000000E1; PWMMR5 = 0X000003FF; PWMMR6 = 0x0000004C; PWMEMR = 0x00000280;//copied this from the example removing it doesnt make a difference PWMLER = 0x0000007F; PWMTCR = 0x00000002; PWMTCR = 0x00000009;// enable timer n pwm while(1) // main loop { ; } }
Thanks in advance
WELL that is the best way i cld put it really. While running the debugger All the registers take the value as per the program. Even the output on the logic analyzer of keil shows the expected result. Proper timings and everything. But the same program refuses to work on the hardware.All the PWM pins r held high with no change while the keil example program works just fine with a proper PWM output. As i do not have a JTAG i cant really tell what is happening in the hardware. So i wanted to know if there is something i've overlooked in the program.