1 |
2 |
robfinch |
# via6522x12
|
2 |
|
|
(C) 2022 Robert Finch
|
3 |
|
|
|
4 |
|
|
## Overview
|
5 |
|
|
The via6522x12 is a versatile interface adapter 12-bit peripheral core that is register compatible with a 6522.
|
6 |
|
|
The core may also be configured for eight bit operation.
|
7 |
|
|
## Features
|
8 |
|
|
* 2 12-bit ports
|
9 |
|
|
* 3 24-bit timers
|
10 |
|
|
* 1 12-bit shift register
|
11 |
|
|
## Registers
|
12 |
|
|
|Reg |Bits|Moniker| Description | Comment |
|
13 |
|
|
|----|----|-------|------------------------|----------------|
|
14 |
|
|
| 00 | 12 | PB | Port B I/O | |
|
15 |
|
|
| 01 | 12 | PA | Port A I/O | handshaking |
|
16 |
|
|
| 02 | 12 | PBDDR | Port B data direction | |
|
17 |
|
|
| 03 | 12 | PADDR | Port A data direction | |
|
18 |
|
|
| 04 | 12 | T1CL | Time 1 count low | |
|
19 |
|
|
| 05 | 12 | T1CH | Time 1 count high | |
|
20 |
|
|
| 06 | 12 | T1LL | Time 1 latch low | |
|
21 |
|
|
| 07 | 12 | T1LH | Time 1 latch high | |
|
22 |
|
|
| 08 | 12 | T2CL | Time 2 count low | |
|
23 |
|
|
| 09 | 12 | T2CH | Time 2 count high | |
|
24 |
|
|
| 10 | 12 | SR | Shift register | |
|
25 |
|
|
| 11 | 12 | ACR | Auxillary control reg | |
|
26 |
|
|
| 12 | 12 | PCR | Peripheral control reg | |
|
27 |
|
|
| 13 | 12 | IFR | Interrupt flag reg | |
|
28 |
|
|
| 14 | 12 | IER | Interrupt enable reg | |
|
29 |
|
|
| 15 | 12 | PA | Port A I/O | no-handshaking |
|
30 |
|
|
| 16 | 12 | T3CL | Timer 3 count low | |
|
31 |
|
|
| 17 | 12 | T3CH | Timer 3 count high | |
|
32 |
|
|
| 18 | 12 | T3LL | Timer 3 latch low | |
|
33 |
|
|
| 19 | 12 | T3LH | Timer 3 latch high | |
|
34 |
|
|
| 20 | 12 | T3CMPL| Timer 3 compare low | |
|
35 |
|
|
| 21 | 12 | T3CMPH| Timer 3 compare high | |
|
36 |
|
|
|
37 |
|
|
### PB (Reg 00)
|
38 |
|
|
Operates in the same manner as the 6522 port B but is 12-bits wide rather than 8-bits. If port B input latching is enabled, then input data on port B is latched by an active transition of the selected handshaking signal. Otherwise input data is reflected directly by reading the port register.
|
39 |
|
|
### PA (Reg 01)
|
40 |
|
|
Operates in the same manner as the 6522 port A but is 12-bits wide rather than 8-bits. If port A input latching is enabled, then input data on port A is latched by an active transition of the selected handshaking signal. Otherwise input data is reflected directly by reading the port register.
|
41 |
|
|
### PBDDR (Reg 02)
|
42 |
|
|
Operates in the same manner as the 6522 port B ddr but is 12-bits wide rather than 8-bits. Each bit that is set in this register set the corresponding port B I/O to an output. Each bit that is clear in this register sets the port B I/O to an input. The default value in this register at reset is zero, making all port B I/O’s inputs.
|
43 |
|
|
### PADDR (Reg 03)
|
44 |
|
|
Operates in the same manner as the 6522 port A ddr but is 12-bits wide rather than 8-bits. Each bit that is set in this register set the corresponding port A I/O to an output. Each bit that is clear in this register sets the port A I/O to an input. The default value in this register at reset is zero, making all port A I/O’s inputs.
|
45 |
|
|
### T1CL (Reg 04)
|
46 |
|
|
Similar function to the reg 4 of the 6522. Provides read access to the low order 12-bits of timer 1. Acts as a latch for the low 12-bits of the value to be loaded into the timer.
|
47 |
|
|
### T1CH (Reg 05)
|
48 |
|
|
Similar in function to register 5 of the 6522. When the timer is in 24-bit mode writing this register transfers bit 0 to 11 of the timer 1 latch to bits 0 to 11 of the timer and transfers input data bits 0 to 11 to counter bits 12 to 23 of the timer.
|
49 |
|
|
### T1LL (Reg 06)
|
50 |
|
|
Similar in function to register 6 of the 6522. Provides access to the timer 1 low order latches.
|
51 |
|
|
### T1LH (Reg 07)
|
52 |
|
|
Similar in function to register 7 of the 6522. Provides access to the timer 1 high order latches.
|
53 |
|
|
### T2CL (Reg 08)
|
54 |
|
|
Similar in function to register 8 of the 6522. Provides access to timer 2 low order latch / count.
|
55 |
|
|
### T2CH (Reg 09)
|
56 |
|
|
Similar in function to register 9 of the 6522. Provides access to timer 2 high order latch / count.
|
57 |
|
|
### SR (Reg 10)
|
58 |
|
|
Similar in function to register 10 of the 6522. The shift register is 12-bits wide.
|
59 |
|
|
### ACR (Reg 11)
|
60 |
|
|
| Bits | Function |
|
61 |
|
|
|------|--------------------------------------|
|
62 |
|
|
| 0 | port A input latch enable |
|
63 |
|
|
| 1 | port B input latch enable |
|
64 |
|
|
| 2-4 | shift register mode |
|
65 |
|
|
| 5 | timer #2 mode |
|
66 |
|
|
| 6-7 | timer #1 mode |
|
67 |
|
|
| 8 | timer #3 mode |
|
68 |
|
|
### PCR (Reg 12)
|
69 |
|
|
| Bits | Function |
|
70 |
|
|
|------|--------------------------------------|
|
71 |
|
|
| 0 | CA1 mode |
|
72 |
|
|
| 1-3 | CA2 mode |
|
73 |
|
|
| 4 | CB1 mode |
|
74 |
|
|
| 5-7 | CB2 mode |
|
75 |
|
|
### IFR (Reg 13)
|
76 |
|
|
| Bits | Function |
|
77 |
|
|
|------|--------------------------------------|
|
78 |
|
|
| 0 | CA2 active transition |
|
79 |
|
|
| 1 | CA1 active transition |
|
80 |
|
|
| 2 | shift register |
|
81 |
|
|
| 3 | CB2 active transition |
|
82 |
|
|
| 4 | CB1 active transition |
|
83 |
|
|
| 5 | Timer #1 underflow |
|
84 |
|
|
| 6 | Timer #2 underflow |
|
85 |
|
|
| 7 | Timer #3 compare |
|
86 |
|
|
| 8-10 | reserved |
|
87 |
|
|
| 11 | Set if any interrupt is present |
|
88 |
|
|
### IER (Reg 14)
|
89 |
|
|
| Bits | Function |
|
90 |
|
|
|------|--------------------------------------|
|
91 |
|
|
| 0 | CA2 active transition |
|
92 |
|
|
| 1 | CA1 active transition |
|
93 |
|
|
| 2 | shift register |
|
94 |
|
|
| 3 | CB2 active transition |
|
95 |
|
|
| 4 | CB1 active transition |
|
96 |
|
|
| 5 | Timer #1 underflow |
|
97 |
|
|
| 6 | Timer #2 underflow |
|
98 |
|
|
| 7 | Set if any interrupt is present |
|
99 |
|
|
| 8 | Timer #3 compare |
|
100 |
|
|
| 9-10 | reserved |
|
101 |
|
|
### PA (Reg 15)
|
102 |
|
|
This is an alias to access port A except no handshaking is present.
|
103 |
|
|
### T3CL (Reg 16)
|
104 |
|
|
Provides read access to the low order 12-bits of timer 3. Acts as a latch for the low 12-bits of the value to be loaded into the timer.
|
105 |
|
|
### T3CH (Reg 17)
|
106 |
|
|
Writing this register transfers bit 0 to 11 of the timer 3 latch to bits 0 to 11 of the timer and transfers input data bits 0 to 11 to counter bits 12 to 23 of the timer.
|
107 |
|
|
### T3LL (Reg 18)
|
108 |
|
|
Provides access to the timer 1 low order latches.
|
109 |
|
|
### T3LH (Reg 19)
|
110 |
|
|
Provides access to the timer 3 high order latches.
|
111 |
|
|
### T3CMPL (Reg 20)
|
112 |
|
|
Contains the low order 12 bits of a comparison value that will cause an interrupt flag to be set if timer #3 exceeds this value.
|
113 |
|
|
### T3CMPH (Reg 21)
|
114 |
|
|
Contains the high order 12 bits of the comparison value.
|
115 |
|
|
|
116 |
|
|
## Key Differences from a 6522
|
117 |
|
|
The reset input (rst_i) is active high.
|
118 |
|
|
The IRQ output (irq_o) is not open collector and is active high.
|
119 |
|
|
There is only a single active high circuit select (cs_i).
|
120 |
|
|
|
121 |
|
|
## Software Examples
|
122 |
|
|
The via6522x12 is being used for timing and gpio in a 12-bit 6809 test system.
|