Is this shifting your code so that you have a PCLATH problem? Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) ----- Original Message ----- From: "Nick Veys" To: Sent: Wednesday, June 20, 2001 11:04 PM Subject: [PIC]: 16F870 Error defying logic... > Absolutely mind boggling. I have a chunk of code causing some kind of > software reset. The WDT is disabled, in fact, all interrupts are disabled > in this program in it's entirety. The kicker is, this code is NOT being > executed when the reset occurs, it is tied to one button, the other button I > push works fine but randomly causes a reset... when I comment out the code, > it works fine (of course it doesn't do what I need though.) > > Here's the snippet... It's an EEPROM data write. > > ; ** EEPROM DATA STORAGE > BANK0 > movf DEVSTATUS,w ; load data > bcf PIR2,EEIF ; clear complete flag just in case > BANK2 ; go to bank2 > movwf EEDATA ; set DATA > movlw 0 ; load address > movwf EEADR ; set ADDRESS > BANK3 ; go to bank3 > bcf EECON1,EEPGD ; DATA memory > bsf EECON1,WREN ; enable writes > ; movlw 0x55 ; * required > ; movwf EECON2 ; * eeprom > ; movlw 0xAA ; * writing > ; movwf EECON2 ; * crap > bsf EECON1,WR ; initiate write > ; bcf EECON1,WREN ; disable writes > BANK0 > ; btfss PIR2,EEIF ; wait til the > ; goto $-1 ; writing is complete > bcf PIR2,EEIF ; clear complete flag > return > > if I uncomment any of those lines in ANY combination, I get a reset after a > few presses on my button, which DOES NOT execute this code :( :( :( It's > almost as thought just having this code in makes it act erratic. This is > reproducable on 2 different chips, I'm out of ideas and frustrated... > > nick@veys.com | www.veys.com/nick > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads