Sending 5-bit Baudot Over Serial
-
Can anybody help me in implementing a method to send 5-bit Baudot codes over a serial port? I have an application that must communicate with a piece of hardware that sends 5-bit Baudot data, so I am building a simulator to run on a different computer to send the same format data to our receiving PC for testing. The simulator is written in C# using .NET 2.0, so I am utilizing the System.IO.Ports.Serial interface. I can send and receive the data as 8-bit with no problems at all. The receiving PC has a serial card that does support 5-bit communications. In the implementation, I tried manually doing the encoding to Baudot and sending it as 8-bit using the trick given here: http://graffiti.virgin.net/ljmayes.mal/baud/baud.htm[^] (bitwise OR'ing each character with 0xE0 to set the 3 MSBs to 1, which should simulate sending multiple stop bits). However, on the receiving end, when I set it to 5 bits, I just get a bunch of boxes in the terminal output, and when I set it to 8 bits, I get gibberish characters. I'm not sure if I need to set the encoding to UTF8 or ASCII, or if it even makes a difference since I am using the SerialPort.Write() method that takes in a Byte[], offset, and length. I have tried setting it to both ways and it didn't work. Has anybody done anything like this before, or has any ideas on how to implement it? Thanks.
-- Marcus Kwok
-
Can anybody help me in implementing a method to send 5-bit Baudot codes over a serial port? I have an application that must communicate with a piece of hardware that sends 5-bit Baudot data, so I am building a simulator to run on a different computer to send the same format data to our receiving PC for testing. The simulator is written in C# using .NET 2.0, so I am utilizing the System.IO.Ports.Serial interface. I can send and receive the data as 8-bit with no problems at all. The receiving PC has a serial card that does support 5-bit communications. In the implementation, I tried manually doing the encoding to Baudot and sending it as 8-bit using the trick given here: http://graffiti.virgin.net/ljmayes.mal/baud/baud.htm[^] (bitwise OR'ing each character with 0xE0 to set the 3 MSBs to 1, which should simulate sending multiple stop bits). However, on the receiving end, when I set it to 5 bits, I just get a bunch of boxes in the terminal output, and when I set it to 8 bits, I get gibberish characters. I'm not sure if I need to set the encoding to UTF8 or ASCII, or if it even makes a difference since I am using the SerialPort.Write() method that takes in a Byte[], offset, and length. I have tried setting it to both ways and it didn't work. Has anybody done anything like this before, or has any ideas on how to implement it? Thanks.
-- Marcus Kwok
Though I've no experience of Baudot, I'd recommend you use a port monitoring program e.g. Portmon to obtain a lot more information about whats happening at the port. Though you currently see: "boxes in the terminal output ...gibberish characters"; It just might be the case that you can glean some information from the values of these characters when viewed in hex. Being able to see the way received/sent bytes are grouped and port control codes helps a great deal as well.
-
Though I've no experience of Baudot, I'd recommend you use a port monitoring program e.g. Portmon to obtain a lot more information about whats happening at the port. Though you currently see: "boxes in the terminal output ...gibberish characters"; It just might be the case that you can glean some information from the values of these characters when viewed in hex. Being able to see the way received/sent bytes are grouped and port control codes helps a great deal as well.
-
Though I've no experience of Baudot, I'd recommend you use a port monitoring program e.g. Portmon to obtain a lot more information about whats happening at the port. Though you currently see: "boxes in the terminal output ...gibberish characters"; It just might be the case that you can glean some information from the values of these characters when viewed in hex. Being able to see the way received/sent bytes are grouped and port control codes helps a great deal as well.
Thanks for the PortMon tip, using the tool I was able to see that the machine was receiving what I had expected. It appeared that the values were being received properly, but then I found out that the software was expecting the data to be encoded differently than what I thought had to be sent. I also suspect that the terminal program only recognized ASCII encoding and not Baudot, so it was not able to decode the message into plain text. Thanks for your help. It seems that the ultimate solution to my problem is application-specific.
-- Marcus Kwok