Delta Tau GEO BRICK LV User Manual

Page of 271
Geo Brick LV User Manual
 
MACRO Connectivity 
 238 
Slave Digital I/Os Transfer Example 
I6841=I6841|$000004 
 
; Make sure that I/O node 2 is active 
 
// Digital Outputs 
#define OutByte1 
M7000  ; 1st Byte of Outputs J6 
#define OutByte2 
M7001  ; 2nd Byte of Outputs J7 
OutByte1->Y:$078802,0,8,U 
 
 
OutByte2->Y:$078805,0,8,U 
 
 
 
 
 
// Digital Inputs 
#define InByte1 
M7003  ; 1st Byte of Inputs 
#define InByte2 
M7004  ; 2nd Byte of Inputs 
#define InByte3 
M7005  ; 3rd Byte of Inputs 
#define InByte4 
M7006  ; 4th Byte of Inputs 
InByte1->Y:$078800,0,8,U 
InByte2->Y:$078801,0,8,U 
InByte3->Y:$078803,0,8,U 
InByte4->Y:$078804,0,8,U 
 
// Digital Inputs/Outputs Latch Registers 
M7009..7013->* 
M7009..7013=0 
#define LatchOut 
M7009 
#define LatchIn1 
M7010 
#define LatchIn2 
M7011 
#define LatchIn3 
M7012 
#define LatchIn4 
M7013 
 
// MACRO I/O Node Registers 
#define N2Twenty4 
M7016  ; 24-bit register, node 2 
#define N2First16 
M7017  ; 1st 16-bit register, node 2 
#define N2Second16 
M7018  ; 2nd 16-bit register, node 2 
N2Twenty4->X:$78420,0,24,U 
N2First16->X:$78421,8,16,U 
N2Second16->X:$78422,8,16,U 
 
// Digital I/O Data Transfer PLC  
Open plc 1 clear 
If (LatchOut!=N2Twenty4) 
 
; Change in state? 
 LatchOut=N2Twenty4 
 
 
; Latch data 
 OutByte1= LatchOut&$0000FF 
 
; Update Outputs 1-8,   J6 
 OutByte2=(LatchOut&$00FF00)/256 
; Update Outputs 9-15,  J7 
EndIf 
 
If (LatchIn1!=InByte1 Or LatchIn2!=InByte2 Or LatchIn3!=InByte3 Or LatchIn4!=InByte4) 
 LatchIn1=InByte1 
 
; Latch data 
 LatchIn2=InByte2 
 
; Latch data 
 LatchIn3=InByte3 
 
; Latch data 
 LatchIn4=InByte4 
 
; Latch data 
 N2First16= LatchIn1+LatchIn2*256 
; Assemble Input bytes 1-2 in 1st 16-bit register node 2 
 N2Second16=LatchIn3+LatchIn4*256 
; Assemble Input bytes 3-4 in 2nd 16-bit register node 2 
EndIf 
Close