If you look at the last code example you may be asking yourself "Hey isn't that the same thing as HSEROUT ["This is a string"]?"
Well... yes it is, sort of. What I really see to be accomplished here, has more to do with creating the framework for a customizable message string handling Function, then just mimicing an already available PicBasic Pro function. For testing purposes, it is just easier to send it out unaltered through the RS232 port. Ulimately, it will hopefully evolve into a great way to send either message strings, data, or both to any device you wish. While at the same time doing it in a way that is more like a built-in PicBasic Pro function.
A great example of what this could be used for, is imagine that you are interfaced to a device that would accept message strings via RS232, but always requires special commands to precede the message. Using what has already been developed here, all that would be required is to add these commands within the printSTR code (same as what was done for the carriage return and linefeed). Then every time you send a message such as @ SendStr "This is a string" the pre commands would be automatically sent as well.
Even better still, imagine if you were interfaced to several different devices or gateways, each one having special communication requirements (I2C, SPI, One-Wire, RS232, ect.). Every protocol could concievably be supported within the printSTR code, thereby allowing you to broadcast simultaneously to all devices via the single line SendStr function. Pretty cool huh!
We are only scratching the surface as to the possibilities.
Bookmarks