COMTool User Guide
COMTool User Guide
Version 1.1
12/02/2013
Contents
Terms and Conditions of License for use of gratuitous software .................................................................. 3
Purpose: ........................................................................................................................................................ 3
Installation Instructions:................................................................................................................................. 4
Using COMTool: ............................................................................................................................................ 8
Select a COM Port ..................................................................................................................................... 8
Select a product ......................................................................................................................................... 8
Selecting data as Hex or ASCII ............................................................................................................... 10
Calculating 2’s compliment, XOR’d, or Modbus CRC16 value ............................................................... 10
Big-Endian vs. Little-Endian .................................................................................................................... 11
Entering a Command............................................................................................................................... 11
Transmitting Data .................................................................................................................................... 11
Clear Transmit or Receive Text Boxes .................................................................................................... 12
Copy Selected Received bytes to Clipboard ........................................................................................... 12
Commands Tab ....................................................................................................................................... 15
Scripts Tab............................................................................................................................................... 16
Adding a New Script Command .............................................................................................................. 17
Editing a Script Command ....................................................................................................................... 18
Deleting a Script Command..................................................................................................................... 18
Reorder Command Sequence ................................................................................................................. 18
Selecting Commands to Execute ............................................................................................................ 18
Executing a Scripts Command ................................................................................................................ 19
By downloading or using US Digital software, you agree to the terms and conditions below and as further
detailed on our website at http://www.usdigital.com/company/terms-conditions.shtml. If you do not agree
with such terms and conditions, do not use the software. You may promptly return the software and other
items that are part of this product in their original package with your sales receipt to your point of
purchase for a full refund, or if you have downloaded this software from a US Digital web site, then you
must stop using the software and destroy any copies of the software in your possession or control. These
terms and conditions which accompany the original or new versions of the software and patches, point
releases, maintenance releases, updates, enhancements, or upgrades thereto upon installation or
download, are applicable.
Permission to use, copy, modify and distribute this software without fee is hereby granted. US Digital
makes no warranty or representations about the suitability of the software for any purpose. It is provided
"AS IS" without any express or implied warranty, including the implied warranties of merchantability,
fitness for a particular purpose and non-infringement. US Digital shall not be liable for any direct, indirect,
special or consequential damages resulting from the loss of use, data or projects, whether in an action of
contract or tort, arising out of or in connection with the use or performance of this software. Your use of
the software is entirely at your own risk. In connection with the software, you agree to comply with all
export laws and restrictions and regulations of the Department of Commerce, the United States
Department of Treasury Office of Foreign Assets Control ("OFAC"), or other United States or foreign
agency or authority, and you agree not to export, or allow the export or re-export of the software in
violation of any such restrictions, laws or regulations. Downloading or using US Digital software is implicit
acceptance of these terms and conditions and as further detailed at
http://www.usdigital.com/company/terms-conditions.shtml.
Purpose:
The US Digital COMTool application is designed to assist debugging of serial
communication between host PC and US Digital devices that provide a serial interface.
This document describes how to install the COMTool application and use all available
features.
Installation Instructions:
Download the COMTool application from US Digital website
http://usdigital.com/support/software/comtool and run the COMTool Installation.
The installation program will install the COMTool application with a preloaded list of
commonly used commands for US Digital serial devices. Drivers for a specific US
Digital device can be downloaded from US Digital’s device specific software page.
The following is a list of some of the US Digital serial devices supported by the
COMTool application: A2, QSB, T7 (mod2 and mod4), and X3.
The COMTool setup program displays the following sequence of screen shots. Typically
the Next button is clicked on each screen to install the default COMTool configuration.
Click the Next button unless the default program destination folder needs to be
changed.
Using COMTool:
Locate and start the COMTool program.
Click on the Windows Start Icon. Click on the All Programs menu item. Locate and click
the US Digital\COMTool menu item from the Windows Start menu.
Select the COM port that the target device uses. If there is more than one COM port
listed, then the target device COM port can be identified by observing the COM Port list
while the device is unplugged and then re-plugged. The device will disappear when
unplugged and then re-appear once plugged back in.
Select a product
After the appropriate COM port settings have been set, click on the Connect button.
If the selected COM port is successfully opened, then connection icon will show
connected with a green arrow.
If the COM port is already opened by another application, then the following message
will be displayed. Only one application can have the COM port open at a time.
To determine the hexadecimal value for a decimal number, enter the decimal number
into the Convert Decimal to Hex field. The Hex value will automatically update as the
decimal value is entered. To append the converted decimal to hex value to the end of
the command, click on the add button.
Entering a Command
The data can be entered manually or by selecting a command from the Commands list
view. Double-clicking the command in the Commands list view will automatically copy
the command to the transmit text box and send the command to the device. If sending
hex commands, separate each hex byte with a space.
Every character or byte sent is accumulated and displayed in the Sent count label.
Every character or byte received is accumulated and displayed in the Received count
label.
Transmitting Data
Click on the send button to transmit the value in the transmit text box to the
device. Double-clicking a command in the Commands list view will place the command
in the Transmit text box and automatically send the command to the device. The
response from the device will appear in the Receive area text box. Each command
response will be appended to the end of the previously received data.
US Digital 1400 NE 136th Avenue Vancouver, Washington 98684 USA
Local: 360-260-2468 Toll-free: 800-736-0194 Support: 360-397-9999 Fax: 360-260-2469
Email: [email protected] Website: www.usdigital.com
11 of 20
COMTool User Guide
Version 1.1
12/02/2013
To continuously transmit the same command to the device, check the Auto Transmit
checkbox and then click the send button. Click the Auto Clear Received check box to
clear the Received textbox prior to sending the next command. To translate a specific
hex value returned from the device to an integer value, highlight the hex value to
translate. The Hex to Integer field will automatically be updated to reflect the integer
value. If reporting the absolute position of an A2 encoder, highlight the returned hex
position value and the Hex to Integer field will show the translated valued. With the hex
position values still highlighted, check the Auto Transmit checkbox and then click send.
The highlighted position values will remain highlighted and the Hex to Integer value will
automatically be updated on the return of a read position command. This feature makes
it easier to decipher the reported position value as the encoder position value changes.
To clear the Transmit or Receive area text boxes, click the clear button within the
respective area.
There are a couple options when it comes to copying the bytes received from the device
to the clipboard. The default format used to copy the received data to the Windows
clipboard is one byte at a time separated by a space and left in the hex format.
Highlight the data received using the mouse cursor and click the copy to clipboard
button. If the received data looks like the following, then the table below shows
examples for the clipboard content format.
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
The DCD indicator stands for Data Carrier Detect and is green when holding and red
when not holding.
The CTS indicator stands for Clear to Send and is green when the data communication
equipment is ready to accept data and the line is high and the indicator red when it is
low and not ready to receive data.
The DSR indicator stands for Data Set Ready and is green when the data
communication equipment is ready to receive commands or data and is red when not
ready.
The DTR indicator stands for Data Terminal Ready and is green when the presence of
DTE to DCE is detected and red when it is not connected.
The RTS indicator stand for Request to Send and is green when the DTE request the
DCE to prepare to receive data and red when no request is present.
Commands Tab
The Commands tab on the right half of the COMTool application is used to list a
predefined set of device commands that are stored in an MS Access database or .mdb
file. Each command contains a Description and Command field. The Description field
typically identifies the device and what the command does. The Command filed
contains the ASCII text or hex bytes that can be sent to a device. When the COMTool
application is first launched, the user may be prompted for the location of the
COMTool.mdb file. The typical path is C:\Program Files(x86)\US
Digital\COMTool\COMTool.mdb for 64 bits Windows and C:\Program Files\US
Digital\COMTool\COMTool.mdb for 32 bit systems.
To specify the location of the command database file, click on the open file button.
To save the device commands to a new database file, click on the save button.
The database file contains commands for multiple device types. To filter the
commands by device product, click on the Filter by Product checkbox, otherwise
commands for all products will be listed.
To add a command, enter the command description, press tab, enter the
command text and then press Enter key. The command will be saved to the
database using the selected Product.
To delete a command, click on the desired command row selector and then
press the Delete key. Multiple command rows may be selected and deleted.
Scripts Tab
The Scripts tab on the right half of the COMTool application is also used to read, edit,
delete, execute, and save commands. The check boxes in front of each command listed
allows multiple commands to be selected and executed in a sequence. The list view
provides additional status information for each command executed.
The commands can be read from a tab delimited file by clicking on the open button and
saved to a file by clicking on the save button.
Each command has the following fields: Description, Command, Expected Reply,
Pause, Count, Reply, Status, and Completed.
Description
Field Name Comment
Description Identifies the device and what the command does.
Command Contains the ASCII text or hex bytes that can be sent to a device.
Expected Reply Contains the ASCII text or hex bytes that are compared with the
response from the device.
Pause (ms) Identifies the number of milliseconds to wait before attempting to
read the command reply.
Count Identifies the number of times to send the command.
Reply Contains the last command received.
Status Displays “Unknown” until a command is sent. Displays “Passed”
or “Failed” when a command is sent and a reply is received and
compared with the expected reply.
Completed Contains the number of times the specified command was
successfully sent and the reply match the Expected Reply.
US Digital 1400 NE 136th Avenue Vancouver, Washington 98684 USA
Local: 360-260-2468 Toll-free: 800-736-0194 Support: 360-397-9999 Fax: 360-260-2469
Email: [email protected] Website: www.usdigital.com
16 of 20
COMTool User Guide
Version 1.1
12/02/2013
Enter a description for the command being added in the Description field. The
Command and Expected Reply fields are automatically filled in with the contents of the
Transmit and Received fields.
If the command being entered is something like the A2 Read Position command where
the first byte is always the same and the last two bytes can vary depending on the
encoder position, then the Expected Reply can be modified to match the expected
format. The A2 Read Position will reply with a “1F xx xx” value, where the “xx xx”
pattern represents the position returned. The following regular expression may be used
to match the pattern: ^1F [A-F0-9]{2} [A-F0-9]{2}$
To test the regular expression, enter a sample reply in the Test Reply field. If the match
is successful, then the Test Reply Matches Expected Reply field will display “True”
otherwise “False”. The Expected Reply and the Test Reply are constantly evaluated as
characters are typed into these fields.
To copy and paste the example regular expression in the Expected Reply textbox, click
on the Copy + Paste button.
To see more examples on how to use regular expressions, click on the More Help
button.
Enter the number of milliseconds to wait before reading the reply in the Pause Delay
(ms) field.
Enter the number of times the command is to be executed in the Count Field.
Click OK to accept the changes and add the command to the list view, otherwise click
Cancel to ignore the changes.
command button. The script file is used to identify the log file that is written to
when commands are executed. The results of each executed command are written to
the log file. The log file name is the same as the script file except the file extension is
renamed to .log.
When the script command button is pressed, the status and completed fields are reset
for each command that is checked for execution. As each command is executed, it is
copied to the Transmit field, the Receive field is cleared, the command is sent, and the
process then waits the Pause (in milliseconds) time before comparing the returned
results with the Expected Reply. If the comparison matches, then the Status field is
updated with “Passed” and the Completed field value is incremented by 1. If the
comparison does not match, then the Status field is updated with “Failed” and the next
selected command will be executed. The same command can be executed multiple
times, as long as the result from each comparison matches the Expected Reply.
Completed count shows the number of times the command was successfully executed.
The reply and comparison result of each executed command are written to a log file.
Sample script log file:
8/16/2012 10:19:49 AM Sent = F2 01Received = F2 01 F3 Passed = True Completed= 1
8/16/2012 10:19:49 AM Sent = 22 Received = 22 00 00 00 Passed = True Completed= 1
8/16/2012 10:19:50 AM Sent = F2 0D 08 Received = F2 0D 08 F7 Passed = True Completed= 1
8/16/2012 10:19:50 AM Sent = 1F Received = 1F 00 00 Passed = True Completed= 1
8/16/2012 10:19:50 AM Sent = 1F Received = 1F 00 00 Passed = True Completed= 2
8/16/2012 10:19:50 AM Sent = 1F Received = 1F 00 00 Passed = True Completed= 3