In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Jonny; Aren't those state machines a great way to deal with sequential issues !!!! In fact, I have developed the concept quite a bit further to the point where a real time sequencer reads a string one byte at a time using the iread instruction, and interprets the byte as the address of a tiny atomic piece of code (such as one of many states), and then jumps there to execute it. The string may also concecutively have other parameters such as delay time values, all as required by that piece of code. When the piece has finished running (it is always very short), then it returns control to the scheduler which reads the next byte as the address for the next piece of code. Each piece of code knows how many parameters to read out of the string. In its simplest view, the string is simply a list of address names for the small executables, interspersed with other parameters as required. This mechanism lends itself well to multiple co-operative threads, each non-blocking, and readily implemented. It lets you think about the tasks to be done, and relieves one somewhat of the details of interaction between threads. It works particularly well for cases where you have to fire off serial configuration data such as a list of "AT" commands to a modem or a cell phone. The byte string holds the virtual UART state addresses, as well as the data to be sent, and the delay times in between the AT commands, responses permitted etc. Naturally one can jump from string to string, or loop any number of times within a string. Great fun! Cheers, Peter (pjv) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=242730#m243211 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)