Hi all,

Has anyone any idea why the write command does not want to work inside a hardware interrupt routine. Is it maybe too fast or is it maybe that with MPASM things are different.
My program uses Darrel's instant interrupts and when in the interrupt it gets a new piece of data and must write it to EEPROM. Before I started with the interrupts and used polling and PM all worked fine, now no data change in eeprom.

This is the Interrupt routine:
'==================== DATA RECEIVE ROUTINE ==============================

GETDATA:
'serout2 test,baud,["int",10,13]

IF RCIF=1 THEN 'DATA IS READY TO BE COLLECTED
'REMOVE BYTE FROM RCIF REGISTER

VALUE=RCREG
IF VALUE = $A0 THEN 'CHECK TO SEE IF THE BYTE IS THE START BYTE
BYTECOUNTER=0
ENDIF
'Serout2 test,BAUD,["int",10,13] 'TO SHOW OVERFLOW

IF BYTECOUNTER < 8 THEN
BUFFER[BYTECOUNTER] = VALUE 'ADD BYTE TO PACKET
BYTECOUNTER=BYTECOUNTER+1 'INCREMENT COUNTER
ENDIF

'************ CHECK IF OVERRUN HAS OCCURRED *******************************

IF OERR=1 THEN
Serout2 test,BAUD,["OERR",10,13] 'TO SHOW OVERFLOW
PAUSE 1000
CREN=0 'STOP CONTINUOUS RECEIVE
CREN=1 'RESTART CONTINUOS RECIEVE & CLEAR THE OVERRUN FLAG
BYTECOUNTER=0 'RESET COUNTER AS PART OF PACKET HAS BEEN LOST SO START AGAIN
BUFFER=0
GOTO GETDATA
ENDIF

'************** PACKET MUST START WITH $A0 AND HAVE $AF AS IT'S 7TH BYTE. ******

IF BYTECOUNTER=7 AND BUFFER[0]=$A0 AND BUFFER[6]=$AF THEN
GOT=1 'INDICATE THAT THIS IS A NEW PACKET

' ****************** PRESET CONTROL **********************************


IF ID = (BUFFER[1]+1) THEN 'CHECK IF ID IS FOR THIS INSERTADOR &
'PELCO VALUE STARTS AT 0 SO NEED TO ADD 1

IF BUFFER[3]=$07 THEN

preset=buffer[5]

IF PRESET=0 THEN
PRESET=1 'Ensure that preset 0 is never used as inputs start at 1
ENDIF

IF PRESET=76 THEN
DATA_OFF=1
GOTO JUMP
ENDIF

if preset < 24 then
DATA_OFF=0

write 0,preset '******* HERE IT SHOULD WRITE ******
else
read 0,preset 'If preset entered is above 24 read last saved preset
endif

JUMP:

endif

endif

ELSE
GOTO GETDATA 'IF PACKET NOT COMPLETE GO BACK FOR NEXT BYTE
ENDIF


ENDIF

@ INT_RETURN