Ls 7166
Ls 7166
Ls 7166
UL
® LSI Computer Systems, Inc. 1235 Walt Whitman Road, Melville, NY 11747
LS7166
(631) 271-0400 FAX (631) 271-0405
A3800
January 2003
24-BIT QUADRATURE COUNTER
FEATURES:
• Programmable modes are: Up/Down,
Binary, BCD, 24 Hour Clock, Divide-by-N,
x1 or x2 or x4 Quadrature and Single-Cycle.
20-Pin Package PIN ASSIGNMENT - Top View
• DC to 20MHz Count Frequency.
• 8-Bit I/O Bus for Microprocessor *(Contact factory for 24-Pin TSSOP Package Pinout)
Communication and Control.
• 24-Bit comparator for pre-set count (Write Input) WR 1 20 VSS (GND)
LSI
comparison.
(Chip Select Input) CS 2 19 RD (Read Input)
• Readable status register.
• Input/Output TTL and CMOS compatible. (Load Counter/Load Latch) LCTR/LLTC 3 18 C/D (Control/ Data Input)
• 5V operation (Vdd - Vss).
4
LS7166
• LS7166 (DIP); LS7166-S (SOIC); (A, B Gate/Reset Counter)ABGT/RCTR 17 BW (Borrow Output)
LS7166-TS24 (24-Pin TSSOP)* - See Fig. 1 VDD (+5V) 5 16 CY (Carry Output)
(Count Input) A 6 15 D7
GENERAL DESCRIPTION:
The LS7166 is a CMOS, 24-bit counter that (Count Input) B 7 14 D6
can be programmed to operate in several dif-
D0 8 13 D5
ferent modes. The operating mode is set up
by writing control words into internal control D1 9 12 D4
registers (see Figure 8). There are three 6-bit
and one 2-bit control registers for setting up D2 10 11 D3
the circuit functional characteristics. In addi-
tion to the control registers, there is a 5-bit out-
FIGURE 1
put status register (OSR) that indicates the cur-
rent counter status. The IC communicates with
external circuits through an 8-bit three state I/O
bus. Control and data words are written into
the LS7166 through the bus. In addition to the
I/O bus, there are a number of discrete inputs
and outputs to facilitate instantaneous hard-
ware based control functions and in-
stantaneous status indication.
REGISTER DESCRIPTION:
Internal hardware registers are accessible
The information included herein is believed to be
through the I/O bus (D0 - D7) for READ or
accurate and reliable. However, LSI Computer Systems,
WRITE when CS = 0. The C/D input selects Inc. assumes no responsibilities for inaccuracies, nor for
between the control registers (C/D = 1) and the any infringements of patent rights of others which may
data registers (C/D = 0) during a READ or result from its use.
WRITE operation. (See Table 1)
7166-012703-1
PR (Preset register). The PR is the input port for the CNTR. The CNTR is loaded with a 24 bit data via the PR. The
data is first written into the PR in 3 WRITE cycle sequence of Byte 0 (PR0), Byte 1 (PR1) and Byte 2 (PR2).
The address pointer for PR0/PR1/PR2 is automatically incremented with each write cycle.
Accessed by: WRITE when C/D = 0, CS = 0.
MCR (Master Control Register). Performs register reset and load operations. Writing a "non-zero” word to MCR does
not require a follow-up write of an “all-zero” word to terminate a designated operation.
Accessed by: WRITE when C/D = 1, CS = 0.
Bit # 7 6 5 4 3 2 1 0
0 0
7166-012703-2
TABLE 1 - Register Addressing Modes
D7 D6 C/D RD WR CS COMMENT
X X X X X 1 Disable Chip for READ/WRITE
0 0 1 1 0 Write to Master Control Register (MCR)
X = Don't Care
OSR (Output Status Register). Indicates CNTR status: Accessed by: READ when C/D = 1, CS = 0.
Bit # 7 6 5 4 3 2 1 0
U U U 0/1 0/1 0/1 0/1 0/1
OL(Output latch). The OL is the output port for the CNTR. The 24 bit CNTR Value at any instant can be accessed
by performing a CNTR to OL transfer and then reading the OL in 3 READ cycle sequence of Byte 0 (OL0), Byte 1 (OL1)
and Byte 2 (OL2). The address pointer for OL0/OL1/OL2 is automatically incremented with each READ cycle.
Accessed by: READ when C/D = 0, CS = 0.
Bit # 7 0 7 0 7 0
7166-012703-3
OCCR (Output Control Register) Initializes CNTR and output operating modes.
Accessed by : WRITE when C/D = 1, CS = 0.
Bit # 7 6 5 4 3 2 1 0
1 0
0: Binary count mode (Overridden by D3 = 1).
1: BCD count mode (Overridden by D3 = 1)
0: Normal count mode
1: Non-Recycle count mode. (CNTR enabled with a Load or Reset
CNTR and disabled with generation of Carry or Borrow.
In this mode no external CY or BW is generated. Instead
CYT or BWT should be used as cycle completion indicator.)
0: Normal count mode
Bit # 7 6 5 4 3 2 1 0
1 1 X X X X
0 Disable quadrature mode
0
0
Enable x2 quadrature mode
1
1 Select QR
1
X = Don’t Care
7166-012703-4
I/O DESCRIPTION:
(See REGISTER DESCRIPTION for I/O Prgramming.)
Data-Bus (D0 - D7) (Pin 8 - Pin 15). The 8-line data bus is a In non-quadrature mode, if Pin 4 is programmed as A and B en-
three-state I/O bus for interfacing with the system bus. able gate input, it may switch state only when A is high (if A is
CS (Chip Select Input) (Pin 2). A logical "0" at this input en- clock and B is direction) or when both A and B are high (if A
ables the chip for Read and Write. and B are clocks. In quadrature mode, if Pin 4 is programmed
RD (Read Input) (Pin 19). A logical "0" at this input enables the as A and B enable gate, it may switch state only when either A
OSR and the OL to be read on the data bus. or B switches.
WR (Write Input) (Pin 1). A logical "0" at this input enables the
data bus to be written into the control and data registers. LCTR/LLTC (PIN 3). This input can be programmed to func-
C/D (Control/Data Input) (Pin 18). A logical "1" at this input en- tion as the external load command input for either the CNTR or
ables a control word to be written into one of the four control the OL. When programmed as counter load input, the counter
registers or the OSR to be read on the I/O bus. A logical "0" en- is loaded with the data contained in the PR. When pro-
ables a data word to be written into the PR, or the OL to be read grammed as the OL load input, the OL is loaded with data con-
on the I/O bus. tained in the CNTR. A logical "0" is the active level on this in-
A (Pin 6). Input A is a programmable count input capable of put.
functioning in three different modes, such as up count input, CY (Pin 16). This output can be programmed to serve as one
down count input and quadrature input. of the following:
B (Pin 7). Input B is also a programmable count input that can A. CY. Complemented Carry out (active "0").
be programmed to function either as down count input, or count B. CY. True Carry out (active "1").
direction control gate for input A, or quadrature input. When B is C. CYT. Carry Toggle flip-flop out.
programmed as count direction control gate, B = 0 enables A as D. COMP. Comparator out (active "0")
the Up Count input and B = 1 enables A as the Down Count in- BW (Pin 17). This output can be programmed to serve as one
put. When programmed as the direction input, B can switch of the following:
state only when A is high. A. BW. Complemented Borrow out (active "0").
B. BW. True Borrow out (active "1").
ABGT/RCTR (PIN 4). This input can be programmed to func- C. BWT. Borrow Toggle flip-flop out.
tion as either inputs A and B enable gate or as external counter D. COMPT. Comparator Toggle output.
reset input. A logical "0" is the active level on this input. VDD (Pin 5). Supply voltage positive terminal.
VSS (Pin 20). Supply voltage negative terminal.
7166-012703-5
TRANSIENT CHARACTERISTICS (See Timing Diagrams in Fig. 2 thru Fig. 7,
VDD = 4.5V to 5.5V, TA = 0˚ to 70˚C, unless otherwise specified)
Quadrature Mode:
Clock A/B Validation delay TCQV - 160 ns
(See NOTE 2)
A and B phase delay TPH 208 - ns
Clock A/B frequency fCQ - 1.2 MHz
CY, BW, COMP pulse width TCBW 75 180 ns
NOTE 2: In quadrature mode A/B inputs are filtered and required to be stable
for at least TCQV length to be valid.
7166-012703-6
TLCW
LTCR
TLC
TCL
UP CLK (A)
TCH TUDD
TCH
DN CLK (B)
TCL
Q0
(Internal)
Q1
(Internal)
Q2-Q23
(Internal)
CNTR=FFFFFD CNTR=FFFFFE CNTR=FFFFFF CNTR=000000 CNTR=0000001 CNTR=000000 CNTR=FFFFFF CNTR=FFFFFE CNTR=FFFFFD
(PR=CNTR) (PR=CNTR)
COMP NOTE 2
CY
BW
FIGURE 2 . LOAD COUNTER, UP CLOCK, DOWN CLOCK, COMPARE OUT, CARRY, BORROW
NOTE 1: The counter in this example is assumed to be operating in the binary mode.
NOTE 2: No COMP output is generated here, although PR = CNTR. COMP output is disabled with a counter load command and
enabled with the rising edge of the next clock, thus eliminating invalid COMP outputs whenever the CNTR is loaded from the PR.
NOTE 3: When UP Clock is active, the DN Clock should be held "HIGH" and vice versa.
UP CLK
OR DN CLK
TCBH
TCBL
CY
TTFH TTFL
CYT
TCBL
TCBH
BW
TTFL
TTFH
BWT
TCBL
TCBH
COMP
TTFH TTFL
COMPT
SIGN
(INTERNAL)
7166-012703-7
CS, C/D
TCRS TCRH
RD
TRD TRT
DATA BUS
VALID OUTPUT
CS,
C/D
WR
TSWH
TSWS
TDS TDH
VALID DATA
DATA BUS
LCTR
DN CLK
Q0
(INTERNAL)
Q1
(INTERNAL)
Q2-Q23
(INTERNAL)
CNTR=3 =2 =1 =0 =3 =2 =1 =0 =3
CNTR LD
(INTERNAL)
BW
CNTR LOAD
(LCTR or MCR BASED)
UP CLK OR
DN CLK
CY or BW
CNTR DISABLED
CNTR DISABLED CNTR ENABLED
7166-012703-8
FORWARD REVERSE
A
TPH TPH
B
TCQV
UPCLK (X1)
(Internal)
DNCLK (X1)
(Internal)
UPCLK (X2)
(Internal)
DNCLK (X2)
(Internal)
TCQV
UPCLK (X4)
(Internal)
DNCLK (X4)
(Internal)
UP/DN(OSR Bit 4)
TCBW
CY
BW TCBW
FIGURE 7.
D0, D6,D7
QR
(CHIP SELECT INPUT) CS 2
(READ INPUT) RD 19
D0 - D7
OCCR CONTROL
(WRITE INPUT) WR 1
INPUT LOGIC
COMPARATOR
N1=N2
N1 N2
PR/OL
ADDRESS
PR0
B0 - B23
B0 - B7
(+5V) VDD 5 OL0
PR1
CNTR
(GND) VSS D0 -D7 B8 - B15
20
Q0 -Q23 OL1
PR2
B16 - B23
OL2
PR/OL ADDRESS
D0 - D7
FIGURE 8.
LS7166 BLOCK DIAGRAM UP CLOCK
DN CLOCK
7166-012703-10
FIGURE 9. 80C31/8051 TO LS7166 INTERFACE IN EXTERNAL ADDRESS MODE
8051
80C31 74HC573
19
AD0 2
P0.0 D1 Q1
AD1 3
P0.1
AD2 4
P0.2
AD3 5
P0.3
AD4 6
P0.4
AD5 7
P0.5 7166
AD6 8
P0.6
AD7 9 18
P0.7 C/D
11 C
ALE
1 12 2
0C Q8 CS/
AD0 8
D0
AD1 9
D1
AD2 10
D2
AD3 11
D3
AD4 12
D4
AD5 13
D5
AD6 14
D6
AD7 15
D7
1
WR/ WR/
19
RD/ RD/
NOTE: Port_0 is open drain output. Add pull-up resistors to all Port_0 I/0 lines.
VCC
UR
31 39 5
VCC ER/VP P0.0
38 6 R V DD 16
P0.1 CY
P0.2 37
19 36 7 8
X1 P0.3 BW 17
P0.4 35
18 P0.5 34 3 LCTR/LLTC
X2
P0.6 33
P0.7 32 4 RBGT/RCTR
9 RESET
7166-012703-11
+5V
FIGURE 11. 8051 INTERFACE TO LS7166 I/O MODE
C7
CAP
ISA BUSS U7
5
6 VDD 16
D7 A
D6 7 17
D5 B
3
D4 LCTR/LLTC
D3 4 ABGT/RCTR
D2
D1 D0 8 D0
D0 D1 9 D1
D2 10 D2
D3 11 D3
D4 12 D4 WR 1
D5 13 D5 RD 19 IOR
D6 14 D6 18 A0
AEN C/D
D7 15 D7 CS 2
Vss
20
A9
A8
A7
A6 1
A5 3
ADDRESS 2
A4
DECODER
A3 74MC32
A2
A1
CLOCK
A0
IOR
IOW VCC
4
2 PR 5
D Q
3
CLK
6
Q
1 1
2 74HC74
74HC04
7166-012703-12
+5V
FIGURE 12. LS7166 TO 68HC11 INTERFACE
U1
PC0 8 16
D0 VDD CY
30 XT PA3 5 PC1 9
29 EX PA4 PC2 10 D1
4 17
PA5 PC3 D2 BW
3 11
39 RESET PA6 2 PC4 12 D3
LCTR/LLTC 3
41 IRQ PA7 1 PC5 13 D4
40 XIRD PC6 14 D5 4
PC7 15 D6 RBGT/RCTR
8 PA0 16 D7 LS7166
PB0 18 6
7 PA1 15 A0 A COUNT IN
PB1 C/D
6 PA2 14 CS/ 2
PB2 CS
7
17 PE0 PB3 13 B COUNT IN
18 PE1 PB4 12 VR/ 1
19 PE2 PB5 11 RD/ 19 VR
20 PE3 PB6 10 RD GND
PB7 9 U3
22 YRH 20
21 YRL
PC0 31 PC0 PC0 3 D0 Q0 2
PC1 32 PC1 PC1 4 D1 Q1 5
PC2 33 PC2 PC2 7 D2 Q2 6
PC3 34 PC3 PC3 8 D3 Q3 9
PC4 35 PC4 PC4 13 D4 Q4 12 ADDRESS
PC5 36 PC5 PC5 14 D5 Q5 15 DECODE
PC6 37 PC6 PC6 17 D6 Q6 16
PC7 38 PC7 PC7 18 D7 Q7 19
1 OC
PD0 42
11 G
PD1 43
PD2 44 74HC373 +5V
PD3 45
PD4 46
PD5 47
4
MODA 25 2 PR
D 5
MODB 24 Q
CLK
E 27
AS 26 Q 6
R/W 28 CL
1
U5 A U6 A 74HC74
68HC11A1 1 2 1
3
74HC04 2
74HC08
U6 B U5 B
4
6 3 4
5
74HC08 74HC04
7166-012703-13
FIGURE 13. 68000 INTERFACE TO LS7166
DATA BUS
D0 - D7
ADDRESS
D Q A0
LS373 C/D
CK DECODE
CS
R/W RD
+V
LDS/UDS
S 7166
68000 D
68008 S74
68010 CK Q WR
R +V
AS
SD Q S D
S74 S74
Q CK CK
DTACK R R
CLK
CLOCK
7166-012703-14