6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 9:17 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jun 21, 2020 9:18 am 
Offline

Joined: Thu Mar 19, 2020 11:15 am
Posts: 3
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


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 21, 2020 9:28 am 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
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.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 21, 2020 4:11 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
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.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 22, 2020 9:38 am 
Offline

Joined: Thu Mar 19, 2020 11:15 am
Posts: 3
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: