The Western Design Center, Inc. W65C21S Data Sheet Peripheral Interface Adapter (PIA) W65C21S The Western Design Center W65C21S 1 The Western Design Center, Inc. W65C21S Data Sheet WDC reserves the right to make changes at any time without notice in order to improve design and supply the best possible product. Information contained herein is provided gratuitously and without liability, to any user. Reasonable efforts have been made to verify accuracy of the information but no guarantee whatsoever is given as to the accuracy or as to its applicability to particular uses. In every instance, it must be the responsibility of the user to determine the suitability of the products for each application. WDC products are not authorized for use as critical components in life support devices or systems. Nothing contained herein shall be construed as a recommendation to use any product in violation of existing patents or other rights of third parties. The sale of any WDC product is subject to all WDC Terms and Conditions of Sales and Sales Policies, copies of which are available upon request. Copyright (C) 1981-2005 by The Western Design Center, Inc. All rights reserved, including the right of reproduction in whole or in part in any form. The Western Design Center W65C21S 2 The Western Design Center, Inc. W65C21S Data Sheet DESCRIPTION • • The WDC W65C21S is a very flexible Peripheral Interface Adapter (PIA) for use with WDC’s 65xx and other 8-bit microprocessor families. The W65C21S provides programmed microprocessor control of up to two peripheral devices (Port A and Port B). Peripheral device control is accomplished through two 8-bit bidirectional I/O Ports, with individually designed Data Direction Registers. The Data Direction Registers provide selection of data flow direction (input or output) at each respective I/O Port. Data flow direction may be selected on a line-by-line basis with intermixed input and output lines within the same port. The “handshake” interrupt control feature is provided by four peripheral control lines. This capability provides enhances control over data transfer functions between the microprocessor and peripheral devices, as well as bidirectional data transfer between W65C21S Peripheral Interface Adapters in multiprocessor systems. • • • • • • W65C21S 39 38 37 36 35 34 33 32 31 30 29 RS0 RS1 RESB D0 D1 D2 D3 D4 D5 D6 D7 PB7 CB1 CB2 VDD NC RWB CSO CS2 CS1 NC PHI2 18 19 20 21 22 23 24 25 26 27 28 7 8 9 10 11 12 13 14 15 16 17 VSS PA0 PA1 PA2 PA3 PA4 PA5 PA6 PA7 PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 CB1 CB2 VCC 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 W65C21S PA4 PA5 PA6 PA7 PB0 PB1 PB2 PB3 PB4 PB5 PB6 6 5 4 3 2 1 44 43 42 41 40 PA3 PA2 PA1 PA0 NC VSS CA1 CA2 IRQAB IRQBB NC • • Low Power CMOS N-well silicon gate technology High speed/Low power replacement for Motorola/Rockwell/AMI/MOS Technologies/MOSTEK/HITACHI/ ST Microelectronics/GTE/CMD 6520, 6521, 6820, 6821 PIA’s Two 8-bit bidirectional I/O ports with individual data direction control. Automatic “Handshake” control of data transfers Two interrupts (one for each port) with program control Static to 14MHz operation, with high speed Port A, CA2 outputs. Industrial temperature range 40 Pin Plastic Dip and 44 Pin Plastic PLCC versions 5 volt ± 10% supply requirements Compatible with the 65xx and 68xx family of microprocessors 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 CA1 CA2 IRQAB IRQBB RS0 RS1 RESB D0 D1 D2 D3 D4 D5 D6 D7 PHI2 CS1 CS2B CS0 RWB Figure 2. 40 Pin DIP Pin Configuration Figure 1. 44 Pin PLCC Pin Configuration FEATURES The Western Design Center W65C21S 3 The Western Design Center, Inc. W65C21S Data Sheet Figure 3. W65C21S PIA Block Diagram D0-D7 65xx, 68xx MICROPROCESSOR FAMILIES PHI2 RWB RS0 RS1 CS0 CS1 CS2B RESB IRQAB IRQBB VSS VCC (8) (8) PA0-PA7 CA1 CA2 PERIPHERAL DEVICE A W65C21S PIA CB1 CB2 (8) PB0-PB7 PERIPHERAL DEVICE B Figure 4. Interface Signals Relationship The Western Design Center W65C21S 4 The Western Design Center, Inc. W65C21S Data Sheet ABSOLUTE MAXIMUM RATINGS* Parameter Symbol Value Unit Supply Voltage VDD -0.3 to +7.0 Vdc Input Voltage VIN -0.3 to VDD Vdc This device contains input protection against damage due to high static voltages or electric fields; however, precautions should be taken to avoid application of voltages higher than the maximum rating. Notes: 1. Exceeding these ratings may cause permanent damage, functional operation under these conditions is not implied. +0.3 Output Voltage VOUT -0.3 to VDD Vdc +0.3 Operating Temp. Range Industrial Storage Temperature TA -40 to +85 °C TSTG -55 to +150 °C DC CHARACTERISTICS (VDD = 5.0V + 10%, VSS = 0, TA = -40ºCto +85ºC) Symbol Min2 Typ.2,3 Max2 VIH 2.0 -- VDD +0.3 V VDD = 5.5V VIL -0.3 -- 0.8 V VDD = 4.5V IIN -- -- ±10.0 nA VIN = .4V to 2.4V, VDD = 5.5V ITSI -- -- ±10.0 nA VIN = 0.4V to 2.4V, VDD = 5.5V Input High Current CA2, PA0-PA7 IIH -100 -- -- µA Input Low Current CA2, PA0-PA7 IIL -- -- -500 uA VIL = 0.4V, 5.5V VOH 2.4 -- -- V IOH = -200µA, = 4.5V VDD VOL -- -- 0.4 V VDD tCH -3.0 -- -20.0 mA IOL = 3.2mA, = 4.5V VOH = 1.5V, = 4.5V tOL 3.2 -- -- mA tOFF -- < .1 10.0 nA VOH = 2.4V IDD -- 100 500 uA VDD = 5.5V Parameter Input High Voltage Input Low Voltage Input Leakage Current CA1, CB1, CS0, CS1, CS2B, RESB, RS0, RS1, RWB , PHI2 Three-State (Off State), Leakage Current CB2, D0-D7, PB0-PB7 Output High Voltage D0-D7, PA0-PA7, PB0-PB7 Output Low Voltage CA2, CB2, D0-D7, IRQAB, IRQBB, PA0-PA7, PB0PB7 Output High Current (Sourcing) CB2 (Darlington Drive), PB0-PB7 Output Low Current (Sinking) CA2, CB2, D0-D7, IRQAB, IRQBB, PA0-PA7, PB0PB7 Output Leakage Current (Off State) IRQAB, IRQBB Power Dissipation Unit1 Test Conditions VIH = 2.4V, = 4.5V W65C21S VDD = VOL = 0.4V, = 4.5V Notes: 1. All units are direct current (DC) except for capacitance. 2. Negative sign indicates outward current flow, positive indicates inward flow. 3. Typical values are shown for VDD = 5.0V and TA = 25○ C 4. All production test loads use test machine capacitance (~30pF) only. 5. Capacitance of all pins is estimated 5.0pF at a 1MHz sample. The Western Design Center VDD 5 VDD VDD The Western Design Center, Inc. W65C21S Data Sheet AC TIMING CHARACTERISTICS Parameter PHI2 Cycle PHI2 Pulse Width PHI2 Rise and Fall Time Symbol tCYC tC trc tfc 14 MHz @ 5V Min Max 70 35 5 Unit ns ns ns Symbol tACR tCAR tPCR tCDR tHR 14 MHz @ 5V Min Max 10 0 10 20 5 - Unit ns ns ns ns ns Symbol tACW tCAW tDCW tHW tCPW 14 MHz @ 5V Min Max 10 0 10 5 20 Unit ns ns ns ns ns Symbol tCA2 tRS1 tRS2 tCB2 14 MHz @ 5V Min Max 20 20 25 70 Unit ns ns ns ns READ TIMING Parameter Address Set-Up Time Address Hold Time Peripheral Data Setup Time Data Bus Delay Time Data Bus Hold Time WRITE TIMING Parameter Address Set-Up Time Address Hold Time Data Bus Set-Up Time Data Bus Hold Time Peripheral Data Delay Time PERIPHERAL INTERFACE TIMING Parameter PHI2 Low to CA2 Low Delay PHI2 Low to CA2 High Delay CA1 Active to CA2 High Delay PHI2 High to CB2 Low Delay Peripheral Data Valid to CB2 Low Delay PHI2 High to CB2 High Delay CB1 Active to CB2 High Delay CA1, CA1, CB1, and CB2 Input Rise and Fall Time Interrupt Input Pulse Width Interrupt Response Time Interrupt Clear Delay The Western Design Center tDC 5 - ns tRS1 tRS2 - 20 25 ns ns tr, tf - 10 ns PWI tRS3 tIR - 70 20 25 ns ns ns W65C21S 6 The Western Design Center, Inc. W65C21S Data Sheet trc tC tCYC tfc PHI2 RS0, RS1, CS0, CS1, CS2B tACW tCAW RWB tDCW tHW D0-D7 DATA IN tCPW PA0-PA7 PB0-PB7 tCDR tCB2 tRS1 CB2 (PULSE OUT) tDC tr tf CB1 tRS2 CB2 (HANDSHAKE) Figure 5. Read Timing Waveforms The Western Design Center W65C21S 7 The Western Design Center, Inc. W65C21S Data Sheet Figure 6. Write Timing Waveforms The Western Design Center W65C21S 8 The Western Design Center, Inc. W65C21S Data Sheet PWI CA1,CA2 CB1,CB2 PHI2 IRQAB, IRQBB tIR IRQAB, IRQBB tRS3 Figure 8. Interrupt Clear Timing Figure 7. Interrupt Timing Table 1. Control Registers REGISTER SELECT PIN RS1 0 0 0 1 1 1 RS0 0 0 1 0 0 1 DATA DIRECTION REGISTER ACCESS CONTROL BIT CRA-2 CRB-2 1 0 1 0 - REGISTER SELECTED Peripheral Interface A Data Direction Register A Control Register A Peripheral Interface B Data Direction Register B Control Register B Table 2 Register Addressing P P PIN P DDR DDR DATA INPUT (OUTPUT MODE) N INPUT INPUT (INPUT MODE) Figure 10 Port B, CB2 Buffers Figure 9 Port A, CA2 Buffers The Western Design Center N DATA PIN W65C21S 9 The Western Design Center, Inc. W65C21S Data Sheet SIGNAL DESCRIPTION The PIA interfaces to the 65xx microprocessor family with a reset line, a PHI2 clock line, a read/write line, two interrupt request lines, two register select lines, three chip select lines and an 8-bit bidirectional data bus. The PIA interfaces to the peripheral devices with four interrupt/control lines and two 8-bit bidirectional data buses. Figures 1 and 2 show the pin assignments for these interface signals and Figure 4 shows the interface relationship of these signals as they pertain to the CPU and the peripheral devices. CHIP SELECT (CS0, CS1, CS2B) The PIA is selected when CS0 and CS1 are high and CS2B is low. These three chip select lines are normally connected to the processor address lines either directly or through external decoder circuits. When the PIA is selected data will be transferred between the data lines and PIA registers, and/or peripheral interface lines as determined by the RWB, RS0 and RS1 lines and the contents of Control Registers A and B. CLOCK SIGNAL (PHI2) The Phase 2 Clock Signal (PHI2) is the system clock that triggers all data transfers between the CPU and the PIA. PHI2 is generated by the CPU and us therefore the synchronizing signal between the CPU and the PIA. DATA BUS (D0-D7) The eight bidirectional data bus lines are used to transfer data between the W65C21S and the microprocessor. Data flow direction may be selected on a line-by-line basis with intermixed input and output lines within the same port. PERIPHERAL DATA PORT B (PA0-PA7) Peripheral Data Port B is an 8-line, bidirectional bus used for the transfer of data, control and status information between the W65C21S and a peripheral device. Functional operation is identical to Peripheral Data Port A, thus allowing the W65C21S to independently control two peripheral devices. READ/WRITE SIGNAL (RWB) Read/Write (RWB) controls the direction of data transfers between the PIA and the data lines associated with the CPU and the peripheral devices. A high on the RWB line permits the peripheral devices to transfer data to the CPU from the PIA. A low on the RWB line allows data to be transferred from the CPU to the peripheral devices from the PIA. REGISTER SELECT (RS0, RS1) The Register Select inputs allow the microprocessor to select the W65C21S internal registers as presented Table 2. Full functionality is described under the Functional Description section for Register Access and Selection. RESET SIGNAL (RESB) A low signal (Logic 0) on the Reset line serves to initialize the W65C21S, clearing all internal registers (to Logic 0) and placing all peripheral interface lines (PA and PB) in the input state. FUNCTIONAL DESCRIPTION During a Read operation, the contents of the W65C21S internal Data Bus Buffer (DBB) are transferred to the microprocessor via the Data Bus lines. During a Write operation, the Data Bus lines represent high impedance inputs over which data is transferred from the microprocessor to the Data Input Register (DIR). The Data Bus lines are in the high impedance state when the W65C21S is unselected. INTERRUPT STATUS CONTROL – CA1, CA2 (Port A) and CB1, CB2 (Port B) The two Interrupt Status Control lines for each Data Port are controlled by the Interrupt Status Control logic (A and B). This logic interprets the contents of the corresponding Control Register (CRA and CRB), allowing the Interrupt Status Control lines to perform various peripheral control functions. PERIPHERAL DATA PORT A (PA0-PA7) Peripheral Data Port A is an 8-line, bidirectional bus used for the transfer of data, control and status information between the W65C21S and a peripheral device. Each data port bus line may be individually programmed as either an input or output under control of the Data Direction Register (DDRA). The Western Design Center The W65C21S PIA is organized into two independent sections referred to as the A Side and the B Side. Each section consists of Control Register (CRA, CRB), Data Direction Register (DDRA, DDRB), Output Register (ORA, ORB), Interrupt Status Control (ISCA, ISCB) and the buffers necessary to drive the Peripheral Interface buses. Data Bus Buffers (DBB) interface data from the two sections to the data bus, while the Date Input Register (DIR) interfaces data from the DBB to the PIA registers. Chip Select and RWB control circuitry interface to the processor bus control lines. Figure 3 is a block diagram of the W65C21S PIA. CONTROL REGISTERS (CRA AND CRB) Table 1 illustrates the bit designation and functions in the two control registers. The individual control registers allow the microprocessor to control the operation of the Interrupt Control inputs (CA1, CA2, CB1, CB2), and Peripheral Control outputs (CA2, CB2). Bit 2 in each register controls the addressing of the Data Direction Registers (DDRA, DDRB) and the Output Registers (ORA, ORB). In addition, two bits (bit 6 and 7) in each control register indicate the status of the Interrupt Status Control input lines (CA1, CA2, CB1, CB2). These Interrupt Status bits (IRQA1, IRQA2 or W65C21S 10 The Western Design Center, Inc. W65C21S Data Sheet IRQB1, IRQB2) are normally interrogated by the microprocessor during the interrupt service routine to determine the source of an active interrupt. These two interrupt lines drive the interrupt input (IRQB or NMIB) of the microprocessor. CA1 is an interrupt input only. An active transition of the signal on this input will set bit 7 of the Control Register A to a logic 1. The active transition can be programmed by setting a “0” in bit 1 of the CRA if the interrupt flag (bit7 of CRA) is to be set on a negative transition of the CA1 signal or a “1” if it is to be set on a positive transition DATA BUS BUFFERS (DBB) The Data Bus Buffers are 8-bit bidirectional buffers used for data exchange, on the D0-D7 Data Bus, between the microprocessor and the PIA. These buffers are tri-state and are capable of driving a two TTL load (when operating in an output mode. DATA DIRECTION REGISTERS (DDRA, DDRB) The Data Direction Registers (DDRA, DDRB) allow the processor to program each line in the 8-bit Peripheral I/O port to be either an input or an output. Each bit in DDRA controls the corresponding line in the Peripheral A port and each bit in DDRB controls the corresponding line in the Peripheral B port. Writing a “0” in a bit position in the Data Direction Register causes the corresponding Peripheral I/O line to act as in input; a “1” results in the line being an output. Bit 2 (DDRA, DDRB) in each Control Register (CRA and CRB) controls the accessing to the Data Direction Register or the Peripheral interface. If bit 2 is a “1”, a Peripheral Output register (ORA, ORB) is selected, and if bit 2 is a “0”, a Data Direction Register (DDRA, DDRB) is selected. The Data Direction Register Access Control bit, together with the Register Select lines (RS0, RS1) selects the various internal registers as shown in Table 2. In order to write data into DDRA, ORA, DDRB or ORB registers, bit 2 in the proper Control Register must first be set. The desired register may then be accessed with the address determined by the address interconnect technique used. DATA INPUT REGISTER (DIR) During a Write data operation, the microprocessor writes data into the W65C21S by placing data on the Data Bus. This data is then latched into the Data Input Register by the Phase Two (PHI2) clock. Once in the DIR, this data byte is transferred into one of six internal registers. This data transfer occurs after the trailing edge of the PHI2 clock pulse that latched the data into the DIR. This timing delay guarantees the data on the peripheral output lines (PA or PB) will make a smooth transition from low to high or high to low, and the output voltage will remain stable when there is to be no change in polarity. INTERRUPT INPUT/PERIPHERAL CONTROL LINES (CA1, CA2, CB1, CB2) The four interrupt input/peripheral control lines provide a number of special control functions. These lines greatly enhance the power of the two general purpose interface ports (PA0-PA7, PB0-PB7). Figure 5 summarizes the operation of these control lines. The Western Design Center NOTE: A negative transition is defined as a transition from a high to a low and a positive transition is defined as a transition from a low to a high voltage. CA2 can act as a totally independent interrupt or as a peripheral control output. As an input (CRA, bit 5=0) it acts to set the interrupt flag, bit 6 of CRA, to a logic on 1 on the active transition selected by bit 4 of CRA. These control register bits and interrupt inputs serve the same basic function as that described above for CA1. The input signal sets the interrupt flag which serves as the link between the peripheral device and the processor interrupt structure. The interrupt disable bits allows the processor to exercise control over the system interrupt. In the output mode (CRA, bit 5=1), CA2 can operate independently to generate a simple pulse each time the microprocessor is selected by setting CRA bit 4 to a 0 and CRA bit 3 to a 1. This pulse output can be used to control the counters, shift registers, etc., which make sequential data available on the Peripheral input lines. A second output mode allows CA2 to be used in conjunction with CA1 to “handshake” between the processor and the peripheral device. On the A side, this technique allows positive control of data transfers from the peripheral device into the microprocessor. The CA1 input signals the processor that data is available by interrupting the processor. The processor reads the data and sets CA2 low. This signals the peripheral device that it can make new data available. The final output mode can be selected by setting bit 4 of CRA to a 1. In this mode, CA2 is a simple peripheral control output that can be set high or low by setting bit 3 of CRA to a 1 or a 0 respectively. CB1 operates as an interrupt input only in the same manner as CA1. Bit 7 of CRB is set by the active transition selected by bit 0 of CRB. Likewise, the CB2 input mode operates exactly the same as the CA2 input modes. The CB2 output modes, CRB bit 5=1, differ somewhat from those of CA2. The pulse output occurs when the processor writes data into the Peripheral B Output Register. Also, the “handshaking” operates on data transfers from the processor into the peripheral device. INTERRUPT REQUEST (IRQAB, IRQBB) The active low Interrupt Request lines (IRQAB and IRQBB) act to interrupt the microprocessor either directly or through external interrupt priority circuitry. These lines are open drain and are capable of sinking 3.2 milliamps from an external source. This permits all interrupt request lines to be tied together in a wired OR configuration. The A and B in the titles of these lines correspond to the peripheral port B so W65C21S 11 The Western Design Center, Inc. W65C21S Data Sheet that each interrupt request line services one peripheral data port. Each interrupt Request line has two interrupt flag bits that can cause the Interrupt Request line to go low. These flags are bits 6 and 7 in the two Control Registers (CRA, CRB). These flags act as the link between the peripheral interrupt signals and the microprocessor interrupt inputs. Each flag has a corresponding interrupt disable bit which allows the processor to enable or disable the interrupt from each of the four interrupt inputs (CA1, CA2, CB1, CB2) The four interrupt flags are set (enabled) by active transitions of the signal on the interrupt input (CA1, CA2, CB1, CB2). CRA bit 7 (IRQA1) is always set an active transition of the CA1 interrupt input signal. However, IRQAB can be disabled by setting bit 0 in CRA to a 0. Likewise, CRA bit 6 (IRQA2) can be set by an active transition of the CA2 interrupt input signal and IRQAB can be disabled by setting bit 3 in CRA to a 0. Both bit 6 and bit 7 in CRA are reset by a “Read Peripheral Output Register A” operation. This is defined as an operation in which the read/write, proper data direction register and register select signals are provided to allow the processor to read the Peripheral A I/O port. A summary of IRQA control is shown in Table 3. Control of IRQBB is performed in exactly the same manner as that described above for IRQAB. Bit 7 in CRB (IRQB1) is set by an active transition on CB1 and IRQBB from this flag is controlled by CRB bit 0. Likewise, bit 6 (IRQB2) in CRB is set by an active transition on CB2 and IRQBB from this flag is controlled by CRB bit 3. Also both bit 6 and bit 7 of CRB are reset by a “Read Peripheral B Output Register” operation. A summary of IRQBB control is shown in Table 3. INTERRUPT STATUS CONTROL LOGIC (ISCA, ISCB) The four interrupt/peripheral control lines CA1, CA2, CB1, CB2) are controlled by the Interrupt Status Control logic (A, B). This logic interprets the contents of the corresponding Control Register, thus allowing these lines to perform various control functions as described in Figure 5. PERIPHERAL I/O PORTS (PA0-PA7, PB0-PB7) The Peripheral A and Peripheral B I/O ports allow the microprocessor to interface to the input lines on a peripheral device by writing data into the Peripheral Output Register. They also allow the processor to interface with a peripheral device’s output lines by reading the data on the Peripheral Port input lines directly onto the data bus and into the internal registers of the processor. Each of the peripheral I/O lines can be programmed to act as an input or an output. This is accomplished by setting a 1 in the corresponding bit in the Data Direction Register for those The Western Design Center lines that are to act as outputs. A 0 in a bit of the Data Direction Register causes the corresponding Peripheral I/O lines to act as an input. The buffers that drive the Peripheral A I/O lines each contain two active pull-up transistors and one active pull-down transistor. The pull-up transistors are resistive in nature and therefore allow the output voltage to go to VCC for logic 1. The pull down transistors can sink a full 3.2 mA, making these buffers capable of driving two standard TTL loads. In the input mode, the input pull-up transistors are connected to the I/O pin and will supply enough current (100uA minimum) to drive one standard TTL load. When in the output mode Port A can drive with similar current as the Port B buffers and can be thought of as pushpull buffers. If Port A is clamped below 2.0V for a logic 1 or above .8V for a logic 0 the data read during a read operation may not correspond to the value wrote to the output registers. This is a difference between the Port A buffers and the Port B buffers and also is a difference with older versions of the PIA. The Peripheral B I/O port duplicates many of the functions of the Peripheral A port. The process of programming these lines to act as an input or an output is similar to the Peripheral A port, as is the effect of reading or writing this port. However, there are several characteristics of the buffers driving these lines that affect their use in peripheral interfacing. The Peripheral B I/O buffers are push-pull devices, i.e., the pull-up devices are switched OFF in the 0 state and ON for a logic 1. Since these pull-ups are active devices, the logic 1 voltage will go to the VDD power supply level. Another difference between the PA0-PA7 lines and the PBO through PB7 lines is that they have three-state capability which allows them to enter a high impedance state when programmed to be used as input lines. In addition, data on these lines will be read properly, when programmed as output lines, even if the data signals fall below 2.0 volts for a “high” state or are above 0.8 volts for a “low” state. When programmed as output, each line can drive at least two TTL load and may also be used as a source of up to 3.2 mA at 1.5 volts to directly drive the base of a transistor switch, such as a Darlington pair. A limiting resistor should be used to prevent excessive current when clamping an output on the PIA. Because these outputs are designed to drive transistors directly, the output data is read directly from the Peripheral Output Register for those lines programmed to act as inputs. The final characteristic is the high-impedance input state which is a function of the Peripheral B push-pull buffers. When the Peripheral B I/O lines are programmed to act as inputs, the output buffer enters the high impedance state. All pins are read when in the input mode. PERIPHERAL OUTPUT REGISTERS (ORA, ORB) W65C21S 12 The Western Design Center, Inc. W65C21S Data Sheet All output data to a peripheral is stored in the corresponding Output Register (ORA or IRB). This data is then presented to the Peripheral Interface Buffer (A and B) and placed on the respective I/O. Port lines. Writing a “0” into any bit position of ORA or ORB results in the corresponding peripheral I/O Port line going low (<0.4V), providing that particular line is programmed as an output. Writing a “1” into a bit position results in the corresponding output going high. READING THE PERIPHERAL PORT Performing a Read operation with RS1=0, RS0=0 and the Data Direction Register Access Control bit (CRA-2) = 1, directly transfers the data on the Peripheral A I/O lines to the data bus. In this situation, the data bus will contain both directly transfers the data on the Peripheral A I/O lines to the data bus. In this situation, the data bus will contain both the input and output data. The processor must be programmed to recognize and interpret only those bits which are important to particular peripheral operation being performed. Since the processor always reads the Peripheral A I/O port pins instead of the actual Peripheral Output Register (ORA), it is possible for the data read by the processor to differ from the contents of the Peripheral Output Register for an output line. This is true when the I/O pin is not allowed to go to a full +2.4V DC when the Peripheral Output register contains a logic 1. In this case, the processor will read a 0 from the Peripheral A pin, even though the corresponding bit in the Peripheral Output register is a 1. The two Register Select lines (RS0, RS1), in conjunction with the Control Registers (CRA, CRB) Data Direction Register access bits (see table 1, bit 2) select the various W65C21S registers to be accessed by the CPU, RS0 and RS1 are normally connected to the microprocessor (CPU) address output lines. Through control of these lines, the CPU can write directly into the Control Registers (CRA, CRB) the Data Direction Registers (DDRA, DDRB) and the Peripheral Output Registers (ORA, ORB) in addition, the microprocessor may directly read the contents of the Control Registers and the Data Direction Registers. Accessing the Peripheral Output Register for the purpose of reading data back into the processor operates differently on the ORA and the ORB registers and therefore is shown separately in Table 2. CROSS REFERENCE GUIDE The W65C21S is a replacement part for older PIA devices, but has several variations. The Port A input buffers supply 1 TTL load pull-up current (100uA) at 2.4V when in the input mode and can supply the same drive current as the Port B buffers when in the output mode. A current limiting resistor should be used on the peripheral port pins (PA0-PA7 and PB0-PB7) when clamping an output. READING THE PERIPHERAL B I/O PORT Reading the Peripheral B I/O port yields a combination of input and output data in a manner similar to the Peripheral A port. However, data is read directly from the Peripheral B Output Register (ORB) for this lines programmed to act as outputs. It is therefore possible to load down the Peripheral B Output lines without causing incorrect data to be transferred back to the processor or Read operation. REGISTER ACCESS AND SELECTION The Western Design Center W65C21S 13 The Western Design Center, Inc. W65C21S Data Sheet CA1/CB1 CONTROL CRA (CRB) BIT 1 BIT 0 0 0 0 1 1 1 ACTIVE TRANSITION OF INPUT SIGNAL* Negative Negative 0 1 Positive Positive IRQAB (IRQBB) INTERRUPT OUTPUTS Disable – remains high Enable – goes low when bit 7 in CRA (CRB) is set by active transition of signal on CA1 (CB1) Disable – remains high Enable – as explained above *Note: Bit 7 of CRA (CRB) will be set to a Logic 1 by an active transition of the CA1 (CB1) signal. This is independent of the state of bit 0 in CRA (CRB). CA2/CB2 INPUT MODES CRA (CRB) BIT 5 BIT 4 BIT 3 0 0 0 0 0 1 0 0 1 1 ACTIVE TRANSITION OF INPUT SIGNAL* Negative Negative 0 1 Positive Positive IRQAB (IRQBB) INTERRUPT OUTPUTS Disable – remains high Enable – goes low when bit 6 in CRA (CRB) is set by active transition of signal on CA2 (CB2) Disable – remains high Enable – as explained above *Note: Bit 6 of CRA (CRB) will be set to a Logic 1 by an active transition of the CA2 (CB2) signal. This is independent of the state of bit 0 in CRA (CRB). CA2 OUTPUT MODES CRA (CRB) BIT 5 BIT 4 BIT 3 1 0 0 ACTIVE TRANSITION OF INPUT SIGNAL* “Handshake on Read” 1 0 1 Pulse Output 1 1 1 1 0 1 Manual Output Manual Output IRQAB (IRQBB) INTERRUPT OUTPUTS CA2 is set high on ac active transition of the CA1 interrupt input signal and set low by a microprocessor “Read A Data” operation. This allows positive control of data transfers from the peripheral device to the microprocessor. CA2 goes low for one cycle after a microprocessor “Read A Data” operation. This pulse can be used to signal the peripheral device that data was taken. CA2 set low CA2 set high CB2 OUTPUT MODES CRA (CRB) BIT 5 BIT 4 BIT 3 1 0 0 ACTIVE TRANSITION OF INPUT SIGNAL* “Handshake on Read” 1 0 1 Pulse Output 1 1 1 1 0 1 Manual Output Manual Output IRQAB (IRQBB) INTERRUPT OUTPUTS CB2 is set low on microprocessor “Write B Data” and is set high by an active transition of the CB1 input signal. This allows positive control of data transfers from the microprocessor to the peripheral device. CB2 goes low for one cycle after a microprocessor “Write B Data” operation. This can be used to signal the peripheral device that data is available. CB2 set low CB2 set high Table 3. Interrupt Input/Peripheral Control Line Operation. The Western Design Center W65C21S 14 The Western Design Center, Inc. W65C21S Data Sheet B A J C H L G E D M F K SEATING PLANE 40 PIN PLASTIC PACKAGE DIM MILLIMETERS INCHES MIN MAX MIN MAX A 51.69 52.45 2.035 2.065 B 13.72 14.22 0.540 0.560 C 3.94 5.08 0.155 0.200 D 0.36 0.56 0.014 0.022 E 1.02 1.52 0.040 0.060 F 2.54 TYP 0.100 TYP G 1.65 2.16 0.065 0.085 H 0.20 0.38 0.008 0.015 J 15.24 TYP 0.600 TYP L 0.51 1.02 0.020 0.040 M 2.92 3.43 0.115 0.135 K Figure 11. Package Dimensions 40-Pin Plastic Dip The Western Design Center W65C21S 15 The Western Design Center, Inc. W65C21S Data Sheet ORDERING INFORMATION W65C21S6TPLG-14 W65C Description W65C = standard product 21S Product Identification Number Foundry Process 6T = 0.6u TSMC Process 6T Package P = Plastic Dual-In-Line, 40 pins PL = Plastic Leaded Chip Carrier, 44 pins PL RoHS/Green Compliance G = RoHS/Green Compliant (Wafer and Packaging) G Speed Designator -14 = 14MHz -14 ____________________________________________________________________________________ To receive general sales or technical support on standard product or information about our module library licenses, contact us at: The Western Design Center, Inc. 2166 East Brown Road Mesa, Arizona 85213 USA Phone: 480-962-4545 Fax: 480-835-6442 e-mail: [email protected] www.westerndesigncenter.com _______________________________________________________________________________________ WARNING: MOS CIRCUITS ARE SUBJECT TO DAMAGE FROM STATIC ELECTRICAL CHARGE BUILDUPS. Industry established recommendations for handling MOS circuits include: 1. 2. 3. Ship and store product in conductive shipping tubes or conductive foam plastic. Never ship or store product in non-conductive plastic containers or non-conductive plastic foam material. Handle MOS parts only at conductive workstations. Ground all assembly and repair tools. The Western Design Center W65C21S 16