B.6.2 example 2: cr10x to cr10x communication – Campbell Scientific CR10X Measurement and Control System User Manual
Page 246

APPENDIX B. CONTROL PORT SERIAL I/O INSTRUCTION 15
B-14
B.6.2 EXAMPLE 2: CR10X TO CR10X
COMMUNICATION
The following example shows how data can be
sent between CR10X's. The program for the
CR10X sending the data, CR10X#1, includes a
loop which creates data to send; the numbers
are generated and stored in Input Locations 1
through 10. Instruction 15 then transfers the
contents of Locations 1 through 10 to
CR10X#2. Instruction 15 in CR10X#2 receives
and stores the values in Input Locations 11
through 20.
As shown in Figure 2, the RTS/DTR from #1 is
connected to control port 8 of CR10X#2.
RS-232 logic is used so RTS/DTR is +5V when
asserted. The RTS/DTR going high is
connected to port 8 of CR10X#2, causing
subroutine 98 to be executed (refer to CR10X
manual, Instruction 85, Section 12). Subroutine
98 contains Instruction 15, programmed to
receive input. CR10X#2's RTS/DTR is
connected to CR10X#1's CTS. When
CR10X#2 executes Instruction 15, the
RTS/DTR going high signals CR10X#1 to send
data.
CR10X#1
CR10X#2
SEND DATA
RECEIVE DATA
FUNCTION PORT PORT FUNCTION
RTS/DTR
C6 ----------->C8
Interrupt; SBR 98
CTS
C7<----------- C6
RTS/DTR
TX
C8 ----------->C7
RX
FIGURE B-2. Wiring Diagram for CR10X to CR10X Communication Example
CR10X#1 PROGRAM - SEND DATA
*
1
Table 1 Programs
01:
5
Sec. Execution Interval
01:
P87
Beginning of Loop
Start loop to generate values
01:
0
Delay
02:
10
Loop Count
02:
P32
Z=Z+1
01:
11
Z Loc [:COUNTER ]
03:
P31
Z=X
01:
11
X Loc COUNTER
02:
1--
Z Loc [:VALUE #1 ]
04:
P95
End
End Loop to generate
values
05:
P15
Control Port Serial I/O
01:
1
Repetitions
02:
1
Configuration code
RS-232, 1200 bd
03:
0
CTS/Delay before send
04:
6
C6 RTS/DTR
TX = C8 (code could be = 86)
05:
1
Output start location
06:
10--
Number of locations to send
Start at Loc 10 and (--) convert
07:
0
Input termination character
08:
0
Max characters to receive
09:
100
Delay for CTS/input
wait 1 sec for CTS to go high
10:
28
First input location
If 1 sec delay expires
before CTS goes high,
store -99999 in Loc 28