I was wondering if anyone has been successful in creating a button in Ignition that can send a Tare or a Zero command to a scale head. Specifically, I am using the PS_IN202 scale head. I’ve tried Googling but haven’t found anything helpful. If it is possible, would you mind providing a little snippet of the code. Thanks in advance.
Are you connecting the scale directly to the Ignition gateway using the serial modules, or using a serial -> ethernet converter and the TCP driver?
Based on this document it looks like you just need to send a CRLF terminated sequence with the correct characters, which you should be able to do with either driver.
Yes, I am using the serial modules. I had found that same document but I guess it isn’t making sense to me. Do you know what script I would use to send that CRLF command?
First, configure the serial port: https://docs.inductiveautomation.com/display/DOC79/system.serial.configureSerialPort
Then open it to write: https://docs.inductiveautomation.com/display/DOC79/system.serial.openSerialPort
Then, write to it: https://docs.inductiveautomation.com/display/DOC79/system.serial.write
Assuming the previously linked document is accurate,
system.serial.write("COM<whatever>", "ST\r\n") (or
"SZ\r\n", for Scale Tare / Scale Zero, I’m assuming) should send the appropriate bytes.
Thank you, sir. I changed it to serial.writeString(“ST\r\n”) and it worked perfectly.