Delta Electronics DOP-AS Series Network Card User Manual


 
Chapter 4 Macro Function|ScrEdit Software User Manual
Revision Apr. 30th, 2007, 2007PDD23000002 4-37
$0 = CHRCHKSUM("24", $10, 2)
After the above operation, 4 is stored in $0 and 4 represents the data length is 2 WORDS. The
checksum stored in $10 is 66H.
Communication Macro Example
This communication macro example can be downloaded via the following link:
http://59.120.64.39:81/phpbb2/files/comm_marco.dop
This example shows that the user can use communication macro to control the output points of Delta
DVP PLC and set SV value of DTB temperature controller to 20
o
C.
PLC
Set ON/OFF macro on Y0 button.
The communication commands which can trigger Y0 are listed as follows:
ASCII : 0 1 0 5 0 5 0 0 F F 0 0 F 6 \r \n
HEX 3A 30 31 30 35 30 35 30 30 46 46 30 30 46 36 0D 0A
ON Macro
$0 = INITCOM(0, 0, 0, 2, 0, 6, 0) Set communication setting as COM1,RS232,9600,7,E,1
SELECTCOM(0) Select COM1 port.
CHR($11, "01050500FF00F6") Convert the string of commands to ASCII code and store
data from $11.
$10 = 3A00H Set starting Bit. Because the value of high byte and low
byte will be exchanged when HMI sends command, even
though the starting Bit is 3A when sending data, it is
needed to input 3A00.
$18 = 0A0DH Set end Bit. Because the value of high byte and low byte
will be exchanged when HMI sends command, even
though the end Bit is 0D0A when sending data, it is
needed to input 0A0D.
$50 = PUTCHARS($10, 18, 500) Start to send data from $10, the data length is 18 bytes
and the timeout setting is 500ms.
$51 = GETCHARS($100, 18, 500) Receive the PLC response data after communication. The
received data is stored in $100, the data length is 18 bytes
and the timeout setting is 500ms.
The communication commands which can reset Y0 are listed as follows:
ASCII : 0 1 0 5 0 5 0 0 0 0 0 0 F 5 \r \n
HEX 3A 30 31 30 35 30 35 30 30 40 40 30 30 46 35 0D 0A
OFF Macro
$0 = INITCOM(0, 0, 0, 2, 0, 6, 0) Set communication setting as COM1,RS232,9600,7,E,1
SELECTCOM(0) Select COM1port.
CHR($21, "010505000000F5") Convert the string of commands to ASCII code and store
data from $21.