Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 14th April 2005, 02:56 PM   (permalink)
Default Assembly Language - My program keeps on restarting

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
avinsinanan is offline   Reply With Quote
Old 14th April 2005, 03:09 PM   (permalink)
Exo
Default

did you disable your watchdog timer ?
Exo is offline   Reply With Quote
Old 14th April 2005, 05:20 PM   (permalink)
Default

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.
bonxer is offline   Reply With Quote
Old 15th April 2005, 04:23 AM   (permalink)
Default

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.
pike is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 11:24 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.