R6522 Versatile Interface Adapter (VIA) SHIFT REGISTER OPERATION The Shift Register (SR) performs serial data transfers into and out of the CB2 pin under control af an internal modulo-8 counter. Seriat data transfer in and out of the Shift Register (SR) begin with the most significant bit (MSB) first. Shift pulses can be applied to the CB1 pin from an external source or, with the proper mode selection, shift pulses generated internally will appear on the CB pin for contralling external devices. The control bits which select the various shift register operating modes are located in the Auxiliary Control Register. Figure 20 illustrates the contiguration of the SR data bits and Figure 21 shows the SR control bits of the ACR. SR Mode 0 — Shift Register interrupt Disabied Mode 0 disables the Shift Register interrupt. In this mode the microprocessor can write or read the SR and the SR will shift on each CB! positive edge shifting in the value on CB2. In this mode the SR interrupt Flag is disabled (held to a logic 0). SR Mode 1 — Shift In Under Control! of T2 In mode 1. the shifting rate is controlled by the low order 8 bits of T2 (Figure 22). Shift pulses are generated on the CB1 pin to control shifting in external devices. The time between transitions of this output clock is a function of the system clock period and the contents of the low order T2 latch (NN). The shifting operation is triggered by the read or write of the SR if the SR flag is set in the IFR. Otherwise the first shift will occur at the next time-out of T2 after a read or write of the SR. The input data should change before the positive-going edge of CB clock pulse. This data is shifted into the shift register during the $2 clock cycle following the positive-going edge of the CBI clock pulse. The minimum CB! positive pulse width must be one clock period. After 8 CB1 clock pulses, the shift register interrupt flag will set and IRQ will go low. SR Mode 2 — Shift In Under 02 Control In mode 2, the shift rate is a direct function of the system clock frequency (Figure 23). CB1 becomes an output which generates shilt pulses for controlling external devices. Timer 2 operates as an independent interval timer and has no effect on SR. The shifting operation is triggered by reading or writing the Shift Register. Data is shifted, first into bit O and is then shifted into the next higher order bit of the shift register on the trailing edge of each $2 clock pulse. After 8 clock pulses, the shift register interrupt flag will be set, and the output clock pulses on CBI will stop. REG 10—SHIFT REGISTER REG 11~AUXILIARY CONTROL REGISTER r{els{sts}2[>fe slelslatalolite i { | | | ITT, Ka SHIFT | smer REGISTER - REGISTER MODE CONTROL BITS 4\3]2l orenation Tlolol osaBLeD Ofo] 3] SwrT iw UNDER CONTROL OF 72 Of} [0] SHIFT IN UNDER CONTAOL OF 12 NOTES: ~ 011] 1] SHIFT tw UNDER CONTROL OF EXT CLK 1. WHEN SHIFTING OUT, BIT 7 'S THE FIRST BIT LAO 10) SHIFT OUT FREE-RUNNING AT 12 RATE OUT AND SIMUL TANEOUSLY 1S ROTATED BACK tot] SHiet OUT UNDER CONTROL OF 12 INTO BITS. 1] 1 fof SHiFT OUT UNDER CONTROL OF t2 FT a Ate ae eeD TOWANIG nae” T[ +1] SHIFT QUT UNDER CONTROL OF EXT CLK Figure 20. Shift Register Figure 21. Shift Register Modes 2 WRITE OR READ SHIFT REG PL | fb N + 2 CYCLES jo ----rie-----»N al if CB1 OUTPUT > jp 1 i SHIFT CLOCK = Lz Ls Lad CB2 INPUT TOI ne DATA CG, ve Figure 22. SR Mode 1 — Shift In Under T2 Control