473,327 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Serial port encoding

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
4 4641
"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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Peter Krikelis | last post by:
Hi All, I am having a problem setting up input mode for serial communications. (Sorry about the long code post). The following code is what I use to set up my comm port.
16
by: halukg | last post by:
I am trying to send a 6 byte char array from the serial port in new C# 2005 Express: com.Write(new string(new char { (char)34, (char)14, (char)192, (char)51, (char)0, (char)0 }, 0, 6)); I am...
4
by: Lonifasiko | last post by:
Hi, I've been able to communicate using HyperTerminal with my device via serial port COM1. I just send a command and device switches on. I just need that to start playing with it. This way, I...
0
by: pandi | last post by:
Hi, I am using a check scanner.It has functions which gives output like image ,checknumber. i am using serial port to get this output in my coding. My problem is i am not able to read the display...
1
by: *.dpG | last post by:
Hi I have some questions about serial port in vb.net.... I try only to recieve data, and I'm using this to open port...
3
by: ... | last post by:
Hi I need to send a chr(255) to a serial port. When I send it, through comm.write (chr(255)) it sends a chr(63) ... in Hex, I write chr(&FF) and it actually sends chr(&3F) ... why does this...
2
by: evle | last post by:
haw to read data from an Infrared Infrared Remote Control
2
by: Lou | last post by:
I have a class that creates an instance of the seril Port. Every thing works fine except whenever I receive data I cannot display the recieved data. I get no errors but the recived data seems to...
3
by: Rainer Borchmann | last post by:
Hi, please can anyone tell me what is wrong with this code ? i have an oszilloskop on the COM1 ,and nothing comes out of it. Rainer VS2005 .............................. private void...
6
by: cnixuser | last post by:
Hello, I have a basic application written which is designed to data over a serial cable and then receive a response back. I am not getting any triggers to my data received event. I have tried...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.