Recieving typed string from PC
Basil
Posts: 380
Hi All, [noparse]:)[/noparse]
I have an application where the user needs to typed command an a PC needs to be sent to the prop and acted upon.
I am using simple_serial as I don't need full duplex.
I have it working no problems when using single letter commands, but how do I get the prop to wait until the user presses return ($0D) before acting on the command.
In other words, the command is a string not a single character.
Thanks for the assistance!
Alec
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
I have an application where the user needs to typed command an a PC needs to be sent to the prop and acted upon.
I am using simple_serial as I don't need full duplex.
I have it working no problems when using single letter commands, but how do I get the prop to wait until the user presses return ($0D) before acting on the command.
In other words, the command is a string not a single character.
Thanks for the assistance!
Alec
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
Comments
repeat until serial.rx==13
dowhateveryouwant
Yeah, I know the $ = hex thing.
Here is some psuedo code of what I want to do. It doesn't quite work in practice :P
repeat until user_chr == $0D
user_chr = serial.rx
user_str = user_str + user_chr
Thanks for the help [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
I will try that out, thanks!
Any other suggestions are helpfull
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
RXStr - "Accepts a string of characters - up to 15 - to be passed by reference
String acceptance terminates with a carriage return.
Will accept up to 15 characters before passing back."
seems perfect for your needs
http://forums.parallax.com/showthread.php?p=624624
It also will convert ascii strings of numbers and convert them to a value, both Decimal and Hex.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Brian
uController.com - home of SpinStudio - the modular Development system for the Propeller
PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!
SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
Seems I didn't search hard enough!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
The previously linked solution uses fullduplexserial which resets the prop when USS is not connected so it would probably cause problems.
Thanks for that [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
My our page