
B-63944EN/02 PROGRAMMING 16.CUSTOM MACRO
- 377 -
Example
Structure of DI
2
15
2
14
2
13
2
12
2
11
2
10
2
9
2
8
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
Used for other
purposes
Sign 10
2
10
1
10
0
Structure of DO
2
8
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
Not used Used for other purposes Address
<1> Address switching signed BCD 3 digits are read.
Macro calling instruction
G65 P9100 D (address);
A custom macro body is created as follows.
O9100 ;
#1132 = #1132 AND 496 OR#7 ; : Address sending
G65 P9101 T60 ; : Timer macro
#100 = BIN[#1032 AND 4095] ; : BCD 3 digits are read.
IF [#1012 EQ 0] GOTO 9100 ; : A sign is attached.
#100 = -#100
N9100 M99
<2> Eight types of address switching signed BCD 6 digits (3-digit
integer part + 3-digit fractional part) are read into #101.
Structure on the machine side
When DO 2
0
= 0: Data with 3 decimal places
When DO 2
0
= 1: Data with 3-digit integer part
When DO 2
3
to 2
1
= 000: No1 data when #1 = 0
When DO 2
3
to 2
1
= 001: No2 data when #2 = 0
:
When DO 2
3
to 2
1
= 111: No8 data when #8 = 0
Macro calling instruction
G65 P9101 D (data number);
A custom macro body is created as follows.
O9101 ;
G65 P9101 D[#1*2+1] ;
#101 = #100 ;
G65 P9100 D[#1*2] ;
#101 = #101 + #100/1000 ;
M99 ;