I wrote a rather lengthy response to the four questions you posted originally, but in the amount of time I took to write it, I guess my ISP cut me off and I lost it all when I tried to post.
The 6522's name, versatile interface adapter, is quite appropriate. It has two 8-bit parallel ports with each bit able to be either an input or an output, independently of the others, handshaking bits with different modes of operation, two timers, again with different modes of operation, a synchronous serial port, again with (you guessed it), several modes of operation, seven interrupt sources, plus some other attractions. The 6522 is used in other systems besides just 65k systems. For example, I've seen it in 68000 systems, and my EPROM programmer that plugs into the PC's backplane uses them.
On my workbench computer, I use just one of the VIAs for interfacing the printer port, LCD, keypad, beeper, and synchronous serial line, and I use one of the timers for the software real-time clock. In addition, the synchronous serial line can be connected to hundreds of bits of input or output through daisy-chained shift registers (which I did in some automated test equipment I made in 1991-1992).
To try to answer the questions as you originally posted them:
1: If you run one of the timers off the phase 2 system clock, it will roll over in a maximum of just a fraction of a second. For what you want to do, you can either cascade the timers, clock a timer with a slower external clock, or most practical, have it interrupt every time it times out, and then have the interrupt service routine (ISR) increment a variable in RAM, and activate the pump when the variable reaches the desired value.
2: Since you can control how you work the VIA's I/O bits, you can select the external devices however you wish. For the processor to select the VIA however, the VIA has a couple of chip-select lines that would be fed by the address-decoding logic, plus four register-select lines to select which of the 16 registers you want to access inside the VIA.
3: Yes, each I/O line of the VIA can go to something different and unrelated.
4: I'm not sure I understand the question, but really the only relevant priority issue would be with interrupts, and you can sort those out by polling in software. The interrupt flag register (IFR) has a bit for each possible interrupt source. In real-life situations, polling is not as big a job as you might think.
_________________ http://WilsonMinesCo.com/ lots of 6502 resources The "second front page" is http://wilsonminesco.com/links.html . What's an additional VIA among friends, anyhow?
|