This Project file is far from complete. It can be used as a starting point for others. I have some questions below. My goal is to write a Ignition Client so a User can plug their laptop into a Mettler Toledo XS lab scale using an USB to Serial converter. There's a Reset Scale button that sends a "@" to reset the Scale. Also a Weight Button to send a "SIR" to make the scale report its weight continuously.
I did not know how to make Ignition event driven based on new data at Serial Port. With Rockwell PLC instructions I can test the Serial buffer for CR, then Read the entire buffer including the CR. Is there a similar Serial Buffer Test in Ignition or in the Instrument Interface? So I had to use a Timer script, the 1-10ms interval appears to work.The Timer script uses a readUntil('\r',0,100) to read until the CR that the SerialTest (2018-02-09)Timer Script.proj (17.7 KB)
At least this project handles Opening, Closing of Serial Port and a few buttons to handle Resetting Scale or making it Report its weight Continuously.
I need to figure out the console exceptions it throws below based if data is not at Serial port it will throw the following
Caused by: java.lang.Exception: Exception encountered while reading from serial port: Delimiter not matched before timeout/EOS.
_ at com.sepasoft.parse.components.PMISerialController.readUntil(PMISerialController.java:634)_
_ at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)_
_ at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)_
_ at java.lang.reflect.Method.invoke(Unknown Source)_
_ at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:186)_
... 14 common frames omitted
I could live with the Above Exception on the console. I need to write some other code to check for Serial Port is Open or Closed before I try to write out of that port.