Hi guys,
I have been using the USART command 'WaitForStr' to send a string from windows terminal.
Now, as my project has developed, I cannot use the same port pins.
So I decided to use SUART and declared 'UART.SetRX(PORTB.2)'.
However I have not managed to find the equivalent to 'WaitForStr'
I have looked in the help file and done some research on the forum, but I had no luck.
Can anyone give me an example of how to send a string and verify it?
Regards
Francesco C.
How to red a string using SUART?
Moderators: David Barker, Jerry Messina
-
- Posts: 41
- Joined: Thu Feb 26, 2009 6:54 pm
- Location: UK
If you look at post 7 here http://www.sfcompiler.co.uk/forum/viewtopic.php?t=645
You could modify that to work with soft usart.
You will need to use a known time when the data is coming or use the idea in that post of waiting for the rx pin to change state and jump to the receive routine.
If you load the characters into a string (or an array) and do a compare against your wanted data then it will be fine.
Do not expect to get very high speeds with the soft usart especially on low crystal speeds, what you are doing is by far better suited to the real usart, an interrupt driven routine is easy and super reliable, can you not change the other use of these pins and stick with hardware usart, might save you a great big pile of dead code.
You could modify that to work with soft usart.
You will need to use a known time when the data is coming or use the idea in that post of waiting for the rx pin to change state and jump to the receive routine.
If you load the characters into a string (or an array) and do a compare against your wanted data then it will be fine.
Do not expect to get very high speeds with the soft usart especially on low crystal speeds, what you are doing is by far better suited to the real usart, an interrupt driven routine is easy and super reliable, can you not change the other use of these pins and stick with hardware usart, might save you a great big pile of dead code.
-
- Posts: 41
- Joined: Thu Feb 26, 2009 6:54 pm
- Location: UK