background image

Chapter 6: 8254 Counter/Timer

  
These boards optionally contain one type 82C54 programmable counter/timer. This is hard wired on the 
board to allow you to implement a 16-bit Event Counter or 32-bit Rate Generator (Frequency Output) 
functions. See the block diagram. 
  
The 82C54 is a flexible and powerful device that consists of three independent 16-bit down counters. 
Each counter can be programmed to any count as low as 1 or 2 (depending on the mode chosen) and 
up to 65,535. For those interested in more detailed information, a full description can be found in the 
Intel (or equivalent manufacturer's) data sheet in the Chip Docs section on the CD.  
  
To save I/O space, the digital I/O registers overlay the Counter/Timer register space. To access these 
registers, write any value to base a Dh. After the Counter/Timer is programmed, read from the 
same address to regain access to the digital I/O circuit. 

 

Operational Modes

 

  
The 8254 modes of operation are described in the following paragraphs to familiarize you with the 
versatility and power of this device. For those interested in more detailed information, a full description 
of the 8254 programmable interval timer can be found in the Intel (or equivalent manufacturers') data 
sheets. The following conventions apply for use in describing operation of the 8254 :  

  
 

Clock: 

A positive pulse into the counter's clock input 

 

Trigger: 

A rising edge input to the counter's gate input 

 

Counter Loading: 

Programming a binary count into the counter 

  

Mode 0: Pulse on Terminal Count

 

After the counter is loaded, the output is set low and will remain low until the counter decrements to 
zero. The output then goes high and remains high until a new count is loaded into the counter. A trigger 
enables the counter to start decrementing.  

  

Mode 1: Retriggerable One-Shot

 

The output goes low on the clock pulse following a trigger to begin the one-shot pulse and goes high 
when the counter reaches zero. Additional triggers result in reloading the count and starting the cycle 
over. If a trigger occurs before the counter decrements to zero, a new count is loaded. This forms a 
retriggerable one-shot. In mode 1, a low output pulse is provided with a period equal to the counter 
count-down time. 

  

Mode 2: Rate Generator

 

This mode provides a divide-by-N capability where N is the count loaded into the counter. When 
triggered, the counter output goes low for one clock period after N counts, reloads the initial count, and 
the cycle starts over. This mode is periodic, the same sequence is repeated indefinitely until the gate 
input is brought low. This mode also works well as an alternative to mode 0 for event counting. 

  

Mode 3: Square Wave Generator

 

This mode operates like mode 2. The output is high for half of the count and low for the other half. If the 
count is even, then the output is a symmetrical square wave. If the count is odd, then the output is high 
for (N+1)/2 counts and low for (N-1)/2 counts. Periodic triggering or frequency synthesis are two 
possible applications for this mode. Note that in this mode, to achieve the square wave, the counter 
decrements by two for the total loaded count, then reloads and decrements by two for the second part 
of the wave form.  

  

Manual 104-DIO-48E, 24E 

21

Содержание 104-DIO-24E

Страница 1: ...service in house repair center WE BUY USED EQUIPMENT Sell your excess underutilized and idle used equipment We also offer credit for buy backs and trade ins www artisantg com WeBuyEquipment REMOTE IN...

Страница 2: ...10623 Roselle Street San Diego CA 92121 y 858 550 9559 y Fax 858 550 7322 contactus accesio com y www accesio com MODEL 104 DIO 48E and 104 DIO 24E USER MANUAL FILE M104 DIO 48E A1n...

Страница 3: ...s IBM PC PC XT and PC AT are registered trademarks of the International Business Machines Corporation Printed in USA Copyright 2001 2005 by ACCES I O Products Inc 10623 Roselle Street San Diego CA 921...

Страница 4: ...warranty Warranty commences with equipment shipment Following Years Throughout your equipment s lifetime ACCES stands ready to provide on site or in plant service at reasonable rates similar to those...

Страница 5: ...ng Your Application Software 15 Table 5 1 Address Selection Table 15 Digital I O 16 Table 5 2 Control Register Bit Assignment 16 Programming Example Basic 18 Enabling Disabling I O Buffers 18 Counter...

Страница 6: ...Peripheral Interface PPI chips of type 82C55 to provide a computer interface to 48 I O lines There are three 8 bit ports A B and C per PPI Each 8 bit port can be configured by software to function as...

Страница 7: ...board optionally has an 82C54 Counter Timer chip This can be used for frequency measurement frequency output pulse width modulation pulse width measurement event count etc SPECIAL NOTE FOR PROGRAMMERS...

Страница 8: ...SELECT INTERRUPT ENABLE PPI GROUP 1 PPI GROUP 0 DI O INTERRUPT COMPUTER I O BUS I O B U F F E R S C O N N E C T O R C O N N E C T O R PORT A PORT B PORT C HI PORT C LO PORT A PORT B PORT C HI PORT C L...

Страница 9: ...n The following instructions assume the CD ROM drive is drive D Please substitute the appropriate drive letter for your system as necessary DOS 1 Place the CD into your CD ROM drive 2 Type B to change...

Страница 10: ...ess according to your application requirements as mentioned above 2 Remove power from the PC 104 stack 3 Assemble standoff hardware for stacking and securing the boards 4 Carefully plug the board onto...

Страница 11: ...upts are enabled by writing any value to base address Bh and disabled by reading from that address Once an interrupt has occured it must be cleared by writing any value to base address Fh for the next...

Страница 12: ...A4 A5 A6 A7 A8 IRQ 12 IRQ 4 IRQ 5 IRQ 7 IRQ 10 IRQ 11 P1 P4 P3 IRQ 3 A9 Pin 1 Pin 1 Pin 1 IEN1 IEN0 INP1 INP0 TST BEN Figure 3 1 Option Selection Map Manual 104 DIO 48E 24E 11...

Страница 13: ...A 2C0 2CF EGA 2D0 2DF EGA 2E0 2E7 GPIB AT 2E8 2EF Serial Port 2F8 2FF Serial Port 300 30F Prototype Board 310 31F Prototype Board 320 32F Hard Disk XT 370 377 Floppy Controller 2 378 37F Parallel Prin...

Страница 14: ...300h 30Fh On 2F0h 2FFh On On 2E0h 2EFh On On 2D0h 2DFh On On On 2C0h 2CFh On On 2B0h 2BFh On On On 2A0h 2AFh On On On 290h 29Fh On On On On 280h 28Fh On On 270h 27Fh On On On 260h 26Fh On On On 250h 2...

Страница 15: ...evious page before selecting the board address If the addresses of two circuits overlap you will experience unpredictable computer behavior Note that address ranges 100h 10Fh through 1F0h 1FFh can be...

Страница 16: ...ister Operation Counter Timer Disabled Counter Timer Enabled Base Address PA Group 0 Counter Timer 0 Read Write Base Address 1 PB Group 0 Counter Timer 1 Read Write Base Address 2 PC Group 0 Counter T...

Страница 17: ...put 0 Output D2 Mode Select 1 Mode 1 0 Mode 0 D3 Port C Hi C4 C7 1 Input 0 Output D4 Port A 1 Input 0 Output D5 D6 Mode Select 00 Mode 0 01 Mode 1 1X Mode 2 D7 Mode Set Flag 1 Active Table 5 2 Control...

Страница 18: ...t be the same for the two control bytes Those buffers will now remain enabled until another control byte with data bit D7 high is sent to base address 3 The buffers for all ports of the group can be t...

Страница 19: ...0 X INP BASEADDR Read Port A 40 Y INP BASEADDR 2 16 Read Port C Hi To set outputs high 1 at Port B and the lower nybble of Port C 50 OUT BASEADDR 1 HFF Turn on all Port B bits 60 OUT BASEADDR 2 HF Tur...

Страница 20: ...the mode you must first set the new mode and then enable the buffers Enabling the buffers can be done at either Base Address 3 or 7 or Base Address 8 or 9 Counter Timer The board uses an 8254 counter...

Страница 21: ...o indicate that it asserted the interrupt but is otherwise capable of sharing the IRQ In this case it may share the interrupt level with other boards if a it is the only board on that IRQ level that d...

Страница 22: ...Count After the counter is loaded the output is set low and will remain low until the counter decrements to zero The output then goes high and remains high until a new count is loaded into the counte...

Страница 23: ...gger Programming the 8254 The counters are programmed by writing a control byte into the counter control register The control byte specifies the counter to be programmed the counter mode the type of r...

Страница 24: ...ter on the fly without disturbing the counting process You can only rely on directly read counter data if the counting process is suspended while reading by bringing the gate low For each counter you...

Страница 25: ...s in BCD mode If both STA and CNT bits in the readback command byte are set low and the RW1 and RW0 bits have both been previously set high in the counter control register thus selecting two byte read...

Страница 26: ...is limited by the input speed of the 8254 counter and slow signals are preferred Further only 65 535 events are possible without a RESET The function returns the number of events based on priority or...

Страница 27: ...ut PPI 0 write any value to Base Address Dh To map out the counter timer and map in PPI 0 read from Base Address Dh This mapping does not reset either chip in any way so you can for example map in the...

Страница 28: ...ery second line is grounded to minimize crosstalk between signals Table 7 1 Digital I O P3 and P4 Connector Pin Assignments Assignment Pin Assignment Pin PC7 1 2 PC6 3 4 PC5 5 6 Port C Hi PC4 7 8 PC3...

Страница 29: ...nector Pin Assignments Assignment Pin Ground 1 Ground 2 1MHz Clock output 3 Ground 4 Clock 0 a k a CLOCK IN events input 5 Ground 6 Gate 1 a k a GATE IN input 7 Ground 8 Output 2 a k a CLOCK OUT 9 Gro...

Страница 30: ...ve us some feedback please email us at manuals accesio com Please detail any errors you find and include your mailing address so that we can send you any manual updates 10623 Roselle Street San Diego...

Страница 31: ...service in house repair center WE BUY USED EQUIPMENT Sell your excess underutilized and idle used equipment We also offer credit for buy backs and trade ins www artisantg com WeBuyEquipment REMOTE IN...

Отзывы: