Serial Port question
firestorm.v1
Posts: 94
Is there a way to get the BS2 to open a pin for serial data in without having to send a CR/LF at the end of each character?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
I am thinking about designing an interface circuit using a BS2 to go between a PC and an LCD. I was wondering if there is a way for the BS2 to be "listening" for any character rather waiting for an "CR/LF" in order to continue processing.
Example, if my code is:
SERIN 1, 16780, [noparse][[/noparse]sData]
My experience has been that the BS2 will wait for a character, then a CR/LF in order to continue the program.
What I want to do is have it wait for any character, then once it receives it, continue with the program without waiting for the CR/LF. Do you know if that is possible or is that something I will need to code around?
Another thing, if you use modifiers , such as DEC(n), if any character other than Number will exit the Serin Command
Hope to Help
Amaral
) the satisfying condition would be one byte, program flow would then continue.
sData would then contain the ascii value of the transmitted byte. (example transmit "A" sData contains 65, transmit 6 sData contains 54, transmit 63 sData contains 54).
You see by the example that if you are only transmitting alpha data one letter at a time it works fine, for numeric data anything over 9 your example code only catches the first digit (byte).
The serin formatters (wait,DEC,STR stc.) add the flexibility to convert your incoming data "on the fly" and accept strings of varying lengths and types. The CR/LF are sometimes useful tools to determine the end of string but not absolutly neccessary.
Jeff T.
Get a character from the serial port,
Process depending on char received, if control character (^g) then wait for command to follow otherwise print char on LCD depending on options set in memory.
Repeat as necessary.
IIRC, any character is a single byte, and can be received by using SERIN, right?
Thanks for all your help everyone!