How to count external events
This section deals with the counting of external events via contact closures or pulses which occur more then 100mS apart. The Digital I/O Module or Digital Input Module can be used for this task and should be set up for either SWITCH or BUTTON configuration. Refer to the product data sheet for more information on how to use and wire up these modules.
To count an event, ModCom provides an Event Counter which can run in stand-alone mode, or be operated on by other objects within ModCom. Simply choose an Event Counter from the <Place Object> menu at the top of the screen and move it to the desired position with the mouse. Follow the steps below to set up the Event Counter for operation.
Step 1: To use the Digital I/O Module or Digital Input Module to report logic transitions on its inputs, you must first set up these inputs for SWITCH or BUTTON configuration. Go to the <Run-Loop> menu at the top of the screen and click on Initialization. From the command set shown in Table 2 of the product data sheet, choose the command string or strings which are required to set up the desired inputs for SWITCH or BUTTON and type them into this dialog box. If using the Digital I/O Module with the BUTTON function, you may want to disable the TYPEMATIC feature of that input; this dialog box is where you would place that command string also. Close out this box when you have finished.
Step 2: To set the properties of the Event Counter, right-click on the object. This will bring up the Properties dialog box which contains a number of user defined attributes which can be used to customize the Event Counter's appearance and operation.
Step 3: In the "Conditionals" section, type in the command string which will be returned from the Data Module when a logic transition occurs at its input. If you are uncertain about the syntax of this command string, open the Send/Receive dialog box in the <Communicate> menu and look at the data being returned. Be sure to click on the "Send Config" button initially to make sure that the Data Module's input is set up for BUTTON or SWITCH.
Step 4: Close out the Properties dialog box and start the main run-time loop by clicking on the green "Run" button at the top of the screen. Apply a pulse or logic transition to the Data Module's input and watch how the Event Counter updates accordingly.
The Event Counter can also respond to more then one command string if required. Allowing the counter to be updated due to pulses or logic transitions received on many different inputs and multiple Data Modules. To do this, go to the <Run-Loop> menu item at the top of the screen, click on Conditionals, and create a separate conditional statement for each command string.