reading data from a scale connected to a serial port


Thread Starter

John Craighead

How does one send data to a serial port and then record the response made by the scale attached to the serial port. The command that I want to send to the scale is composed of 3 hexadecial characters: 02 87 and 13. The scale will then respond with a string of hex characters that include the weight. Can this be done from the "command" prompt or in a batch file on a Windows98 system?
Typically you would use some program with or using a serial port driver. I've never tried to go directly to the port using a batch file, but it might be possible to put those three characters in a file and use:

copy scancmd.txt com1:
copy com1: scanrslt.txt

assuming you have set up your com1 port with
mode com1: ....

and the result comes back with a carriage return terminator.


Rufus V. Smith
Software (esp. Automation) Generalist
Recently Unemployed and available
Contact at: [email protected]
Use HyperTerminal. It is under "Start" -> "Programs" -> "Accessories" -> "HyperTerminal". Select the appropriate COM port and properties. This is in the manual, but for balances it is typically 9600, 1, None, 8, None (following the properties top to bottom). Type in "02 87 13" and hit enter. If the balance is configured correctly, you should receive a response back. Note that you will not see what you are typing on the screen. If that is bothersome, go to "File" -> "Properties". Click on the "Settings" tab. Click on "ASCII Setup", and select "Type local characters locally" and "Append Line Feeds to incoming line ends".

This is just a quick instruction set on how to use Hyperterminal. If you want to automate the process, look on the internet for other "Terminal" programs. Also, you might look into Visual Basic. Also, check out tutorials on how to use Hyperterminal.
I have a demo of a DDE server for MT scales. I think it runs for one hour which will let you evaluate it. It can be used by any DDE client eg Excel or InTouch. Let me know if you want me to send you it. [email protected].
I'm sure the message was the ascii values of the characters to be sent. Rather than typing in "02 87 13" you need to type the three characters:
control-b, W, enter


Rufus V. Smith
Software (esp. Automation) Generalist Programmer
Recently Unemployed and available
Contact at: [email protected]

Brian Thurman

Try using label com I have a client with the same issue, A larger scale has parts on it, a smaller scale is connected via serial with sample parts, the piece count determined by weight and sent to the software via serial it also allows you to assign numbers to particular jobs for that weight if you need. the data can be captured to bar codes databases etc. you can also reference external data gathering to be included when a particular weight or number is referenced via the scale.

Brian Thurman
USB Systems
I belive you can use a very small program in Visiual basic and use the com activeX component it is very easy just try it.
What you need is to write a string containing the three ASCII charecters to the output buffer of the com port then wait and read the content of the input buffer. normaly you need to display what you read in a text box for example. you can store the read data in a text file and add date information to it to be used as a log or so.
to intiate the reading process you can use one of the following techniques:
1- read once when the program is intialized.
2- read once in a responce to clicking a command button.
3- read many according to a timer control event.

the output can be displayed in a textbox control or somthing like this, or saved to a text file in apending mode after adding date and time and any usefull information or you can write to a database table.

if you need help please contact me (rassem(AT)

Bruce Durdle

This does not help much. One of the problems is that, to a process operator, the normal or unfaulted condition (green) is dangerous to an electrician working on it (red). This difference in viewpoint is one of the most common pooints of difference I have come across - in an MCC room, a green lamp means that the equipment is de-energised and safe to work on, while the same information on an operator screen is usually indicated by a red symbol indicating a faulted or unavailable system.

Do you still need assistance getting scale data? I would suggest an out of process control such as an ActiveX.EXE server. You make a reference to the control in your application, set a few properties, and either read properties or handle events generated by the control. It can be set up to continuously request and/or read scale data without any intervention from the main application, or the application can handle the controlling of requesting and reading data.

Hope this helps.