ACC-72EX User Manual
Software setup
86
This example demonstrates a 16-bit integer register transfer. Notice that only the first 16-bit portion of the
integer in P200 will be transferred.
CLOSE
END GAT
DEL GAT
#include "M-VariableDefinition_$6C000.pmc"
#include "M-VariableDefinition_$74000.pmc"
#define Master_OutputData1
M2000
#define Master_InputData1
M2001
#define Slave_OutputData1
M2002
#define Slave_InputData1
M2003
Master_OutputData1->Y:$6C4C0,0,16,S
// Pointer to byte 0 and 1 of Output Data Image
// of Communication Channel 0 on Master COMX module
Master_InputData1->Y:$6CA60,0,16,S
// Pointer to byte 0 and 1 of Input Data Image
// of Communication Channel 0 on Master COMX module
Slave_OutputData1->Y:$744C0,0,16,S
// Pointer to byte 0 and 1 of Output Data Image
// of Communication Channel 0 on Slave COMX module
Slave_InputData1->Y:$74A60,0,16,S
// Pointer to byte 0 and 1 of Input Data Image
// of Communication Channel 0 on Slave COMX module
P200=0
OPEN PLC 10 CLEAR
IF (HCCC0_HCF_PD0_OUT_CMD = HCCC0_NCF_PD0_OUT_ACK) // Making sure the ACK flag matches the CMD
// flag before writing the value to the
// output data image register
P200=P200+1
Master_OutputData1 = P200
// Copy the value to register
HCCC0_HCF_PD0_OUT_CMD = HCCC0_HCF_PD0_OUT_CMD^1
// Toggle the CMD flag (^: XOR)
ENDIF
CLOSE
In a similar approach the data can be read from an input data image:
OPEN PLC 11 CLEAR
IF (HCCC0_NCF_PD0_IN_CMD = HCCC0_HCF_PD0_IN_ACK)
// If CMD flag and ACK flags are
// equal, then the input data image
// register can be read
P201=M2003
// read the input data image register
HCCC0_HCF_PD0_IN_ACK = HCCC0_HCF_PD0_IN_ACK ^ 1
// toggle the acknowledge bit
// indicating read completion
EndIF
CLOSE
Notice that depending on M-Variable definition, different types of data formats can be transferred over
the DPR and network:
Mxx->X/Y:$[address],[start],[width],[format]
// Short Word M-Variable Definition
// access to 1, 4, 8, 16 bits of data
// is possible
Mxx->DP:$[address]
// Dual-Ported RAM Fixed-Point M-Variable Definition
Mxx->F:$[address]
// Dual-Ported RAM Floating-Point M-Variable Definition