Active4 years, 11 months ago
- Send Commands To Serial Port Linux
- How To Send Serial Commands
- Send Command To Serial Port C#
- Send Commands To Serial Port
We have a OHAUAS defender 5000 series model T51P Weighting scales with a COM port. Ab initio software download. if we connect this to a PC we should be able to get the weight on the computer by sending a command to it.
Is there a way to test this? i tried the command line echo 'LP' > com1 but this does nothing. A small C# application that listens to this port seems to be continuously receive Hexadecimal numbers (2 digits then an enter), however sending a command through this application doesn't give readable results.
Sending simple serial commands to an Arduino is the easiest way to communicate between an Arduino and a computer. The computer could be a PC, a Raspberry Pi, or any device that communicates with serial. By sending and “decoding” a single character it is easy to add a simple debug menu or even serial menu. Sending Commands to Your Arduino From Your Computer This is a very basic tutorial to teach you how to send commands from your computer directly to your Arduino board. Keep in mind, this is a very basic code, but hopefully it will provide you a leg up if you want to try some more complicated things.
When i do listen on the port though, the echo 'LP' > com1 command gives an unavaible error, so sending the command works in cmd.
Does anyone have any knowledge on a simple way to test a send and receive on a com port?
EDIT:
How to send commands to the serial port? - posted in Ask for Help: Hi, I need to send commands to the serial port to configure some device connected to it. How do I do this? Which command to use? On Linux, I want to send a command string (i.e. Some data) to a serial port (containing control characters), and listen to the response (which also usually might contain control characters).
Model is OHAUAS defender 5000 series - T51P Telecharger ptedit windows 10.
Using Hyper terminal gives me the below result. the same happens with arduino, and sending the 'P' command gives no data back.
edit2:
I have found that the 'print button' on the scales has the same functionality as the 'P' command. If i push the button i get 'random data' if i use a text mode on an application, this data translates into question marks and parts of the weight. i pushed the button 6 times in succesion, getting results like ?????????? or 2??????? or ???.04???A? or ??????????KG these results combined show me that it tries sending 2.04KG, the weight. Now would there be a logical reason why only part of this data is sent(or received)?
Andy
AndyAndy17311 gold badge22 silver badges1010 bronze badges
4 Answers
You can download this for your platform and open the application and go to tools serial monitor. that will listen to the configured serial port. (You do not need an arduino for it to work.)
From their website:
Q: How do I use Hyperterminal to check communications?
A: Hyper Terminal is a Terminal program that is bundled with Windows.
Send Commands To Serial Port Linux
To set up Hyper Terminal for use with an Ohaus balance, perform the following steps. The following assumptions are made for the purpose of explanation.1. The computer uses Com12. The Balance Baud Rate is set to 24003. The Balance Data Bits are set to 74. The Balance Stop Bits are set to 25. The Balance Parity Bit is set to None6. Handshaking in the balance is turned off
Open the program and enter a name for the connection. You will probably want to save the setup for future use.Press OKIn the next screen click on the twirl down for the 'Connect using' box and select the COM port your computer uses.
Click OK and the COMx properties box will be displayed. (Which COM port appears will depend on the setting in the previous step.)
Set the parameters to match the parameters in the balance. See the instruction manual for the balance. The usual defaults are 2400 baud, 7 data bits, no parity, 2 stop bits and no handshake. When finished press apply then press OK.
The terminal screen will be displayed.
Select CALL from the menu bar and select Disconnect. The 'Connected' at the bottom left of the screen will change to 'Disconnected'.
Select FILE from the menu bar and select Properties.
Select the Settings tab.
Check Windows Keys and Del.
At the bottom of the box click on ASCII Setup.
Check the first two boxes and put 11 in the next 2.
Click Ok twice.
From the Call menu select Call.
'Call' will be displayed at the lower left of the terminal screen.
You are now ready to communicate with the balance. The best way to test the connection is to press print on the balance. Other commands are listed in the instruction manual for the balance.
![Commands Commands](/uploads/1/2/5/0/125056908/691506795.jpg)
And some additional info from that site:
How can I get my Defender 5000 indicator (T51P or T51XW) to print without inserting an extra line feed? I am using a label printer with preprinted labels and every other label is wasted.A: You can do this by going into the menu under Print1 or Print2 and setting the format to Single.Q: Ok now I am printing a single label but there is too much information. I am still using a T51P.A: Again go into the Print1 or Print 2 menu. You can turn off all the heading and GLP information you need too. You can also turn off the Gross, Net and Tare printing and just leave the result. You also have the option to print the result as a number only by setting it to NUM. This will eliminate the unit of measure.Q: I am using a 7000 series Defender indicator (T17P) and I can not clear the accumulator. I have followed the instructions in the manual but it does not clear.A: Press and hold the 'info' button until the display shows 'StatS'. Then press the 'CLR' button to clear the accumulator.
taken from: http://us.ohaus.com/us/en/home/support/faq.aspx#S16
d4v3y0rkd4v3y0rk1,18711 gold badge77 silver badges1111 bronze badges
Verify that you have the right serial port settings configured.
I recently made an application to read the weight value from a
G-ManOHAUS Defender 3000
, and these are the right parameters:6,3811111 gold badges2727 silver badges6565 bronze badges
SomebodySomebody
A practical way of testing
You may also send commands from
com
ports is to use terminal emulator
. You may use any of many available ones (putty
and TeraTerm
are widely used). You will need to set it to use serial connection, then set connection params: com
number; speed (baudrate), parity, databits, stop bits - those must match your device setup (you need to get this information from manual). When connected, you will be able to enter commands and see device output.You may also send commands from
cmd
, but you will not see a response (in cmd window, of course device may/should react somehow to it), and you also need to make sure that baud/data/parity/stop (as minimum) are set properly - this is done via mode
command. To reiterate: serial parameters (speed, databits, parity, stop, possibly handshake) must be the same on both ends (scale and PC) otherwise they will 'not understand' each other
wmzwmz6,02211 gold badge1313 silver badges2828 bronze badges
There is a manual available online. (In general, googling for 'xyzzy manual' where xyzzy Ohio state softball players. is the model number is a good way to find a product manual.) It documents the command line and the data the scale provides. It also explains how to configure the devices COM port. You'll want to use settings that match the communications settings for your terminal program.
Isaac RabinovitchIsaac Rabinovitch
Not the answer you're looking for? Browse other questions tagged command-lineserial-portcom or ask your own question.
-->This topic describes how to use
My.Computer.Ports
to send strings to the computer's serial ports in Visual Basic.Example
This example sends a string to the COM1 serial port. You may need to use a different serial port on your computer.
Use the
My.Computer.Ports.OpenSerialPort
method to obtain a reference to the port. For more information, see OpenSerialPort.The
Using
block allows the application to close the serial port even if it generates an exception. All code that manipulates the serial port should appear within this block or within a Try..Catch..Finally
block.The WriteLine method sends the data to the serial port.
How To Send Serial Commands
Compiling the Code
- This example assumes the computer is using
COM1
.
Robust Programming
This example assumes the computer is using
COM1
; for more flexibility, the code should allow the user to select the desired serial port from a list of available ports. For more information, see How to: Show Available Serial Ports.Send Command To Serial Port C#
This example uses a
Using
block to make sure that the application closes the port even if it throws an exception. For more information, see Using Statement.