Hi all, In a PIC16F627 application I recently developed, I am having a code-hang=20 problem. My best diagnosis so far, is that the code is getting stuck in = the=20 EEPROM write routine [code posted at the end of this email] which is call= ed=20 from a main code loop. Interrupt processing seems to be working fine sti= ll,=20 even though this main loop is locked up. In the write routine, I'm waiting on the EEIF flag to be set, indicating = that=20 the write operation is complete, but I'm guessing that this is where it's= =20 getting stuck. The EEPROM writes happen in groups of 5 (all calling this routine), and I= 'm=20 not verifying that the write operation was successful by checking the act= ual=20 value saved (at least, not yet). I'm also not using a watchdog timer yet= =2E =20 The 2 other interrupts are TMR0 which updates the multiplexed display, an= d=20 TMR2 which checks for and processes an external signal. Any idea what could be going wrong here?=20 Cheers, -Neil. ;----------------------------------------------------------------- ; Write data to EEPROM (location supplied in W, data in E_DATA) ;----------------------------------------------------------------- WriteEEData: =09bcf=09PIR1,EEIF=09; Reset write-complete flag =09bsf=09STATUS,RP0=09; Bank 1 =09movwf=09EEADR =09bcf=09STATUS,RP0=09; Bank 0 =09movf=09E_DATA,W=09; Get data to be stored =09bcf=09PIR1,EEIF=09; Ensure interrupt flag off while in bank 0 =09bsf=09STATUS,RP0=09; Bank 1 =09movwf=09EEDATA =09bsf=09EECON1,WREN=09; Enable writes =09bcf=09INTCON,GIE=09; Disable interrupts =09movlw=09H'55'=09=09; Special seq =09movwf=09EECON2=09=09; ... =09movlw=09H'AA'=09=09; ... =09movwf=09EECON2=09=09; ... =09bsf=09EECON1,WR=09; Start write operation =09bcf=09EECON1,WREN=09; Disable writes =09bcf=09STATUS,RP0=09; Bank to bank 0 =09bsf=09INTCON,GIE=09; Re-enable interrupts WriteEEWait: =09btfss=09PIR1,EEIF=09; Check EEIF flag for write completion =09goto=09WriteEEWait WriteEEDataDone: =09return -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body