On Wed, Jul 03, 2013 at 06:34:23PM +0800, Electronic Consultation wrote: > Test Your posts are working. I saw the flowchart you posted. I see what you are trying to do. What I still don't see is why you are trying to do it that way other than an intellectual exercise. Why is your code simply not: Init while forever: State 1 Delay 1 second State 2 Delay 1 second Why is the code organized in 4 different files? Why are interrupts required? What you seem to have is a very complicated Blink an LED. To answer the question that you asked in the picture, there is no simple way to generate an interrupt precisely 1 second after entering state 1 using timer 0. The best you can do is wait for a flag to be raised by the ISR in the timer code on the top left that is triggered by counting faster interrupts. But the design questions remain. If your program's job is only to be in state 1 or state 2 for a specific amount of time, then what is the purpose of your code organization? BAJ > On 2/07/2013 8:23 AM, IVP wrote: > >> get to the point where you understand where all these pieces go > > A flow chart on a piece of paper would be a good start for organising > > what needs to happen, when and how > > > > http://en.wikipedia.org/wiki/Flowchart > > > > Joe >=20 > --=20 > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 Byron A. Jeff Chair: Department of Computer Science and Information Technology College of Information and Mathematical Sciences Clayton State University http://faculty.clayton.edu/bjeff --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .