How do I compare value in memory to a string value
mre_rob
Posts: 31
I have in memory, values loaded and I need to compare to a string. The line in purple never is true. Any help would be appreciated.....
<code>
dat
' THIS MUST BE HERE IN FRONT FOR ABSOLUTE ADDRESSING TO WORK!!!!!
SensorDatum
SensorData··· file "memorymap.txt"' padding used by the memory map
SensorDataPad byte 0,0,0,0
GPRMC········ byte "GPRMC",0
OBJ
· objVGA······· :"VGA_Text"
· objSerial···· :"SerialReceive"
· objMem······· :"GPSSensors_Lib"
CON
· _clkmode··············· = xtal1 + pll16x
· _xinfreq··············· = 5_000_000
· _crlf·················· = $0D
· _rxPin················· = 0
· _baud·················· = 4800
· _serMode··············· = 0
· _vgaPin················ = 16
con
· _sentenceSize = 256
· _serialBuffer = 256·································
VAR
· byte NmeaSentence[noparse][[/noparse]_sentenceSize]
· byte serialBuffer[noparse][[/noparse]_serialBuffer]
· long bootest
PUB Start
· 'bytefill(objMem#SensorDataAddress, 0, objMem#LastVar)
· objVGA.start(_vgaPin)
· objSerial.start(_rxPin,_baud,_serMode)
· repeat 4
··· GetSentence(@NmeaSentence)
··· GetHeader(@NmeaSentence)
··· if (long[noparse][[/noparse]constant(objMem#SensorDataAddress + objMem#head)]==GPRMC)
····· ParseGPRMC
··
PUB Stop
· objVGA.stop
· objSerial.stop
Pri ParseGPRMC
· objVGA.str(string("test: "))
· objVGA.out(_crlf)
Pri GetHeader(ptrSentence)
· byteMove(long[noparse][[/noparse]constant(objMem#SensorDataAddress + objMem#head)],ptrSentence,5)
·
Pri GetSentence(strPtr) | ptr, haveFoundDelimiter, rxChar, delimiter
· delimiter:="$"
· ptr:=0
· haveFoundDelimiter~
· bytefill(@serialBuffer,0,256)
· repeat while !haveFoundDelimiter
··· if (rxChar:=objSerial.rxcheck)=>0
····· if(rxChar==delimiter)···························
······· serialBuffer[noparse][[/noparse]ptr] :=· objSerial.rx······
······· ptr++·················································
······· repeat while ((serialBuffer[noparse][[/noparse]ptr-1] <> 13) and (serialBuffer[noparse][[/noparse]ptr-1] <> delimiter)) and (ptr < 255)·······
········· serialBuffer[noparse][[/noparse]ptr] :=· objSerial.rx··
········· ptr++
······· haveFoundDelimiter~~·····
· serialBuffer[noparse][[/noparse]ptr-1]:=0·······································
· byteMove(strPtr,@serialBuffer,256)·
</code>
<code>
dat
' THIS MUST BE HERE IN FRONT FOR ABSOLUTE ADDRESSING TO WORK!!!!!
SensorDatum
SensorData··· file "memorymap.txt"' padding used by the memory map
SensorDataPad byte 0,0,0,0
GPRMC········ byte "GPRMC",0
OBJ
· objVGA······· :"VGA_Text"
· objSerial···· :"SerialReceive"
· objMem······· :"GPSSensors_Lib"
CON
· _clkmode··············· = xtal1 + pll16x
· _xinfreq··············· = 5_000_000
· _crlf·················· = $0D
· _rxPin················· = 0
· _baud·················· = 4800
· _serMode··············· = 0
· _vgaPin················ = 16
con
· _sentenceSize = 256
· _serialBuffer = 256·································
VAR
· byte NmeaSentence[noparse][[/noparse]_sentenceSize]
· byte serialBuffer[noparse][[/noparse]_serialBuffer]
· long bootest
PUB Start
· 'bytefill(objMem#SensorDataAddress, 0, objMem#LastVar)
· objVGA.start(_vgaPin)
· objSerial.start(_rxPin,_baud,_serMode)
· repeat 4
··· GetSentence(@NmeaSentence)
··· GetHeader(@NmeaSentence)
··· if (long[noparse][[/noparse]constant(objMem#SensorDataAddress + objMem#head)]==GPRMC)
····· ParseGPRMC
··
PUB Stop
· objVGA.stop
· objSerial.stop
Pri ParseGPRMC
· objVGA.str(string("test: "))
· objVGA.out(_crlf)
Pri GetHeader(ptrSentence)
· byteMove(long[noparse][[/noparse]constant(objMem#SensorDataAddress + objMem#head)],ptrSentence,5)
·
Pri GetSentence(strPtr) | ptr, haveFoundDelimiter, rxChar, delimiter
· delimiter:="$"
· ptr:=0
· haveFoundDelimiter~
· bytefill(@serialBuffer,0,256)
· repeat while !haveFoundDelimiter
··· if (rxChar:=objSerial.rxcheck)=>0
····· if(rxChar==delimiter)···························
······· serialBuffer[noparse][[/noparse]ptr] :=· objSerial.rx······
······· ptr++·················································
······· repeat while ((serialBuffer[noparse][[/noparse]ptr-1] <> 13) and (serialBuffer[noparse][[/noparse]ptr-1] <> delimiter)) and (ptr < 255)·······
········· serialBuffer[noparse][[/noparse]ptr] :=· objSerial.rx··
········· ptr++
······· haveFoundDelimiter~~·····
· serialBuffer[noparse][[/noparse]ptr-1]:=0·······································
· byteMove(strPtr,@serialBuffer,256)·
</code>
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://forums.parallax.com/showthread.php?p=650217
meow, i have my own topic now? (sorta)