Delta Electronics DOP-A Series Network Card User Manual


 
Chapter 4 Macro Function|ScrEdit Software User Manual
4-36 Revision Apr. 30th, 2007, 2007PDD23000002
GETCHARS
GETCHARS Get characters by COM port.
V1= GETCHARS (V2, V3, V4). V1 is the response value after communication. If the communication
has succeeded, the result will be stored in $1. If the communication has failed, the result will be stored
in $0. V2 is the starting address of transmission data, V3 is data length, and V4 is the maximum
allowable communication time and its unit is ms.
SELECTCOM
SELECTCOM It is used to select COM port. 0 represents COM1, and 1 represents COM2.
When using communication macro, the designated COM port cannot be the same as the system COM
port which has used. All communication commands will be processed via the COM port the user selects
after executing this command. Therefore, different macros will not support each other and there will be
no interference between different macros.
CLEARCOMBUFFER
Clear COM port buffer.
Equation: CLEARCOMBUFFER(V1, V2)
V1 is the number of communication port. It represents as constant 0(COM1) or 1(COM2).
V2 is the type of buffer area. It represents as constant 0 (receiving buffer area) or 1(sending buffer area)
Example:
Clear receiving buffer area of COM2
CLEARCOMBUFFER(1, 0)
CHRCHKSUM
Calculate the data length of texts or characters and checksum.
Equation: V1 = CHRCHKSUM(V2, V3, V4)
V1 is the internal memory address where stores the text length of V2.
V2 is the string of text.
V3 is the internal memory address where stores the checksum of V2.
V4 is the data length of the checksum that stores in V3. 1 represents Byte and 2 represents Word.
Operation of checksum:
Convert each word of the string of text to ASCII code and add up them. For example, convert ’2’ to
ASCII code ‘31H’, convert ’4’ to ASCII code ‘34H’ and vise versa. Therefore, the checksum of ‘A’ and ‘C’
is 41H + 43H = 84H.
Example:
Calculate the data length of "24" and checksum