PIO-D48 Series Card
48-channel OPTO-22 Compatible DIO Board
User Manual/Ver. 3.4/Aug. 2015/PMH-006-34/Page: 44
8254 Timer/Counter
OUT0
CLK0
GATE0
Counter 0
OUT1
CLK1
GATE1
Counter 1
OUT2
CLK2
GATE2
Counter 2
INT_CHAN_2
INT_CHAN_3
VCC
32.768 KHz or 2 MHz
PC0 (Port-2)
Read/Write 8-bit data of 8254
(Read/Write): wBase+0xe0/ 0xe4/ 0xe8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
D7
D6
D5
D4
D3
D2
D1
D0
(Read/Write): wBase+0xec= 8254 control word
(Read/Write): wBase+0xe0= 8254-counter-0
(Read/Write): wBase+0xe4= 8254-counter-1
(Read/Write): wBase+0xe8= 8254-counter-2
For example:
outportb(wBase+0xec,0x30);
/* Counter0, mode-0 */
outportb(wBase+0xe0,0xff);
/* write to low byte first */
outportb(wBase+0xe0,0xff)
/* write to high byte second */
/* Then Counter0 will down count from 0xffff */
The configuration of 8254 counter:
Refer to the following demo programs for more related information:
Int2 Demo
Counter0 (Using interrupt INT_CHAN_2)
Int3 Demo
Counter1 ~ Counter 2 (Using interrupt InT_CHAN_3)