Hello, it will become apparent very quickly that I am a beginner at this whole pic programming thing. I have read the newcomer section and looked at a lot of the weblinks but am still struggling with a delay problem.
I am using the PicKit2 and can get the LED to go off and on using the switch but cannot get it to flash when I try the simple delay program that I plagerised from the internet.
Loop1 decfsz COUNT1,1
goto Loop1
decfsz COUNT2,1
goto Loop1
I have assigned the COUNT1 equ 08h and COUNT2 equ 09h.
When I run the debugger in mplab and step through the program it never comes out of the first decfsz COUNT1,1 instruction. It just continues to go round.
This is then emulated by the LED when I download the program onto the PIC in that it simply stays on all the time. I have spent a few nights on this trying various things and am really in need of some help.
As I am a complete newcomer to PICs and programming I am unsure if there is anything else I need to set up before starting the decrement instruction.
Do I need to assign a value to the 08h and 09h addresses before the decrement instruction starts?
Or do I need to set the internal timer up in some kind of fashion before hand?
I would really appreciate some help with this.
My main aim is to build a timer circuit that will have about a 2.5 - 3 minute delay. Have one LED lit when the timer is off, then when the timer starts turn the LED off and turn another one on. When the timer (delay) ends sitch the original LED back on and turn the other one off. Simple..... or so you would think.
Cheers
Stu
I am using the PicKit2 and can get the LED to go off and on using the switch but cannot get it to flash when I try the simple delay program that I plagerised from the internet.
Code:
goto Loop1
decfsz COUNT2,1
goto Loop1
Code:
I have assigned the COUNT1 equ 08h and COUNT2 equ 09h.
When I run the debugger in mplab and step through the program it never comes out of the first decfsz COUNT1,1 instruction. It just continues to go round.
This is then emulated by the LED when I download the program onto the PIC in that it simply stays on all the time. I have spent a few nights on this trying various things and am really in need of some help.
As I am a complete newcomer to PICs and programming I am unsure if there is anything else I need to set up before starting the decrement instruction.
Do I need to assign a value to the 08h and 09h addresses before the decrement instruction starts?
Or do I need to set the internal timer up in some kind of fashion before hand?
I would really appreciate some help with this.
My main aim is to build a timer circuit that will have about a 2.5 - 3 minute delay. Have one LED lit when the timer is off, then when the timer starts turn the LED off and turn another one on. When the timer (delay) ends sitch the original LED back on and turn the other one off. Simple..... or so you would think.
Cheers
Stu