Description
SCXI-1326 Data Handling Procedures
SCXI-1326 is designed with two forms (Form1 and Form2). Form1 is the main interface and Form2 is the waveform display interface. An MSComm control, a timer control (Timer1) and two button controls (Command1 and Command2) are designed in Form1. Command1 is the start button, i.e. when pressed, it starts to communicate with PLC and read the data therein, Command2 is the display button, i.e. when pressed, it calls Form2 and displays the waveform curves of each running quantity.
The SCXI-1326 sets the Interval property of Timer1 equal to 500, the InputMode property of MSComm is binary, and the RThreshold property is equal to 5010. The timer sends the transmission command every 500 milliseconds, and when it sends the command for the 26th time, it turns off the timer, and then the receive buffer receives 5010 bytes of data and triggers the MSComm’s data. of data and trigger the OnComm event of MSComm. A picture box control (Picture1) is designed in Form2 to display graphics.
In the OnComm event subroutine, the SCXI-1326 assigns the data in the receive buffer to the global arrays U_data, If_data, P_data, Q_data, and Ug_data in turn, and then calculates the percentage value based on the rated value of each run. The first 350 bytes of each array need to be adjusted according to the pointer Index by moving the data in the array subscript range Index to 349 to the front and the data in the subscript range 1 to Index-1 to the back.