Hi,
Not sure what you mean by The only solution I have thought was "nested IF loop" but microcode studio don't support this kinda command rather just "IF...THEN".
First of all MicroCodeStudio is just the editor, the support or lack there of for any commands etc is down to the compiler - which is PBP. And yes, PBP supports nested IF/THEN
Code:
If myData[0] = "A" THEN
If myData[1] = "B" THEN
If myData[2] = "C" THEN
' Do whatever
ENDIF
ENDIF
ENDIF
And yes PBP supports IF/THEN in loops...
Code:
i VAR BYTE
DataIn VAR BYTE[16]
ActualData VAR BYTE [6]
' DataIn is 16 bytes containg A A A A A H A N S O N E E E E E
' Verify that the first 5 bytes are all "A"
For i = 0 to 4
If DataIn[i] <> "A" THEN GOTO Start ' Nope, not qualified, start over...
NEXT
' Verify that the last 5 bytes are all "E"
For i = 11 to 15
If DataIn[i] <> "E" THEN GOTO Start ' Nope, not qualified, start over...
NEXT
' Yes, header and footer qualified. Now extract actual data, 6 bytes, store in array ActualData
For i = 5 to 10
ActualData[i-5] = DataIn[i]
NEXT
You could/should also look into the WAIT or possibly WAITSTR modifiers of the SERIN command. Or, once you've got all the data in the array, you might want to look at the ARRAYREAD command to parse the data. Lots of options available.
/Henrik.
Bookmarks