Page 1 of 1
UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 9:54 am
by leifkrinkle
I am trying to do a simple thru-put.
I know I am sending a single byte via udp to my SB72, but printing that byte to the serial port seems to be problematic.
I have tried using ShowData(upkt.GetDataBuffer(), len); but this converts the byte to ascii
I have tried using write(fdserial,(const char *) upkt.GetDataBuffer(), len ), which seems to print the appropriate byte from 32 to 127 , but not the appropriate byte < 32 or > 127.
What I would like to see is a byte from 0 to 255 be sent via UDP directly written to the serial port.
Am I casting the byte improperly? Is there a function that prints just bytes, not ascii, or chars?
Thanks,
Leif Krinkle
Re: UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 12:07 pm
by rnixon
What are you using on the serial side to "view" the data? Is it capable of displaying binary data in binary form? The ranges you provided for what you say works corresponds to printable/non-printable characters.
Re: UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 1:06 pm
by leifkrinkle
I am using zterm and Max/MSP
With ShowData(upkt.GetDataBuffer(), len); when I send a UDP byte I get the appropriate byte out serial but represented in ascii hex
with write(fdserial,(const char *) upkt.GetDataBuffer(), len ); I send a UDP byte and get the exact byte back out of serial from 32 to 127, but anything <32 or >127 i receive a binary 46 out of serial.
I am only slightly modifying the udp example found in C:\nburn\examples\udp\SimpleUDPToSerial
is there a function that outputs a byte out of serial?
Re: UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 1:20 pm
by Chris Ruff
It is not normal for a terminal program to show you the data without altering it. I use Viewcomm (o-o-o-old) in DOS mode to see the actual data. I also have used XTALK.EXE (o-o-o-o-o-o-o-o-old) and put it into debug mode to see the binary values
It is normal for all terminal programs to make binary data 'readable'
PCs also like to eat 0 and 0xff chars as well
Re: UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 2:20 pm
by rnixon
My first suspect is zterm is messing with non-printable data, so its not your netburner code. You can verify this with a scope. The chars zterm is not "printing" are terminal control codes, such as 0x07 for beep, etc.
Re: UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 2:21 pm
by tod
I have had good luck on the NetBurner family with just using:
I'm not sure why I have to add the +0x0 but it doesn't work without it and it works with it.
It would probably be more portable to do something like:
Code: Select all
char some_char = static_cast<char>(some_binary_value +0); //maybe the +0 isn't needed but would require testing
cout << some_char;
Re: UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 4:23 pm
by Ridgeglider
you might also look at a terminal program called indigo
http://www.shadeblue.com/products/indigo/
It has modes where it displays ascii, hex, binary, control codes. You can also set it up to color code key phrases that a NB module might be spewing out so you can see them easily. It also has a much longer buffer than MTTTY and I've found it less subject to MTTTY's (rare) quirky lockups. It costs $25, but works well. Note that it gets locked to a specific PC, maybe w/ the hard disk,or MAC, but they will allow you to deregister and move it...
Re: UDP Byte in Serial Byte out
Posted: Wed May 12, 2010 6:21 pm
by Chris Ruff
Re: UDP Byte in Serial Byte out
Posted: Sat May 22, 2010 1:15 pm
by PJE
It's also the serial terminal I've used for a number of years. It has saved me much more than I spent on it in saved time and effort.
Given it's capabilities, I feel $25 is good value. There have been a couple of occasions when I had to use another terminal app for a specific purpose, but Shade Blue Indigo is my default terminal app.