B4J Question Strange issue with serial port

MAGAREY

Member
Licensed User
Longtime User
Hi everyone , i have a a program that connect with a scales weight, i have no problem doing the conexion, the problem is when the scale is off, but conected , the serial recognize the port but when i try to connect with it and send the comand to obtain the weight i have to posible respons:

1.- the port is busy
2.- waits for ever the response of scales

I tried to catch the error with try and catch but didnt work out.
Also tried to purge the serial conection and tried to close an re-open the conection whitout succes.
Any ideas to be able to recognize if the scales weight its on or off ?
thanks in advance.
 

Derek Johnson

Active Member
Licensed User
Longtime User
Can you check the CTS (Clear To Send) or DTR (Data Terminal Ready) conditions on the RS232 interface before sending a command? Most devices set one or the other when they are turned on.

J Serial

Property_501.png
CTS As Boolean [read only]

Property_501.png
DSR As Boolean [read only]

Property_501.png
DTR As Boolean [write only]


Even if you can't do this, you could set a timer when you try to use the device and display a message to the user if there is no response within a given time.

Derek
 
Last edited:
Upvote 0
Top