Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all!
I need to communicate with electronic register cash via RS232.
Device connected to computer maybe set to unknown baud rate.
Is it a simple way to test this setting?
Maybe somebody can place a C sample code?

What I have tried:

I have no idea how to start this solution
Posted
Updated 19-Dec-20 4:06am
Comments
The Other John Ingram 19-Dec-20 10:33am    
no there is no magic way to determine through code the baud rate, parity or stop bits. You either put a terminal on the unit and change the settings until you get good data, or you put a scope on it and figure out the timing.
Rick York 19-Dec-20 13:23pm    
Start by getting the documentation for the unit and reading it. You might find this is described in it. You did not list the model number of the item so we can't help you with that.

If the machine will transmit without any input might it be possible to monitor the data pulses on an oscilloscope. Assuming the smallest time is one bit the nearest baud rate would be 1/t. i.e. at 4800 baud 't' would be around 0.2 ms
If an oscilloscope wasn't available, might you wire the CR TX bit to one of your RS232 status bits e.g. CTS and then time the edges on that.

After that the waters get muddy.

The cash register might require CTS and DSR at it's end before it will transmit. These would require setting at your end and cross wiring to the appropriate lines.

The variables then include, not only baud rate but bit's per character, parity and encoding such as ASCII, EBCDIC, etc.

After that is the protocol i.e. you have to send a particular string before it will respond. "@@AX"

So a first guess would be to build a loop which sets up a baud rate, DTR and ships out a couple of RETURN codes. Wait a second, display the baud and any response in HEXADECIMAL and select the next baud rate.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900