Comparing Strings
I am looking for an easy way to compare strings in a BS2. The string was read into an array with this command, SERIN LCDin,Baud,[noparse][[/noparse]STR serStr\9]. Ideally I would to use something as simple as, IF serStr <> "bla bla bla" THEN...
Any help would be great!
Any help would be great!

Comments
The easiest thing to do would be to use DATA statements to place constant strings into EEPROM and write a subroutine to compare your variable against a string given its address in EEPROM. You could also write a subroutine to look up a string in a table in EEPROM like:
Bla1 data "BlaBlaBla",0 data "MoreBla",0 i var word j var word x var byte z var byte ' This is called by setting i to the address of the EEPROM string to compare ' It returns with z zero if the match was successful or z non-zero if a mismatch ' If there's a mismatch, i is left pointing to the next string in EEPROM compare: j = -1 ' Start j one position before start of string check: read i,x : i = i + 1 : j = j + 1 ' Get a character and increment pointers if serStr(j) = x then goto check ' Still matching, continue comparing z = x findEnd: if x = 0 then return ' Make sure i points to the next string read i,x : i = i + 1 goto findEndPost Edited (Mike Green) : 11/16/2008 8:07:51 PM GMT
I am new to STAMPs and am using a BS2 for development. It has quickly become obvious I need to move up to the larger STAMPs.
Thanks again.
If you're used to more traditional processors, the 28SX and 48SX chips (and the boards, I love the boards) will run at 50 MIPS and support a real hardware interrupt, you might check those out.