APPENDIX D
PCI-1711/1731 User’s Manual
Advantech Co., Ltd.
www.advantech.com
– 53 –
If you set the module for binary counting, the count can be any
number from 0 up to 65535. If you set it for BCD (Binary Coded
Decimal) counting, the count can be any number from 0 to 9999.
If you set both SC1 and SC0 bits to 1, the counter control register is in
read-back command mode. The control register data format then
becomes:
BASE + 30(Dec) 82C54 control, read-back mode
Bit
D7
D6
D5
D4
D3
D2
D1
D0
Value
1
1
CNT
STA
C2
C1
C0
X
CNT = 0
Latch count of selected counter(s)
STA = 0
Latch status of selected counter(s)
C2, C1 & C0
Select counter for a read-back operation
C2 = 1 select Counter 2
C1 = 1 select Counter 1
C0 = 1 select Counter 0
If you set both SC1 and SC0 to 1 and STA to 0, the register selected by
C2 to C0 contains a byte which shows the status of the counter. The
data format of the counter read/write register then becomes:
BASE+24/26/28(Dec) Status read-back mode
Bit
D7
D6
D5
D4
D3
D2
D1
D0
Value
O U T NC
RW1
RW0
M 2
M 1
M 0
BCD
OUT
Current state of counter output
NC
Null count is 1 when the last count written to the counter
register has been loaded into the counting element
D.3 Counter Operating Modes
MODE 0 – Stop on Terminal Count
The output will initially be low after you set this mode of operation.
After you load the count into the selected count register, the output
will remain low and the counter will count. When the counter reaches
the terminal count, its output will go high and remain high until you
reload it with the mode or a new count value. The counter continues to
decrement after it reaches the terminal count. Rewriting a counter
register during counting has the following results:
1. Writing to the first byte stops the current counting.