AVR as UART/ACIA IC
-
clockpulse
- Posts: 87
- Joined: 20 Oct 2012
- Location: San Diego
Re: AVR as UART/ACIA IC
Just another possible idea for using an AVR without using RDY or a VIA interface.
The main problem it seems is the delay of the AVR Data Direction Register since it has to be controlled in software.
If 2 AVR ports were used, 1 port set for input and 1 port set for output then the S/W delay of port I/O switching is removed.
The AVR output port would need a tri-state buffer between the 6502.
Any thoughts?
The main problem it seems is the delay of the AVR Data Direction Register since it has to be controlled in software.
If 2 AVR ports were used, 1 port set for input and 1 port set for output then the S/W delay of port I/O switching is removed.
The AVR output port would need a tri-state buffer between the 6502.
Any thoughts?
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: AVR as UART/ACIA IC
jmp(FFFA), to reply without quoting everything:
There's a performance comparison at http://westerndesigncenter.com/wdc/AN-0 ... risons.cfm . The Sieve of Eratosthenes benchmark is blank for the 68K, but I remember seeing elsewhere that the '816 compared favorably to the 68K.
I know 68K enthusiasts definitely like the programmer's model. It is more suitable for certain compiled languages like C. The 6502's extended set of registers is of course zero page, and the 816's is the direct page which is like zero page but renamed because it can be relocated, and every task can have its own DP. (The '816 is much better suited to things like multitasking and relocatable code than the 6502 is.) BigEd observed, "With 6502, I suspect more than one beginner has wondered why they can't do arithmetic or logic operations on X or Y, or struggled to remember which addressing modes use which of the two. And then the intermediate 6502 programmer will be loading and saving X and Y while the expert always seems to have the right values already in place."
On the segmented memory, the 65Org32 (so-far-vaporware-only) all-32-bit 65816, the bank registers are 32-bit also, serving as offsets for various tasks' beginning addresses but eliminating the 64K boundaries. The 65816's bank boundaries are transparent in long addressing; but without using long addressing all the time, the key is to make the boundaries work for you instead of against you, just as one does with zero page (and on the '816, "direct page," since it can be relocated). The shorter addresses in operands and tables were a benefit especially when memory was far more expensive than it is today.
In the Apple IIgs, the '816 was definitely capable of more than 2.8MHz, but Steve Jobs wanted it held down because he didn't want the IIgs to make the Macs looks bad.
I believe the 68K took 46 clocks for the interrupt acknowledge and interrupt sequence. The 816's is 8 clocks, one more than the 6502's, because it pushes the program bank. Programming manuals usually show ISR examples that are much longer than normally needed, just to cover all their bases, since they don't know your particular situation and they want to make sure they push and initialize everything including things you won't need in many situations.
It is unfortunate that so many ICs are not available in DIP form; but fortunately we can get adapters that are easy to use, like this one from Jameco: There are also thru-hole PLCC sockets, even wire-wrap ones (although the WW ones are expensive and hard to find): The 6522's shift register can only go one direction at a time, so you'd need two for full duplex SPI. I think all the SPI ICs I've used used only one direction at a time though, with dummy data going in the other direction. If you do use the SR, sending a byte is as simple as STA VIA_SR. 16 clocks later, you can do it again, if it's running at half the phase-2 rate. If you can get the next byte to send any sooner, you could check the status but it would be more efficient to just put in a NOP or something like that. If you were transferring a block of data like for an SPI serial memory, you might have for example:
and keep the SPI busy pretty much full time. If you were transferring data to and from an SPI-interfaced UART, you would of course have to add code to keep watching to make sure you don't overrun the transmit buffer or re-read already-read bytes from the receive buffer.
I do like the I²C protocol a lot. I think very few devices can handle 5MHz clock rate, and other devices on the bus will need the slower clock rate just so they don't foul things up by responding incorrectly to start and stop conditions and addresses.
I have only bit-banged both SPI and I²C myself. The circuit potpourri page of my 6502 primer has circuits I've used, and links to accompanying source code, and also Jeff Laughton's tricks for fast (single-cycle) I/O with the 65c02. If you bit-bang with his tricks, producing a clock pulse, ie, a rising edge and a falling edge, takes a grand total of 2 cycles. Otherwise it takes usually 12, for INC, DEC, putting the clock line on a 6522's port's bit 0 so you can change just the one bit with these instructions. Put incoming data on bit 6 or 7 so you can test it with BIT without having to use AND.
There's a performance comparison at http://westerndesigncenter.com/wdc/AN-0 ... risons.cfm . The Sieve of Eratosthenes benchmark is blank for the 68K, but I remember seeing elsewhere that the '816 compared favorably to the 68K.
I know 68K enthusiasts definitely like the programmer's model. It is more suitable for certain compiled languages like C. The 6502's extended set of registers is of course zero page, and the 816's is the direct page which is like zero page but renamed because it can be relocated, and every task can have its own DP. (The '816 is much better suited to things like multitasking and relocatable code than the 6502 is.) BigEd observed, "With 6502, I suspect more than one beginner has wondered why they can't do arithmetic or logic operations on X or Y, or struggled to remember which addressing modes use which of the two. And then the intermediate 6502 programmer will be loading and saving X and Y while the expert always seems to have the right values already in place."
On the segmented memory, the 65Org32 (so-far-vaporware-only) all-32-bit 65816, the bank registers are 32-bit also, serving as offsets for various tasks' beginning addresses but eliminating the 64K boundaries. The 65816's bank boundaries are transparent in long addressing; but without using long addressing all the time, the key is to make the boundaries work for you instead of against you, just as one does with zero page (and on the '816, "direct page," since it can be relocated). The shorter addresses in operands and tables were a benefit especially when memory was far more expensive than it is today.
In the Apple IIgs, the '816 was definitely capable of more than 2.8MHz, but Steve Jobs wanted it held down because he didn't want the IIgs to make the Macs looks bad.
I believe the 68K took 46 clocks for the interrupt acknowledge and interrupt sequence. The 816's is 8 clocks, one more than the 6502's, because it pushes the program bank. Programming manuals usually show ISR examples that are much longer than normally needed, just to cover all their bases, since they don't know your particular situation and they want to make sure they push and initialize everything including things you won't need in many situations.
It is unfortunate that so many ICs are not available in DIP form; but fortunately we can get adapters that are easy to use, like this one from Jameco: There are also thru-hole PLCC sockets, even wire-wrap ones (although the WW ones are expensive and hard to find): The 6522's shift register can only go one direction at a time, so you'd need two for full duplex SPI. I think all the SPI ICs I've used used only one direction at a time though, with dummy data going in the other direction. If you do use the SR, sending a byte is as simple as STA VIA_SR. 16 clocks later, you can do it again, if it's running at half the phase-2 rate. If you can get the next byte to send any sooner, you could check the status but it would be more efficient to just put in a NOP or something like that. If you were transferring a block of data like for an SPI serial memory, you might have for example:
Code: Select all
FOR_X 0, TO, <length>
LDA <array>, X
STA VIA1_SR
NOP ; (for delay to prevent overrun)
NEXT_XI do like the I²C protocol a lot. I think very few devices can handle 5MHz clock rate, and other devices on the bus will need the slower clock rate just so they don't foul things up by responding incorrectly to start and stop conditions and addresses.
I have only bit-banged both SPI and I²C myself. The circuit potpourri page of my 6502 primer has circuits I've used, and links to accompanying source code, and also Jeff Laughton's tricks for fast (single-cycle) I/O with the 65c02. If you bit-bang with his tricks, producing a clock pulse, ie, a rising edge and a falling edge, takes a grand total of 2 cycles. Otherwise it takes usually 12, for INC, DEC, putting the clock line on a 6522's port's bit 0 so you can change just the one bit with these instructions. Put incoming data on bit 6 or 7 so you can test it with BIT without having to use AND.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: AVR as UART/ACIA IC
GARTHWILSON wrote:
The 65816's bank boundaries are transparent in long addressing...
Quote:
In the Apple IIgs, the '816 was definitely capable of more than 2.8MHz, but Steve Jobs wanted it held down because he didn't want the IIgs to make the Macs looks bad.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: AVR as UART/ACIA IC
GARTHWILSON wrote:
I know 68K enthusiasts definitely like the programmer's model. It is more suitable for certain compiled languages like C. The 6502's extended set of registers is of course zero page, and the 816's is the direct page which is like zero page but renamed because it can be relocated, and every task can have its own DP. (The '816 is much better suited to things like multitasking and relocatable code than the 6502 is.) BigEd observed, "With 6502, I suspect more than one beginner has wondered why they can't do arithmetic or logic operations on X or Y, or struggled to remember which addressing modes use which of the two. And then the intermediate 6502 programmer will be loading and saving X and Y while the expert always seems to have the right values already in place."
While it is a popular view that the zero page (or direct page on the 6809 or 65816) are like an extended set of registers, there are some fundamental differences in architecture between zero/direct page memory and registers having to do with the presence or absence of the memory bus between the register and the processor. I'd say zero/direct page memory are closer to cache memory than to extended registers myself.
GARTHWILSON wrote:
On the segmented memory, the 65Org32 (so-far-vaporware-only) all-32-bit 65816, the bank registers are 32-bit also, serving as offsets for various tasks' beginning addresses but eliminating the 64K boundaries. The 65816's bank boundaries are transparent in long addressing; but without using long addressing all the time, the key is to make the boundaries work for you instead of against you, just as one does with zero page (and on the '816, "direct page," since it can be relocated). The shorter addresses in operands and tables were a benefit especially when memory was far more expensive than it is today.
GARTHWILSON wrote:
In the Apple IIgs, the '816 was definitely capable of more than 2.8MHz, but Steve Jobs wanted it held down because he didn't want the IIgs to make the Macs looks bad.
GARTHWILSON wrote:
I believe the 68K took 46 clocks for the interrupt acknowledge and interrupt sequence. The 816's is 8 clocks, one more than the 6502's, because it pushes the program bank. Programming manuals usually show ISR examples that are much longer than normally needed, just to cover all their bases, since they don't know your particular situation and they want to make sure they push and initialize everything including things you won't need in many situations.
GARTHWILSON wrote:
It is unfortunate that so many ICs are not available in DIP form; but fortunately we can get adapters that are easy to use, like this one from Jameco:
Having said that, nothing beats solderless breadboard for trying out new ideas or ideas. I am very impressed with the work that Oneironaut is doing with his Vulcan 74 project (to single out one of many impressive projects shared by members here). If I had no other choice, I'll use a surfboard (SMT to through-hole kludge) to enable me to use parts I can't find in any other format, or I'll just design an entire daughterboard I can easily interface to breadboard as I have done with CPLDs in the past (the source of my TQFP-100 soldering "fun"). But in this case there is a readily available off-the-shelf DIP part which I believe can be made to function as a high-performance UART that will afford no performance degradation to any 6502 system into which it is plugged, and which will have a software interface which will be virtually indistinguishable from the real thing. Well, those are my goals anyway, let's see how close I can get to them. And if I'm successful, I'll leverage the work to add SPI, I2C, and any of the other dozen or so hardware peripherals that make the PIC an attractive platform for embedded work.
GARTHWILSON wrote:
The 6522's shift register can only go one direction at a time, so you'd need two for full duplex SPI. I think all the SPI ICs I've used used only one direction at a time though, with dummy data going in the other direction. If you do use the SR, sending a byte is as simple as STA VIA_SR. 16 clocks later, you can do it again, if it's running at half the phase-2 rate. If you can get the next byte to send any sooner, you could check the status but it would be more efficient to just put in a NOP or something like that.
GARTHWILSON wrote:
I do like the I²C protocol a lot. I think very few devices can handle 5MHz clock rate, and other devices on the bus will need the slower clock rate just so they don't foul things up by responding incorrectly to start and stop conditions and addresses.
GARTHWILSON wrote:
I have only bit-banged both SPI and I²C myself. The circuit potpourri page of my 6502 primer has circuits I've used, and links to accompanying source code, and also Jeff Laughton's tricks for fast (single-cycle) I/O with the 65c02. If you bit-bang with his tricks, producing a clock pulse, ie, a rising edge and a falling edge, takes a grand total of 2 cycles. Otherwise it takes usually 12, for INC, DEC, putting the clock line on a 6522's port's bit 0 so you can change just the one bit with these instructions. Put incoming data on bit 6 or 7 so you can test it with BIT without having to use AND.
Re: AVR as UART/ACIA IC
BigDumbDinosaur wrote:
In fact, by the mid-1980s, the WDC versions of the 65C02 and the 65C816 were capable of 8 MHz operation. Had Apple chosen to run the IIgs at that speed it would have made the Mac look kind of lame.
Of course, IMHO, the Amiga made both the Mac and IIGS look pretty lame anyway, and its 68000 was only clocked a bit over 7 MHz. I'll admit it had a lot to do with the other chips supporting the CPU, however.
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: AVR as UART/ACIA IC
I had to look up when the SuperCPU came out, which was a 20MHz '816 accelerator for the C64. It was 1996. I thought it was earlier. Bill Mensch said in an interview that in the early years of 6502, production testing was by hand, apparently functional only (ie, no testing of things like timing margins, drive currents, leakages, input voltage thresholds, etc.), and they marked the part for half of the fastest speed it ran fine at, rounded down to the nearest lower number of MHz. So a 6502 that ran at at 5MHz was marked for 2MHz. He said they had some that ran at 10MHz, even in the NMOS days, before the 65c02.
A friend got an Amiga 500 not long after they came out, and showed me some very impressive graphics demos.
It definitely would be nice to have some new 65xx I/O hardware; but it's not really necessary, as BDD pointed out. It would just make bus interfacing a bit easier. The '22 VIA is great for general-purpose I/O, but the new '51 has been a bit problematic, and there's nothing in production that directly addresses SPI, I²C, video, PWM, A/D, etc..
I have become more and more stack-oriented (including virtual stacks, not just the page-1 hardware stack), and using them to keep and pass parameters, have local variables, etc. makes for a reduced need for processor registers. The data stack works well in ZP. It really reduces the need for variables and the chances for contention between different pending routines wanting the same registers or data memory locations at the same time. Sometimes I have thought it would be cool if ZP and page 1 were onboard and each of these two pages had its own bus, making simultaneous access possible. The 6502-based microcontrollers seemed to mostly put their I/O in ZP, making I/O more efficient. This is where the SMB, RMB, BBS, and BBR instructions come in most useful. As long as I/O is onboard (as in a microcontroller), it would be nice to have that in its own page too.
Soldering SOICs and PQFPs with a chisel-tipped iron is pretty easy. After tacking two opposite corners down, you flood an entire side at once, possibly even with one big bridge, then another side, then get the excess solder off the iron and come back and hold the board vertically and go slowly from top to bottom of the row of pins. The extra solder comes off on the iron, leaving just the right amount on each pin, with no bridges, even though the iron's tip is fat enough to touch several pins at once. It works pretty well with a little practice. Extra flux helps but is not necessary, I've found.
A friend got an Amiga 500 not long after they came out, and showed me some very impressive graphics demos.
It definitely would be nice to have some new 65xx I/O hardware; but it's not really necessary, as BDD pointed out. It would just make bus interfacing a bit easier. The '22 VIA is great for general-purpose I/O, but the new '51 has been a bit problematic, and there's nothing in production that directly addresses SPI, I²C, video, PWM, A/D, etc..
I have become more and more stack-oriented (including virtual stacks, not just the page-1 hardware stack), and using them to keep and pass parameters, have local variables, etc. makes for a reduced need for processor registers. The data stack works well in ZP. It really reduces the need for variables and the chances for contention between different pending routines wanting the same registers or data memory locations at the same time. Sometimes I have thought it would be cool if ZP and page 1 were onboard and each of these two pages had its own bus, making simultaneous access possible. The 6502-based microcontrollers seemed to mostly put their I/O in ZP, making I/O more efficient. This is where the SMB, RMB, BBS, and BBR instructions come in most useful. As long as I/O is onboard (as in a microcontroller), it would be nice to have that in its own page too.
Soldering SOICs and PQFPs with a chisel-tipped iron is pretty easy. After tacking two opposite corners down, you flood an entire side at once, possibly even with one big bridge, then another side, then get the excess solder off the iron and come back and hold the board vertically and go slowly from top to bottom of the row of pins. The extra solder comes off on the iron, leaving just the right amount on each pin, with no bridges, even though the iron's tip is fat enough to touch several pins at once. It works pretty well with a little practice. Extra flux helps but is not necessary, I've found.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: AVR as UART/ACIA IC
GARTHWILSON wrote:
Soldering SOICs and PQFPs with a chisel-tipped iron is pretty easy. After tacking two opposite corners down, you flood an entire side at once, possibly even with one big bridge, then another side, then get the excess solder off the iron and come back and hold the board vertically and go slowly from top to bottom of the row of pins. The extra solder comes off on the iron, leaving just the right amount on each pin, with no bridges, even though the iron's tip is fat enough to touch several pins at once. It works pretty well with a little practice. Extra flux helps but is not necessary, I've found.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: AVR as UART/ACIA IC
GARTHWILSON wrote:
It definitely would be nice to have some new 65xx I/O hardware; but it's not really necessary, as BDD pointed out. It would just make bus interfacing a bit easier. The '22 VIA is great for general-purpose I/O, but the new '51 has been a bit problematic, and there's nothing in production that directly addresses SPI, I²C, video, PWM, A/D, etc..
GARTHWILSON wrote:
I have become more and more stack-oriented (including virtual stacks, not just the page-1 hardware stack), and using them to keep and pass parameters, have local variables, etc. makes for a reduced need for processor registers. The data stack works well in ZP. It really reduces the need for variables and the chances for contention between different pending routines wanting the same registers or data memory locations at the same time. Sometimes I have thought it would be cool if ZP and page 1 were onboard and each of these two pages had its own bus, making simultaneous access possible. The 6502-based microcontrollers seemed to mostly put their I/O in ZP, making I/O more efficient. This is where the SMB, RMB, BBS, and BBR instructions come in most useful. As long as I/O is onboard (as in a microcontroller), it would be nice to have that in its own page too.
GARTHWILSON wrote:
Soldering SOICs and PQFPs with a chisel-tipped iron is pretty easy. After tacking two opposite corners down, you flood an entire side at once, possibly even with one big bridge, then another side, then get the excess solder off the iron and come back and hold the board vertically and go slowly from top to bottom of the row of pins. The extra solder comes off on the iron, leaving just the right amount on each pin, with no bridges, even though the iron's tip is fat enough to touch several pins at once. It works pretty well with a little practice. Extra flux helps but is not necessary, I've found.
Re: AVR as UART/ACIA IC
As per my experience with AVR, it has several interrupt lines that can trigger by a high-low or low-high transition.
And you could immediately react on a chip select signal. If clocked fast enough there should be enough time to set the RDY line for the CPU.
Also you have enough time to read the databus and the address lines and react on that.
Actually you can simulate several hardware by one 328P by trggering different code on different chip select signals.
turnkey pcb assembly
And you could immediately react on a chip select signal. If clocked fast enough there should be enough time to set the RDY line for the CPU.
Also you have enough time to read the databus and the address lines and react on that.
Actually you can simulate several hardware by one 328P by trggering different code on different chip select signals.
turnkey pcb assembly
Last edited by RodCarty on Fri Mar 11, 2022 7:32 pm, edited 1 time in total.
Re: AVR as UART/ACIA IC
RodCarty wrote:
As per my experience with AVR, it has several interrupt lines that can trigger by a high-low or low-high transition.
And you could immediately react on a chip select signal. If clocked fast enough there should be enough time to set the RDY line for the CPU.
Also you have enough time to read the databus and the address lines and react on that.
Actually you can simulate several hardware by one 328P by trggering different code on different chip select signals.
And you could immediately react on a chip select signal. If clocked fast enough there should be enough time to set the RDY line for the CPU.
Also you have enough time to read the databus and the address lines and react on that.
Actually you can simulate several hardware by one 328P by trggering different code on different chip select signals.
Re: AVR as UART/ACIA IC
On an AVR an interrupt takes 4 cycles plus the remaining cycles of the currently running instruction (up to 3). The first instruction must deassert RDY and uses another cycle. Don't know, what the timing requirement to deassert RDY is, but it is probably shorter then 1 cycle. So an AVR being 8 times faster than a 65xx is still not fast enough.
6502 sources on GitHub: https://github.com/Klaus2m5
-
clockpulse
- Posts: 87
- Joined: 20 Oct 2012
- Location: San Diego
Re: AVR as UART/ACIA IC
Just a quick thought, how about a flip-flop latching the RDY line at CS, the AVR can take as long as it likes to clear the FF and release RDY.
Re: AVR as UART/ACIA IC
Klaus2m5 wrote:
On an AVR an interrupt takes 4 cycles plus the remaining cycles of the currently running instruction (up to 3). The first instruction must deassert RDY and uses another cycle. Don't know, what the timing requirement to deassert RDY is, but it is probably shorter then 1 cycle. So an AVR being 8 times faster than a 65xx is still not fast enough.
I bet that AVR would run fine at 30MHz. The XMEGA range is rated for 32MHz anyway, but people have found they run reliably up to at least 64MHz without major ill effects. EEPROM seems to be the only weak point, but you can just switch to a lower clock for a while if you need it.
Re: AVR as UART/ACIA IC
I'm still thinking about starting such a project as well, i.e. using a microcontroller as universal IO. In this thread a lot was discussed related to speed and number of cycles available to the microcontroller etc. But I think what we need is a solution that does neither depend or rely on the speed of the 6502 nor the microcontroller (AVR). Therefore I thought about a RDY generator that allows the 2 CPUs to run at individual speeds without constraints. Here is my proposal
After a Reset all flip-flops are cleared. /SEL is assumed to be the chip-select for IO and is asserted (low) for the IO range. When asserted, this must happen when PHI2 is low, FF IC1A will toggle from '0' to '1' on the next leading edge of PHI2 and pull RDY low. The address bus of the 6502 will be kept in the current state and /SEL will be left asserted. Now the microcontroller can do it's job and when done needs to assert ACK, the leading edge of ACK will trigger FF IC1B (note thate CLR is high so it will follow the D-input on a clock). As now both inputs of the NOR IC3B are low (note that IC2A was cleared after a RESET) the next leading edge of PHI2 will toggle FF IC2A from '0' to '1'. Now one input of IC3A is high and therefore the D-input of FF IC1A will be again high and FF IC1A will toggle from '1' to '0' then next leading edge of PHI2. RDY will now be released and the 6502 will resume it's cycle.
Once the microcontroller has asserted ACK it must de-asssert ack before honouring another IO request.
Using this circuit it does not matter at which clock rate the two CPUs (6502 und microcontroller) will run. Also it does not matter how long the microcontroller takes, the 6502 will wait.
By the way when using this circuit with a 65C816 and using the bank addresses you must take care that the databus of the 6502 will only show the bank address in the first PHI2=Low phase. So you must only latch the Bank address when RDY = high.
Also I would not use /SEL as an interrupt to the microcontroller but rather I would poll the /SEL signal in order to save the interrupt level for other internal tasks of the microcontroller. This also gives you the fastest response.
After a Reset all flip-flops are cleared. /SEL is assumed to be the chip-select for IO and is asserted (low) for the IO range. When asserted, this must happen when PHI2 is low, FF IC1A will toggle from '0' to '1' on the next leading edge of PHI2 and pull RDY low. The address bus of the 6502 will be kept in the current state and /SEL will be left asserted. Now the microcontroller can do it's job and when done needs to assert ACK, the leading edge of ACK will trigger FF IC1B (note thate CLR is high so it will follow the D-input on a clock). As now both inputs of the NOR IC3B are low (note that IC2A was cleared after a RESET) the next leading edge of PHI2 will toggle FF IC2A from '0' to '1'. Now one input of IC3A is high and therefore the D-input of FF IC1A will be again high and FF IC1A will toggle from '1' to '0' then next leading edge of PHI2. RDY will now be released and the 6502 will resume it's cycle.
Once the microcontroller has asserted ACK it must de-asssert ack before honouring another IO request.
Using this circuit it does not matter at which clock rate the two CPUs (6502 und microcontroller) will run. Also it does not matter how long the microcontroller takes, the 6502 will wait.
By the way when using this circuit with a 65C816 and using the bank addresses you must take care that the databus of the 6502 will only show the bank address in the first PHI2=Low phase. So you must only latch the Bank address when RDY = high.
Also I would not use /SEL as an interrupt to the microcontroller but rather I would poll the /SEL signal in order to save the interrupt level for other internal tasks of the microcontroller. This also gives you the fastest response.
Re: AVR as UART/ACIA IC
Peter, your circuit looks good except for an apparent typo. The diagram shows the 74_74 /CLR inputs being driven by PHI2, but I think the signal names have gotten reversed on the left side of the drawing -- the labels PHI2 and /RES have gotten exchanged. (I PM'd you shortly after you posted this on Tuesday, but maybe the PM notification didn't reach you.)
cheers,
Jeff
cheers,
Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html