Dan Moos wrote:
I have CA1 set to "pulse".
It seems to pulse on any read or write to any register in the chip. I had expected it would only pulse on a read or write to PORT A.
This is normal, or am I missing something? Seems like this would cause mayhem. Say my peripheral is waiting for a handshake pulse after sending data to PORT A, and some unrelated activity on PORT B pulses it prematurely?
I get the feeling you're implementing Daryl's AVR PC keyboard controller... or basically the same thing.
According to the W65C22 datasheet, Port A would be the better port to use for handshaking with the keyboard controller. Sections 2.1 thru 2.4 cover the handshaking capabilities.
The keyboard controller should trigger the CA1 line when it has data to be sent to the 6522. This (when correctly configured) would generate an interrupt to the processor. The interrupt service routine would then poll the 6522, figure out what generated the interrupt and then read Port A and get the data. CA2, if properly configured, would automatically respond by generating a pulse or simply toggling the line after the data is read from Port A. This saves some additional coding to send a data taken response back (to the keyboard controller).
Obviously, you need an interrupt service routine for all of this to work. Once you have the AVR keyboard controller working, it shouldn't be too difficult to get it working with Port A. The CA1 line is used as an input from the keyboard controller and the CA2 line is used as the handshake line back to the keyboard controller.
Current status/code?