Print Friendly and PDF

Using VISA-based RS232 communication with Codesys program for Compax3

[Meant to post on Electromechanical - Industrial support forum, but there was no option to do so]

For a project involving a Compax3 motor system, I am working on both a Codesys control program (which takes I0-I7 inputs to execute different movements) as well as a Python script using PyVISA (with pyvisa-py as the backend, since I had issues using ni-visa) to send/receive communications to/from Compax3 (after it had downloaded the Codesys program) via RS232 to both get and change the current input, output, and recipe array table values.

While both the Codesys program and Python script are not fully debugged, a simple test shows them not working in tandem as expected:

- Codesys program is linked and downloaded to Compax3 in Windows machine

- Codesys program is tested in Compax3. Changing inputs in optimization window affects motor activity (ex: setting I3 to 1 turns on the motor).

- Ubuntu VM is opened and script is run in terminal. Compax3 device is properly detected and writing/reading I0-I6 shows that values are accurately and durably changed, even when VM is rebooted.

- Writing new values to I0-I6 inputs does not affect motor activity at all, unlike earlier tests in the Compax3 optimization window.

Why does this (not) happen? Is this a VM issue, a programming issue, or can alternate forms of RS232 communication besides the optimization window in Compax3 itself not be used in conjunction with Codesys programs (which Compax3 calls IEC 61131-3 programs) for some reason?

This involves a few disparate programs and libraries, so let me know if there is a better internet forum to post this on.