Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Assembly Language - My program keeps on restarting

Status
Not open for further replies.

avinsinanan

New Member
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
 
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.
 
Status
Not open for further replies.

Latest threads

Back
Top