Hello,
I'm new to .NET. I have an application that is running in VB6. It sends text through COM1 port to another device.
When I converted the VB6 code to .NET the string it sends out is different! I have tried so many things and don't know what to do. I used a serial data analyzer and found the two strings are different even the the source code is the same.
when I convert a number using System.Convert.ToChar(X) and sends it through serial the X can only be hex: 0 to hex:3F if I want to get the correct value from the other side. Any value greater than hex:3F will not be hex:3F.
for example if I send
hex:64 you will get hex:3F
send hex:E8 you will get hex:3F
It seems like it max out with a 6 bit register value,
Please help me correct this mess ...
Hmm... I have did a bit of serial in both. I found I needed to use a bytearray to send in several cases. If you send the binary values you should get the results that would would have gotten in VB6
TCP Sockets do the same thing.
If you read the data from a file using Binaryreader and send it to the port as binary no encoding takes place.
I struggled with this for a while before I found the binary method. I have not tryed the convert to byte method, Instead I had used read bytes and sent the bytes to the port. I was able to get an exact file copy through the port using that method whereas in VB6 there was no need to read the file as binary.
Bookmarks