![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hello,
I wrote some code and becasue of the four lines with the asterisks (*), my program keeps on restarting ( It keeps on going back to the line ORG )x00, nop ). Without the four lines it gives a one second delay. Why does it keep restarting with the four lines? INCLUDE <P16f877.inc> LIST P=16F877 count EQU 0x26 five EQU 0x27 ORG 0x00 nop goto main ORG 0x10 main BANKSEL OPTION_REG * movlw B'00100001' ;*enable counter mode, 1:4 prescaler movwf OPTION_REG ;*increment on rising edge BANKSEL TMR0* movlw D'250' movwf count movlw 0x10 movwf five point decfsz five goto start goto here2 start movlw D'249' here addlw 0xFF btfss STATUS,Z goto here decfsz count goto start goto point here2 movf TMR0,W clrf TMR0 movwf PORTD stop sleep END Yours Respectfully Avin Sinanan
__________________
Yours Respectfully Avin Sinanan |
|
|
|
|
|
|
(permalink) |
|
did you disable your watchdog timer ?
|
|
|
|
|
|
|
(permalink) |
|
Yes, it is the watchdog timer, and if the prescaler for the timer is done incorrectly, the watchdog can bite even if turned off. Make sure your WDT is turned off in your fuse settings. Then, in the section that you have starred, you must issue a clear watchdog timer command before assigning the prescaler.
__________________
There\'s no graphic in my signature. I don\'t know your IP, and I\'m not trying to hax0r you. You\'re welcome. |
|
|
|
|
|
|
(permalink) |
|
OMG this problem got me so many times you wouldn't believe how frustrating it was :x :evil: . Almost quit electronics altogther!!
__________________
www.winpicprog.co.uk - Great PIC language tutorials. |
|
|
|
|