By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

Serial port encoding

P: n/a
I am trying to use the serial port control to send and receive 8 bit
characters to/ from a n instrument. whatever I set encoding to it
converts the characters.

Any ideas how to stop it?

Thanks

Jack Russell
Oct 11 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Jack Russell" <ja***@norubbish.tpg.com.auschrieb
I am trying to use the serial port control to send and receive 8 bit
characters to/ from a n instrument. whatever I set encoding to it
converts the characters.

Any ideas how to stop it?
Can you give an example of the sent/received data? How did you find out that
it gets converted? How do you send the data (code)?
Armin

Oct 11 '07 #2

P: n/a
"Jack Russell" <ja***@norubbish.tpg.com.auschrieb


Armin
Sorry, I am not sending "strings" I am sending binary data.

You wrote:

serialport1.write(String)
I thought String means String. Now you write, you don't send a String.
What's right now?
Armin

Oct 12 '07 #3

P: n/a
Jack Russell wrote:
>Which encoding does the device expect?
Armin
This is the point, I and a lot of other people use serial ports to
transmit binary data, we do not want any encoding. According to the help
files the default is 7 bit ascii, but you can set the various unicode
alternatives. The help file says that setting 0 gives the "default"
which is patently not true
The solution is very simple. If you want to send binary data, send
binary data. Don't send it as a string, send it as a byte array.

--
Göran Andersson
_____
http://www.guffa.com
Oct 12 '07 #4

P: n/a
Göran Andersson wrote:
Jack Russell wrote:
>>Which encoding does the device expect?
Armin

This is the point, I and a lot of other people use serial ports to
transmit binary data, we do not want any encoding. According to the
help files the default is 7 bit ascii, but you can set the various
unicode alternatives. The help file says that setting 0 gives the
"default" which is patently not true


The solution is very simple. If you want to send binary data, send
binary data. Don't send it as a string, send it as a byte array.
Thanks, just what I wanted. I should have fully read the help file I
suppose, too many years of fooling devices so it never occurred to me it
would be that easy!

Thanks again

Jack Russell
Oct 13 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.