Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing CR in output

Status
Not open for further replies.

Tatto

Programmer
Aug 24, 2009
6
BR
Hello.

I have a doubt and need some help.

I have a small script that opens a serial communication (USB) with a board containing a zigbee module. Almost all the the messages I have to send through this port contains a carriage-return (0x0D) in the end of the string. Is it possible to force this character to output?
Apparently, when I try : "puts $channel ATMY\r", the carriage-return is ignored.

The messages that don't have the CR in the end are well received by the board.

Thank you.
Renato
 
try
"puts $channel ATMY\x0d"

_________________
Bob Rashkin
 
still not working. =/

is it possible to monitor the output? i mean, see exactly all the bytes sent by "puts"?
 
Well, I would "puts" the same string without the "$channel". That would print it to STDOUT. It may or may not display how you want it to.

More to the point, how are you certain that the behavior you are observing is due to the absence of "\r" or "\x0d"?

_________________
Bob Rashkin
 
Well, when I try only "puts ATMY\x0d", I get ATMY on the display, what is reasonable.
Even using -nonewline or the command flush, I don't get the results I expected.

And i know that's the problem, because for the commands that don't ask a CR in the end, my zigbee module sends back what i expected.

So.. i'm still blocked.. But I thank you for your suggestions!
 
maybe \x0d0a

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top