ACC-72EX User Manual
Appendix A – Setup Examples
130
COMX Test PLC
The following Turbo PMAC PLCs can be used to test the communication of the COMX module. Run
PLC 1 and check the variable M_CommErrorFlag. If it is =0 after PLC 1 finishes, the COMX module is
communicating properly.
CLOSE
END GAT
DEL GAT
#include "M-VariableDefinition_$6C000.pmc"
#define M_CommErrorFlag P1
#define timer i6612
#define msec *8388608/i10while(i6612>0)endwhile
OPEN PLC 1 CLEAR
DISABLE PLC 2..31 // Disable all other tasks
M_SCtrl_ulSystemCommandCOS=$55AA55AA // Reset token for MASTER Unit
M_HCSC_HSF_RESET=1 // Reset bit, token required for reset to complete
M_CommErrorFlag=0
timer = 4000 msec // Reset Time-out Timer
WHILE (M_CommErrorFlag=0 AND M_HCSC_NSF_READY=0) // Wait for reset to complete
IF (timer<0) // Check for reset timeout
M_CommErrorFlag = 1
ENDIF
ENDWHILE
IF (M_CommErrorFlag=0) //
WHILE (M_CC0_RCX_COMM_COS_RUN=0) // wait for comm tasks to
// start on COMX modules
M_HCCC0_HCF_NETX_COS_ACK = M_HCCC0_HCF_NETX_COS_ACK ^ 1
// Toggle Communication Channel 0’s Change of State Acknowledge bit in
// order to read the CC0_RCX_COMM_COS_RUN which is a part of Communication
// Channel 0 State Register
enable plc 2
ENDWHILE
ENDIF
DISABLE PLC 1
CLOSE
open plc2 clr
timer =4000 msec // Reset Time-out Timer
//M_CC0_RCX_APP_COS_APP_READY=1
IF (M_HCSC_HSF_HOST_COS_CMD
= M_HCSC_NSF_HOST_COS_ACK)
M_CC0_RCX_APP_COS_BUS_ON=1 // Setting the Bus On flag for 1st ACC-72EX
M_CC0_RCX_APP_COS_BUS_ON_ENABLE=1
M_HCSC_HSF_HOST_COS_CMD
= M_HCSC_HSF_HOST_COS_CMD^1
ENDIF
timer = 1000 msec // Reset Time-out Timer
ENABLE PLC 28
ENABLE PLC 10
ENABLE PLC 11
ENABLE PLC 26
disable plc2
close
OPEN PLC 28 CLEAR
M_CC0_ulDeviceWatchdog = M_CC0_ulHostWatchdog // copies the host watchdog content
CLOSE
OPEN PLC 10 CLEAR
IF (M_HCCC0_HCF_PD0_OUT_CMD = M_HCCC0_NCF_PD0_OUT_ACK) // Making sure the ACK flag matches the
CMD