I have a 28X2 project that is using SLOT 1 and SLOT 2.
SLOT 1 parses the scratchpad, looking for data in a XML stream which is typically 200 characters long. The XML is generated by a CleverWatts power monitor and comes is at 57600. I am capturing via back ground High Speed Serial which does the job nicely. I have a 8Mhz resonator to ensure accuracy.
I have a 4x20 LCD upon which is displayed the data from the XML.
The LCD routines are in SLOT 2.
THE PROBLEM
Most times, BUT not every time, the ptr and hserptr are 0 when the Slot 1 is run even though SLOT 1 is only called when they are different.
If I put ptr and hserprt into B0 and B1 and reset prt and hserptr from B0 and B1 at the start of SLOT 1, then all goes well.
Technical, what should happen to ptr and hserptr when a RUN x is executed? Are they preserved? Seems not ...
Basically (pun intended) the simplified code below is used.
SLOT 1 parses the scratchpad, looking for data in a XML stream which is typically 200 characters long. The XML is generated by a CleverWatts power monitor and comes is at 57600. I am capturing via back ground High Speed Serial which does the job nicely. I have a 8Mhz resonator to ensure accuracy.
I have a 4x20 LCD upon which is displayed the data from the XML.
The LCD routines are in SLOT 2.
THE PROBLEM
Most times, BUT not every time, the ptr and hserptr are 0 when the Slot 1 is run even though SLOT 1 is only called when they are different.
If I put ptr and hserprt into B0 and B1 and reset prt and hserptr from B0 and B1 at the start of SLOT 1, then all goes well.
Technical, what should happen to ptr and hserptr when a RUN x is executed? Are they preserved? Seems not ...
Basically (pun intended) the simplified code below is used.
Code:
#Slot 0
'initialize everything
RUN 2
#SLOT 1
DO
IF hserptr=ptr THEN 'nothing left to do here
RUN 2
ENDIF
GOSUB ParseScratchPad
LOOP
#SLOT 2
'Display data just parsed out of the XML
IF XMLValid=1 THEN
Gosub LCDDisplayData
ENDIF
'wait for data to come in
DO
sertxd(".")
IF hserptr<>Ptr THEN
RUN 1 'Go and parse
ENDIF
pause 2000
LOOP
Last edited: