EmbeddedRelated.com
Forums

square wave generation

Started by arun March 18, 2013
what I'm trying to say is, the smaller version of the program works... it is only the complete program thats not working

 
Arun
________________________________
From: arun
To: "l..."
Sent: Sunday, 31 March 2013 11:51 AM
Subject: [lpc2000] Re: square wave generation


 
ok..

but

the program with 8 square wave output (which is about half the size of this program) works....
though this is just an extension of the same program which uses 4 timers instead of 2 does not work...
 
Arun






An Engineer's Guide to the LPC2100 Series

--- In l..., arun wrote:
>
> what I'm trying to say is, the smaller version of the program works... it is only the complete program thats not working
>
>  
> Arun

So, cut the code back to the part that works and then add the new stuff in very small pieces until you see what makes it fail.

Even if half of the code worked, it's still too much to deal with in a forum like this. Most of the problems that get resolved here start out around 20 to 30 lines.

Add diagnostic outputs: LEDs or printf(). Try to make it easy to see what is happening. Printf() won't be helpful inside timing loops or interrupt handlers but toggling an IO pin works well when viewed with a scope. By definition, only one function (or interrupt handler) is running at any given time. Assign each a unique number and put it out on some IO pins when the function starts. You can look at it with a logic analyzer if one is available. When you enter an ISR, you want to save the function number that was running, output the new function number and then, just before returning, restore the previous number. This will give you a perfect trace of the code execution. Make sure you store the previous function number in a variable that is local to the ISR. That way if the function is invoked recursively, the trace won't be lost. Or create a stack like structure and just stack the function numbers.

Richard

hi
thanks

I'm using all 16 match interrupts of 4 timers to generate 16 square wave signals.. I'm getting square waves from timer2 and timer3 i.e 8 waves are good....but timer0 and timer2 are not working when timer2 and 3 active... 

what can be done
 
Arun
________________________________
From: rtstofer
To: l...
Sent: Monday, 1 April 2013 12:23 AM
Subject: [lpc2000] Re: square wave generation


 
--- In l..., arun wrote:
>
> what I'm trying to say is, the smaller version of the program works... it is only the complete program thats not working
>
>  
> Arun

So, cut the code back to the part that works and then add the new stuff in very small pieces until you see what makes it fail.

Even if half of the code worked, it's still too much to deal with in a forum like this. Most of the problems that get resolved here start out around 20 to 30 lines.

Add diagnostic outputs: LEDs or printf(). Try to make it easy to see what is happening. Printf() won't be helpful inside timing loops or interrupt handlers but toggling an IO pin works well when viewed with a scope. By definition, only one function (or interrupt handler) is running at any given time. Assign each a unique number and put it out on some IO pins when the function starts. You can look at it with a logic analyzer if one is available. When you enter an ISR, you want to save the function number that was running, output the new function number and then, just before returning, restore the previous number. This will give you a perfect trace of the code execution. Make sure you store the previous function number in a variable that is local to the ISR. That way if the function is invoked recursively, the trace won't be lost. Or create a stack like structure and just stack the function numbers.

Richard