6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 29, 2024 3:39 am

All times are UTC




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Mon Aug 22, 2011 2:13 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
This is one example of why I designed the 65SPI interface. It provides a serial bus between the 6502 and peripherals such as PIC's and AVR's.

For a simple parallel interface, you need two 8-bit latches that the 6502 writes to and the peripheral reads. One provides a data byte, the other are handshake bits from 6502 to peripheral. You will also need two 8 bit latches that the peripheral can write to and the 6502 reads - one for data and one for handshake. Then, its just a matter using firmware on both sides to control data flow.

EhBASIC would then use that firmware to check for incoming keystrokes and send outgoing data bytes.

In any bus system, you need to define a physical layer - the actual wires connecting the bus, and the logical layer - the firmware that controls the physical layer and provides the interface protocol.

Since you are wanting to access mutliple features, your protocol will have to include how to handle that.

My SBC-3 has an AVR device off of the 65SPI that reads the keyboard and provides a two-way RS-232 channel. You can dig through my source code to see how I handles that. It wasn't easy to ensure no data got lost or repeated, but I was able to come up with a system that works.

http://sbc.rictor.org/

Hope this help!


Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 22, 2011 3:03 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
Yes, I think Daryl's 65SPI chip could give you more interfacing overall for the number of connections used, which is important when you consider the amount of time needed to make your own home-made setup. In fact, part of the 65SIB (serial interface bus, related to but not to be confused with the 65SPI chip) was to include specifications on how to use something like a PIC microcontroller for exactly what you're talking about doing, but we never got that defined. Samuel Falvo was going to do the portion of the specification relating to autoconfiguration. I might still make PICs available to act as hubs to have sub-buses to get past the 7-slave limitation. The basic specification of 65SIB however is at viewtopic.php?t=1064&start=105 . Daryl's 65SPI IC info is available at http://sbc.rictor.org/65spi.html.

If you do the PIC parallel slave port (PSP) though, and make it a master-slave setup instead of peer-to-peer, you can interface the PIC to a 65xx system through a single bi-directional port (PA or PB) of a 6522 VIA. Each port has both an input register and an output register. Without drawing it up right now to figure it out, I expect CA1/CA2 or CB1/CB2 will give all the extra hardware support lines needed. Edit, 10/19/18: Microchip's ap. note AN579, about using the PSP, is at http://ww1.microchip.com/downloads/en/A ... 00579b.pdf .

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 28, 2011 10:08 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Well i wrote a basic program for the pic (didn't solder the socket for it yet, ill post my progress within a few days), for now it will only be able to output pressed ascii characters on the psp, and write to the lcd through the psp.
Other functions like i2c and a/d i thought about putting two additional latches one input one output, so that keyboard and display are separate from the i2c, a/d, and mouse...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 29, 2011 2:30 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
Darryl, just a thought, what do you think of splitting off the keyboard/RS232 as its own project to place on here so others may use your work in theirs?

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 29, 2011 2:41 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
When i finish this. I will make the code kinda modular, so it can be taken apart easily...


Last edited by Dajgoro on Mon Aug 29, 2011 6:42 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 29, 2011 6:16 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
Nightmaretony wrote:
Darryl, just a thought, what do you think of splitting off the keyboard/RS232 as its own project to place on here so others may use your work in theirs?


I may be able to get that done. On SBC-3, I did cheat and use one extra handshake line outside of the SPI bus. It ran beween the AVR and a VIA input. Will see if I can clean that up so it's a pure SPI interface.

I cannot promise anything in the near future however.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 30, 2011 1:02 am 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
:D it writes characters on the lcd!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 30, 2011 4:26 am 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
After 4 hours i managed to write "Hello World!" on the lcd, because i placed the string on the wrong address and the 6502 would echo junk from ram...
I already thought that there is something verry wrong with my project, then i remembered about the address trick(in the simulator the program is located on $0000, but on the sbc is on the $C000)...
I still need to test what is the max writing speed...

I wanted to post the picture of the sbc in action, but ms paint will not open
pictures taken from windows phone7 :shock: (OMG)...
So here is the link if you want to take a look
http://www.iteracija.com/mupload/hw.jpg


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 30, 2011 7:12 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Great! So, from the 6502 side, this looks like a simple output port, which you write the characters 'H' 'e' 'l' and so on, and the PIC acts like a teletype?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 30, 2011 3:10 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Yes! Since i use the psp interrupt to get pics attention, i will now make a buffer, so it will be able to read characters at higher speeds...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 05, 2011 8:52 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
Now i managed to get working the keyboard interface part.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Sep 28, 2011 10:51 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
I think the keyboard interface part is finished, except for small bug where Z turns into Y when holding shift... Now i can go to the mouse and RTC part...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Oct 25, 2011 2:39 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
While i was thinking about how the Altair8800 had may lights for addresses/data and about the 6502 debugging whit low clock speed, i got this idea: Why not use this pic for debugging, it just needs the sync and clock signal, and then it could decode assembly instructions and print them on the lcd as you step through the program...


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 37 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: