R6522 Versatile Interface Adapter (VIA) HANDSHAKE CONTROL OF DATA TRANSFERS The R6522 allows positive control of data transfers between the system processor and peripheral devices through the operation of “handshake” tines. Port A lines (CA1, CA2) handshake data on both a read and a write operation while the Port B lines (CB1, CB2) handshake on a write operation only. Read Handshake Positive control of data transfers from peripheral devices into the system processor can be accomplished very effectively using Read Handshaking. in this case, the peripheral device must generate the equivaient of a ‘Data Ready’ signa! to the processor signifying that valid data is present on the peripheral REG 0—ORB/IRB biti Ph ye T OUTPUT REGISTER res] +B" (ORB) OR | esel INPUT REGISTER res| ““B™ (IRB) liad DATA RECTION WRITE READ GELECTION DRAB ~ “OUTPUT NOL WHITES OUTPUT LEVEL | MPU READS OUTPUT REGISTER {ORB} GIT IN ORB PIN LEVEL HAS NO AFFECT QORB « “0" RNPLT) MPU WRITES INTO OAS. BUT |] MPU READS INPUT LEVE, ON PB {HPUT LATCHING DISABLED NO EFFECT ON PIN LEVEL. | min UNTIL. DDAR CHANGED ODRB = “O° INPUT) MPU READS (RB BT, WHICH IG THE {ONPUT LATCHING ENABLED) LEVEL OF THE PB PIN AT THE THE OH SHE LAST CBI ACTIVE TRANSITION Figure 5. Output Register B (ORB), Input Register B (IRB) REG 2—DORB TsisheP it te t i——— pao 7 Par PR? ra. | «DATA DIRECTION vsaras] REGISTER ‘'8"’ (DDRB) PBS PAS PRE PAG Pe7 FAT] “O° ASSOCIATED PB PIN IS AN INPUT (HIGH IMPEDANCE} “s" ASSOCIATED PB PIN iS AN OUTPUT WHOSE LEVEL iS DETERMINED BY ORS REGISTER BIT Figure 7. Data Direction Register B (ODRB) port. This signal normally interrupts the processor, which then reads the data, causing generation of a “Data Taken” signal. The peripheral device responds by making new data available. This process continues until the data transfer is complete. In the R6522, automatic “‘Read” Handshaking is possible on the Peripherat A port only. The CA1 interrupt input pin accepts the “Data Ready” signal and CA2 generates the ‘‘Data Taken’’ signal. Fhe “Data Ready” signal will set an internal flag which may interrupt the processor or which may be polled under pro- gram control. The “Data Taken" signal can either be a pulse or a tevel which is set fow by the system processor and is cleared by the “Data Ready” signal. These options are shown in Figure 9 which ilfustrates the normal Read Handshake sequence. REG 1—ORAARA 7 sjslefafatrfof Le pad] PAY ommend PAZ OUTPUT REGISTER pa3| A’ (ORA) OR rsa, (INPUT REGISTER ras} “A (IRA) Pas ar] Poe DATA DHRECTION WHITE. READ SELECTION DOA © “1° OUTPUT) MPU WRITES OUTPUT LEVEL | MPU READS LEVEL ON PA Pin AINPUT LATCHING OFSABLED) (Ona) Lereanmnnnnnn nani anit tetaniannteneemend DDRA © “S° (OUTPUT) (PU READS IRA BIT WHICH IS THE BNPUT LATOMING ENAQLEDS LEVEL OF THE PA PIN AT THE TIME OF THE LAST CA ACTIVE TRANSITION SAA a “O" PNIST} MEU WHITES INTO ORA SUT | MPU READS LEVEL ON PA BN (RWPUT LATCHING DYEABLEO) NO EFFECT ON PIN LEVEL. DDRA = “O° UHPUT MPU PEADS ABT WHICH IS THE QNPUT LATCHENG ERARLED) LEVEL OF THE 94 Pin AY THE Te OF THE LAST CA} ACTIVE TRANSITION Figure 6. Output Register A (ORA), Input Register A (IRA) REG3—DDRA CEETELTL Pag] bee Pay Pa2 Huon 431 DATA DIRECTION Leas! REGISTER A" (DDRA) PAS o PAG PAT] “O" ASSOCIATED PA PIN IS AN INPUT (HIGH IMPEDANCE) “" ASSOCIATED PA PIN 16 AN OUTPUT WHO6GE LEVEL IS DETERMINED AY ORA REGISTER BIT Figure &. Data Direction Register A (DDRA)