Description
UNITROL 1010 3BHE035301R1002 UNS 0121A-Z,V1 UN1010-0001 Communication Subroutine
The UNITROL 1010 3BHE035301R1002 UNS 0121A-Z,V1 UN1010-0001 communication subroutine is responsible for communicating with the host computer and transmitting the fault data stored in the data area to the host computer in batches via the serial port. Every time the host computer sends a transmission command (represented by the integer 255), the PLC determines whether the received character is a transmission command in the receive interrupt procedure, and if it is, it sets the transmission command flag M6.0 and calls the communication subroutine in the main procedure.
UNITROL 1010 3BHE035301R1002 UNS 0121A-Z,V1 UN1010-0001 Define the pointer tran_pointer to point to the first address of the data to be transmitted, and its initial value is &VW4000, which is the first address of the data area. Define the variable count to record the number of transmissions. In the communication subroutine, firstly, the reception of the free port is stopped, and then the data of 200 bytes with the pointer tran_pointer as the first address is transferred to the send buffer, and then it is sent out through the serial port with the send command.
UNITROL 1010 3BHE035301R1002 UNS 0121A-Z,V1 UN1010-0001 Every time the data is sent, the pointer tran_pointer is moved downward by 200 bytes, the value of variable count is added by 1, and M6.0 is reset. When the host computer sends out the 26th transmission command, the 5000 bytes of the data area VW4000 ~ VW8998 in the PLC have been sent out, and then the rated voltage, rated current, rated active power, rated reactive power, and the pointer index are sent out, the count value is cleared to zero, and the pointer tran_pointer is re-initialised, and the M6.0 is reset. At this point, a complete fault data transmission process is over.