Ok,
I started again from your code, and modified one thing at a time. I've removed the comments to make it easier to read here (I figure you don't need your own comments).
1. I saved the data from the 1st record by copying it into BytesGP[ByteGPN]. I need that data so I can write it to the EEPROM.
2. I was able to get just Doodle under Interupt control.
3. I was able to save the data from RCREG. There was indeed the 1st character from the next record in there. The data is stored in BytesBK[ByteBKN].
?. But I can't figure out what I'm doing wrong to get the rest of the 2nd record. I must be losing some kind of flag or something to tell USART not to hyperspace the rest of the 2nd record.
====================================
define LOADER_USED 1
ASM
LIST
INCLUDE 'M16F87X.INC' ; PM header
DEVICE PIC16F877, HS_OSC, WDT_OFF, PWRT_ON, BOD_ON, LVP_OFF, CPD_OFF, WRT_OFF, DEBUG_OFF, PROTECT_OFF
XALL
NOLIST
ENDASM
define OSC 20
define HSER_BAUD 19200
DEFINE HSER_CLROERR 1
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
GP VAR BYTE
BytesIn var byte[80]
ByteCnt var byte
BytesGP VAR BYTE[80]
ByteGPN VAR BYTE
BytesBK VAR BYTE[80]
ByteBKN VAR BYTE
X VAR BYTE
EOM CON "~"
OERR VAR RCSTA.1
CREN VAR RCSTA.4
RCIF VAR PIR1.5
ByteCnt = 0
ADCON1 = 7
INTCON = %11000000
PIE1.5 = 1
' -------------------------------------------------------------
GOTO Start
' -------------------------------------------------------------
Main:
WHILE RCIF
BytesIn[ByteCnt]=RCREG
If BytesIn[ByteCnt]=EOM then OutMsg
ByteCnt=ByteCnt+1
WEND
RESUME
' -------------------------------------------------------------
OutMsg:
HSEROUT [13,10,dec ByteCnt," Bytes Rcvd:",STR BytesIn\ByteCnt]
FOR GP=0 to ByteCnt
BytesGP[GP]=BytesIn[GP]
BytesIn[GP]=0
NEXT
ByteGPN=ByteCnt-1
ByteCnt=0
ByteBKN=0
WHILE RCIF
BytesBK[ByteBKN]=RCREG
ByteBKN=ByteBKN+1
WEND
GOTO Main
' -------------------------------------------------------------
On Interrupt Goto Main
Doodle:
FOR X = 0 TO 250 : PAUSEUS 20 : NEXT X
FOR X = 0 TO 250 : PAUSEUS 20 : NEXT X
RETURN
INTCON=$80
' -------------------------------------------------------------
Start:
ByteGPN=0
WHILE ByteGPN=0 : GOsub Doodle : Wend
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''
' BytesGP[ByteGPN] Data from BytesIn is saved here for EEPROM
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''
' Place contents trashed from RCREG back in beginning of BytesIn
ByteCnt=ByteBKN-1
For X=0 TO ByteCnt
BytesIn[X]=BytesBK[X]
NEXT X
HSEROUT [13,10,dec ByteCnt," Bytes Saved:",STR BytesIn\ByteCnt]
GOTO Start
' -------------------------------------------------------------
end
Bookmarks