interupt on 68B50 receive

Building your first 6502-based project? We'll help you get started here.
Post Reply
vermeire_mathias
Posts: 3
Joined: 19 Mar 2020

interupt on 68B50 receive

Post by vermeire_mathias »

Hi everyone.

I am in the process of making a simple 6502 computer. It sits now on a breadboard and before I put it on some veraboard I wanted to add a uart.
This computer is more of a learning thing than anything else.
I added the 68B50 and I am able to sent stuff, but for the receiving I am a bit at a loss.
I read the data sheet several times already but I don't seem to get it to work.
The way I understand this chip (68B50) has an interrupt (out) signal that will go low once a char is received, at leased if the control register is set correct.
Do I understand this correct? If so what is the correct way to set this up?

kr,
Mathias
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: interupt on 68B50 receive

Post by BigEd »

You do have the choice, as to whether to use interrupts or not. In fact there are perhaps three ways, but to be sure that each character is dealt with exactly once, there are two:
- read the status register to see if a character has come in, or if there is space for a character to go out
- use the interrupt to tell you when the receive buffer is full, or when the transmit buffer is empty.

These amount to the same thing. In your first simple code, you might find it easier to poll the status register. Ultimately, when you have a sophisticated OS, you will deal with interrupts from various sources, but that's not the place the start.

There's some good information on this page:
http://alanclements.org/serialio.html

In particular, note that you do need to set the device up, so it's working in the mode that you intend to use:
Quote:
Control Register

Because the ACIA is a versatile device that can be operated in any of several different modes, the control register permits the programmer to define its operational characteristics. ... in almost all applications the ACIA is normally configured once only.
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: interupt on 68B50 receive

Post by floobydust »

For a working example with code, I would recommend you download the following book (I've had a printed copy for years):

https://apple2online.com/web_documents/ ... utines.pdf

Starting on Page 464, you'll find an interrupt-driven routine for the 6850. They also show code for one that uses transmit and receive buffers. They did their code on an Apple II but you can still use the core code for your system with minimal change.
vermeire_mathias
Posts: 3
Joined: 19 Mar 2020

Re: interupt on 68B50 receive

Post by vermeire_mathias »

BigEd and floobydust thanks for the reply.
This is very helpful. I will read the pages you send me and try it out.
I will keep you posted.
Post Reply