fachat wrote:
maurice6502 wrote:
fachat wrote:
Very nice! I'll have a look as I am investigating a method to connect an atmel avr to a 6502 bus. We may have had the same ideas.
Can you attach screenshots of the schematics as well? I do have eagle, but not really handy eg on my phone now!
Thanks
André
André,
attachment of first post is in pdf format, let me know if you are able to read it.
Thanks I only saw the image not the pdf.
Why are you useing '373 latches?
I either use '273 - which are to my knowledge the only ones with /RES or '374/'574 (IIRC) registers. I know chances are very low but latches like the '373 can change while 'open' which can lead to potentially inconsistent values.
Again, chances are low but I like to look at such details
Thanks again for sharing!
André
André,
both side of communication are buffered to ensure minimal use of 6502 time and resources..
To write one char just put on BaseAddress (latch U3) your data and one Interrupt occour on AVR to move your byte to AVR_TxBuffer
To read one char from AVR_RxBuffer you have 2 chance:
- with interrupt generated from AVR when AVR_RxBuffer is not empty , just read BaseAddress+1 (Latch U1) and AVR after a very short time put one new data (if exist..) on Latch U1
- with polling , checking BaseAddress+4 (for COM1) or BaseAddress+5 (for COM2) to see if there are data inside AVR buffers before access to latch U3
Using a single port with interrupts is easy to send an receive data at over 200 Kbytes/sec (1,6 Mbit/s) , with 2 ports or with polling transfer speed is reduced (performances tested with 65C02 running at 1.8432 Mhz and AVR running at 18.432 Mhz); this architecture allow minimal use of 6502 time for mid lenght data packets, in my applications less than 16 bytes are sent every millisecond end I have two terminator to start real AVR transmission:
- when AVR receive one CR or LF (for ascii string)
- after 100 uS from last char received (for binary packets)
For high speed use , engaging AVR UART only when AVR_TxBuffer is ready with all data grant that AVR process IRQ from 6502 and transfer U1 data in 4 uS (without extreme optimization of code..) and 2 Mhz 65C02 spent more time to send 1 byte of packet:
LDX NumChars ; load numebr of bytes to send
LOOP
LDA MyTxBuffer,X ; pick up data
STA AVR51 ; and store in U3 latch
DEX ; decrement pointer
BNE LOOP ; repeat up to end job
more or less 15 cycles at 500nS , more than AVR_IRQ time ; one 16 bytes telegram cost 120 uS (12% of 65C02 time with 1mS cycle)
Note that AVR must send out data at 230Kbit to allow this data rate and perform other tasks (for transmission phase local UART are engaged for 70% of time but AVR for less than 10% allowing RX for ack/nack of receiver)
Low speed or multichannel can be programmed with different logic for basis performances.