-------------------------------------------- CONPROSYS Script sample programs No. 007 -------------------------------------------- Process name: Counter Setting (Two digits) Date of creation: February 22, 2016 Processing content: Use 8 bits of digital input, DI0 to DI7 to set counter (two digits) The count data is desplayed on a 7-segment display (two digits) through the 8 bits of digital output, DO0 to DO7. [Signals] DI0 to DI3 - Digital inputs for numerical setting (1 digit) DI4 - Numerical setting (set the numerical data to one's place) DI5 - Numerical setting (Set the numerical data to ten's place) DI6 - Plus one to current data DI7 - Minus one to the current data DO0 to DO3 - 7-segment display output (digit of one's place) DO4 to DO7 - 7-segment display output (digit of ten's place) [Operation] 1. When there is an input of the numerical setting (one's place), the input value of DI0 to DI3 is set to the digit of one's place. 2. When there is an input of the numerical setting (ten's place), the input value of DI0 to DI3 is set to the digit of ten's place. 3. DI6 adds one to the current value. The maximum count value is 99. 4. DI7 decreases one from the current value. The least count data is 0. 5. The count value displayed on a two digit 7-segment display, from 0 to 99. [Description] The sample program has a main task (TASK9) and a subroutine (SUB9). To use this sample program, restores this sample program to the M2M controller and names the task number and the subroutine number. If the subroutine is renamed to a number that is not SUB9, change the calling number to the new one. TASK9 configures control circuit of data setting. SUB9 is a 7-segment display subroutine. A count value, 0 to 99 is saved in TAG90. LTAG0 to LTAG9 are working tags for setting operation. LTAG98 and LTAG99 are working tags of subroutine. Nor anti-charttering circuit is applied to the digital inputs. This sample program waits 10 msec before performing the control functions after an active input. In case a 10 msec waiting still has chattering occurred in the up count and down count inputs, longer the wait time may reduce chattering of inputs.