This article describes how to test RS485 communication between ROV Control Unit and PC computer with RS485 to RS232 converter. Test programs are provided to test transmission from 2400bps to 115200bps. There are 2 programs. The first one is prepared for Windows, the second for Atmega16 chip. Windows program sends random data to ROV Control Unit. Atmega16 sends back all data to desktop computer. If sent and received data is the same communication works properly. In addition to executable version of programs, there are full source codes available. Atmega16 program is written in BASCOM-AVR, Windows in Microsoft Visual Studio 2005. Download RS485_test_exec.zip file. It consist 2 files:
First, program Atmega16 chip on Control Unit with RS485ECHO.HEX file. Optionally you can compile source code in BASCOM-AVR. Connect RS485/RS232 converter to Control Unit using 2 wires (1 pair). Be sure to match A and B sockets on converter and Control Unit. Optionally you can connect the second serial port to DB1 of Control Unit to see additional diagnostic messages. Run command prompt window. For NT/2000/XP run cmd.exe, for other versions of Windows run command.com. At the beginning program asks for COM port number to which RS485/RS232 converter is connected. Type 1 for COM1, 2 for COM2, etc and press ENTER.
If serial port was successfully opened you should see this message: LED should flash now. If you do not see this, check connections and run test program again. Watch green LED. Blinking LED means that you properly connected converter and you can go to the next step of test. Press ENTER key. The real test begins. Program will send data to Control Unit and based on data sent back diagnose connection. Test includes all standard transmission speeds from 2400bps up to 115200bps. You can check other speed values by modifying the software.
Testing 2400bps...
Sent 100 bytes
Received 100 bytes
All data ok
2400bps TRANSMISSION OK
During test Control Unit sends additional diagnostic messages to DB1 port. It can be useful to check this messages in case of communication problems. Example output:
|
|||||||||
