Thank you for your responses.
I’m (trying) to do machine control and have been a long time user of Ignition. Ignition runs on a separate server, and I have an Groove-Epic-PR1 PLC and I’m using the USB port with an RS-422 converter to try to communicate with the machine modules.
The machine is older and has Opto-22 Quad control modules with various brain boards. I have updated the brain boards and have all of the I/O control working with a new Ignition HMI via ModBus…I saved the more difficult for last with communication to proprietary modules that control servo valves and other machine functions.
I can send strings of ASCII data via the Transmit String command and see the machine module receive it…but eventually fault due to receiving bad data.
My data packet that I’m trying to send consists of 10 8-bit bytes, both of hex and numeric (not ASCII) data. I’ve declared a string (PBlock) with a length of 10.
The data packet that I’m trying to send follows;
// Module to initialize PowerBlock Array
Pblock[0] = 1; // Set for the address to be only one module
Pblock[0] = Pblock[0] bitor 0xC0; // Clear Fault Xmit to Host
Pblock[1] = 10; // 10 amps for current
Pblock[1] = Pblock[1] bitor 0x80; // 0 signifies Positive polarity
Pblock[2] = 100; // Volts
Pblock[3] = 20; // On Time 20 usec (Default)
Pblock[4] = 60; // Off Time 60 usec (Default)
Pblock[5] = 100; // Servo Reference
Pblock[6] = 0;
Pblock[6] = Pblock[6] bitor 0xF0; // Cap Mode SAM Set + 3.3uf Cap
Pblock[7] = 100; // Servo Gain (Default)
//Calculate Checksum for 8th element of array
Pblock[8] = 0;
Pblock[8] = XOR_Value bitxor Pblock[0];
Pblock[8] = XOR_Value bitxor Pblock[1];
Pblock[8] = XOR_Value bitxor Pblock[2];
Pblock[8] = XOR_Value bitxor Pblock[3];
Pblock[8] = XOR_Value bitxor Pblock[4];
Pblock[8] = XOR_Value bitxor Pblock[5];
Pblock[8] = XOR_Value bitxor Pblock[6];
Pblock[8] = XOR_Value bitxor Pblock[7];
// Ones Compliment for 9th element of array
Pblock[9] = bitnot Pblock[8];
As you can see I have to do some bit manipulation of the variables, the bit manipulation is to set certain (bits) required for the control…but it is still hex data.
Everything compiles, but when I run the program…Transmit String does not send anything…and within the documentation states that if the string that Transmit String is trying to send is empty, Transmit String will not send anything…
This is the actual view of the control that I’m trying to use…note that if I un comment out the last line and just send a string on “aBCDEFGH” we get Transmit String to send data…and the modules verify receipt of data…and fault
A couple of questions;
-
I’m trying to use a 8-bit byte array or structure is there anything else other than a string that I could use in OptoScript?
-
Next is what commands are there for sending a data packet made up of 8-bit bytes?
I really appreciate your help