Welcome! Log In Create A New Profile

Advanced

Serial port

Posted by aelfassi 
Serial port
August 14, 2019 10:23PM
Hi Everyone;

Is it possible to detect a device if it is connected to serial port COMx such as a scale?

Thanks
Re: Serial port
August 15, 2019 06:54AM
Hi, no. You have to start communication with the device in order to see whether it is functional or not. You know, you need to know a few parameters (speed etc.), the serial port of your PC has to be initialized with the parameters fitting the scale. Then you could initiate communication to get the status of the scale.

Kind regards,
Guenter Predl
office@windev.at
Re: Serial port
August 15, 2019 11:44AM
Hi,
Thanks for your answer, I have a good experience with serial ports but I am looking for a way to check which COMx is used by the scale, I don't want the user to change the com port everytime the com port changes.what I want is if the com port changes I could detect it automatically in my App.

Regards.
tbh
Re: Serial port
August 16, 2019 09:42PM
Hi

Think what you are thinking about is how to detect change of "virtual comport" if the user is pushing the USB cable of their RS232/Serial converter cable into another USB PORT as a physical comport never change. (COM1 will always be COM1 if installed) - Or if the user drops the cable into a fitting plug somewhere?

There is a small call in WinDev to read all active comports on your system, but how do you know it`s a scale and not a barcode reader? - For this you need to identify the scale with the communication protocol. (as Gunther sort of hints to you)

If you scale is from METTLER TOLEDO and you are running SICS protocol on the scale, you can query the COM port with the I0<CR><lf> command.

This will give you the serial number of the scale (or S to ask the scale to send the weight = No answer there`s no scale (or the scale setup is wrong))

Just being able to open the port do not prove you have a scale on you system connected to that port. smiling smiley

Need to say I work in METTLER TOLEDO and do make software for our scales - Also ... why do you not get a Tcp/Ip connection to the scale? then you worries will bee over - RS232 is sort of 1980 smiling smiley

Cheers
Tor-Bjarne



Edited 1 time(s). Last edit at 08/16/2019 09:47PM by tbh.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: