Decode Serial Port File Transfer Protocols from Scratch with LabVIEW and Serial Monitor
Sometimes we need to write our own software to transfer files to serial port connected device, like DNC, which provides manuals and working software but no source code or the author of the software does not exist or does not support the software anymore. So, it’s a must to decode the serial transfer protocol to build our own software which is based on this protocol.
Here, I’ll show how to decode the serial transfer protocol from scratch with the help of LabVIEW and Serial Monitor step by step.
Step 1, we need to install a serial monitor software. Here we use HHD Software Serial Monitor. This software provides a monitoring device driver, which lies upon the serial device driver of the Windows NT, Windows 2000 and Windows XP operating systems. It collects all information including data read and written, control codes received and sent to the underlying hardware by the user mode client. After the installation of the serial monitor software, we first run this monitor software and start a monitoring session and set it up to log all the activity of the serial port like the figure below.
In the menu, select File–New Session, a dialog box displayed as in the figure step 1. Select “next”, at step 2 select Serial Port Monitor; at step 3, select the serial port to be monitored; at step 4 select “Logging…“; at step 5, a pop-up dialog box displayed, then config the log file.
Step 2, we start the serial monitoring session in the HHD Software Serial Monitor. After that, run the working software provided by the serial device, transfer one file to the device, and fetch one file from the device. Then exit the working software and stop the log operation of the serial monitor software, and copy the files which are transfered from and to the serial device to local disk for later decode operation.
Step 3, start a Log File Display session in HHD Software Serial Monitor, load the log file generated in step 2. And the serial port activity history will displayed like the figure below. 
- In this table: Ordinal, the column contains the ordinal number of the request. The ordinal increases from up to down. Function, the column contains the name of the request. It can be one of standard IRP major function names. Direction, the column contains either UP or DOWN message, showing the direction of the request. If DOWN displayed, the request was initiated by the application, otherwise by the device driver. Data Present, the column displays the flag indicating whether the request comes with data or not. Status, the column displays the status of the request. Data, if the Data Present column displays TRUE, the first 100 bytes of data are displayed in this column in hexadecimal numbers. Data (Characters) , if the Data Present column displays TRUE, the first 100 bytes of data are displayed in this column in characters.
Step 4, use LabVIEW to get the information of the files transfered. Open LabVIEW, create a VI to get information of the files includes file size in bytes, the content of the file in text format displayed in hex.
Step 5, compare the file information with the log file display in HHD Software Serial Monitor. First, locate the number of file size in the log file. Then compare the file content with the logging file, locate where the file start transfer and where stop transfer. Usually, there should be one part to store the file name, one part to store file size, one part to store file content, one part to store hex numbers which indicate starting transfer and one part to store hex numbers which indicate stop transfer. Find all these part out and we get the protocol of the serial transfer of this device.
Step 6, use LabVIEW create a serial port transfer software using the protocol found in step 5 to verify if it works.
No related posts.
2 Responses to “Decode Serial Port File Transfer Protocols from Scratch with LabVIEW and Serial Monitor”
Comment from Ralph
Time March 6, 2010 at 11:34 am
@Andrew Kennaugh,
All the links are updated, thanks!
Comment from Andrew Kennaugh
Time March 4, 2010 at 7:55 am
Just so your site is up to date, the HHD Serial software monitor link is now bad. HHD have other links to their software.
http://www.hhdsoftware.com/Family/serial-monitor.html
Andy