PJRC.COM Offline Archive, February 07, 2004 Visit this page on the live site |
| ||
Shopping Cart Checkout Shipping Cost Download Website |
Home | MP3 Player | 8051 Tools | All Projects | PJRC Store | Site Map |
You are here: 8051 Tools Code Library Lexer | Search PJRC |
The most likely use for this simple lexer is an 8051 based system which receives commands from a computer, probably while performing other tasks. This lexer allows you to easily implement several multiple character command words in your project/product. The lexer is designed to return control quickly... no waiting for more data once the first part of a string is detected... no failure to recognize any complete command because part of another command was only partially received.
Many 8051 based projects can't spare much CPU time (or perhaps the designer's time and effort)... the typical solution seems to be single character command sets. This code uses relatively few CPU cycles and should be quite easy to use. Hopefully you won't have to resort to single character command sets unless that's what you really wanted.
Briefly, here's the limitations:
Can't recognize numbers, parameters, etc... string must be fixed when you assemble the code.
Finds overlapping and inclusive strings... command set design must be chosen carefully to avoid problems.
No error checking on your strings, string lengths, etc
Strings limited to 255 bytes long, each needs one byte of internal ram, thus limiting the number that can be included in the search list.
Can't deal with backspace.
Some code customization necessary, see the comments in the code for details.