6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 01, 2024 10:33 am

All times are UTC




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Aug 03, 2021 7:45 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
Hi, all - hope everyone is having a good summer (in the Northern Hemisphere). Here is a question for the experts:

if one wants to interface a 65c02 to the PSP of a PIC microcontroller, must he use a VIA or PIA (or the like) between the PIC and the 65c02's bus?

Breaking out /RWB into separate /read and /write seems simple enough, or does the connection require more? The PIC does provide a latch for the data. Finally, does anyone know of any code repositories out there for this purpose (addressing the PIC via the PSP)? I'm hardwiring all this to veroboard, so I need to get all the hardware right.

Thanks!

Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 3:16 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
Nobody knows the answer, here?


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 3:32 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
I don't have knowledge of this, but... the PSP appears to be a bidirectional 8 bit port, with internal latches, and inputs for read, write and chip select. In other words, it allows the PIC to be addressed as a single location I/O device. As such, yes, it should be possible to connect directly to the 6502 bus, provided you have a bit of glue logic.
Attachment:
PSP-PIC-diagram.png
PSP-PIC-diagram.png [ 48.25 KiB | Viewed 23646 times ]


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 3:50 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
Ed, thanks! This is my first time experimenting with PIC microcontrollers. -Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 3:53 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
Do let us know how you get on!


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 5:08 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
BigEd wrote:
Do let us know how you get on!

Indeed, will do!


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 7:20 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
PS I do have newer, "better" chips (e.g., the PIC18F45K40, etc.) - I just wish I knew how to create a PSP (effectively) on those. I also have a few 18F46Q84s around. I just wish I had a better handle on using them.

-Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 7:51 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
Pages 8 and on of this PDF might be indicative of some possible tactics
https://owd.tcnj.edu/~hernande/ELC343/Chapter_07.pdf


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 8:55 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
BigEd wrote:
Pages 8 and on of this PDF might be indicative of some possible tactics
https://owd.tcnj.edu/~hernande/ELC343/Chapter_07.pdf

Ed, this is great information - thank you!!! -Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 9:04 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8534
Location: Southern California
Another relevant Microchip ap. note is AN579, about using the PSP, is at http://ww1.microchip.com/downloads/en/A ... 00579b.pdf .

I haven't looked that closely at the PIC18's, but many of the PIC16's have a PSP, parallel slave port, and I suspect the PIC18's aren't much different in that regard.  You can put it right on the processor's data bus, but it's slower than something like a 6522 because you have to for example write the data to the PIC, then give it enough time to see it and do something with that info, then come back again and tell it what it's supposed to do with that data, then again give it more time to process it, maybe polling it in between to see when it's ready for the next thing, and so on.  If you want to read data, you'll tell it what you want to read, give it time to get that data ready to output, come back later to read it, etc..  For this reason, it would be better to use the PSP only if the amount of data is rather small compared to the job the PIC will be doing with it.

I've posted this before and someone replied that newer PIC versions make it less cumbersome.  I can't find it right now.

_________________
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  
PostPosted: Wed Aug 04, 2021 10:35 pm 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
GARTHWILSON wrote:
Another relevant Microchip ap. note is AN579, about using the PSP, is at http://ww1.microchip.com/downloads/en/A ... 00579b.pdf .

I haven't looked that closely at the PIC18's, but many of the PIC16's have a PSP, parallel slave port, and I suspect the PIC18's aren't much different in that regard.

...

I've posted this before and someone replied that newer PIC versions make it less cumbersome. I can't find it right now.


You are 100% right, Garth - precisely why I'm using the 18F-K... speed. And, of course, the more robust feature set. However, for the purposes of testing everything, I'm just going to see if I can't get an I2C 16x2 LCD up and running via the MPU. Just for testing, though. If I can get that up and running (and I haven't figured out how to do it yet), then I should pretty much be able to interface with the more useful features.

Jon


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2021 11:39 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8534
Location: Southern California
Jmstein7 wrote:
I'm just going to see if I can't get an I2C 16x2 LCD up and running via the MPU. Just for testing, though. If I can get that up and running (and I haven't figured out how to do it yet), then I should pretty much be able to interface with the more useful features.

I have working I²C VIA bit-bang code, in various forms, at http://wilsonminesco.com/6502primer/GENRLI2C.ASM, to go with the I²C circuit in the 6502 primer's circuit potpourri page at http://wilsonminesco.com/6502primer/pot ... ITBANG_I2C .

_________________
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  
PostPosted: Thu Aug 05, 2021 2:24 am 
Offline

Joined: Sun May 30, 2021 2:16 am
Posts: 375
GARTHWILSON wrote:
Another relevant Microchip ap. note is AN579, about using the PSP, is at http://ww1.microchip.com/downloads/en/A ... 00579b.pdf .

I haven't looked that closely at the PIC18's, but many of the PIC16's have a PSP, parallel slave port, and I suspect the PIC18's aren't much different in that regard. You can put it right on the processor's data bus, but it's slower than something like a 6522 because you have to for example write the data to the PIC, then give it enough time to see it and do something with that info, then come back again and tell it what it's supposed to do with that data, then again give it more time to process it, maybe polling it in between to see when it's ready for the next thing, and so on. If you want to read data, you'll tell it what you want to read, give it time to get that data ready to output, come back later to read it, etc.. For this reason, it would be better to use the PSP only if the amount of data is rather small compared to the job the PIC will be doing with it[...]


Garth,

Question - when you put the PIC directly on the 'c02 data bus, do you need to connect the PIC to PHI2, or do you just keep using the internal oscillator in the MCU?

-Jon


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 05, 2021 4:38 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8534
Location: Southern California
Jmstein7 wrote:
Garth,

Question - when you put the PIC directly on the 'c02 data bus, do you need to connect the PIC to PHI2, or do you just keep using the internal oscillator in the MCU?

I've only looked at the data sheet and ap. note, and not recently.  I have not actually implemented it so far.  I expect you could run Φ2 into the PIC's OSC1 input, just to save parts.  It will use the PSP's RD\, WR\, and CS\ pins though, not coordinate transfers via Φ2 like the '22 VIA would.

_________________
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  
PostPosted: Thu Aug 05, 2021 9:18 am 
Offline
User avatar

Joined: Mon Apr 23, 2012 12:28 am
Posts: 760
Location: Huntsville, AL
I too haven't used the PSP in a way more years than I'd like to remember.

I do wonder about connecting the PIC's clock input to the Phi2 clock of the 6502/65C02.

The PIC is naturally a 4 clock cycle machine. Running Phi2 into the clock input of the PIC is going to effectively force the PIC to operate at 1/4 the clock frequency of the 6502/65C02.

My initial recommendation would be to run the PIC with a dedicated clock, at or above, its maximum operating frequency, which is somewhere in the vicinity of 20 MHz. I expect that the PSP is designed to provide an interface to an external host that is operating asynchronously to the PIC. Because of this, the circuitry of the PIC's PSP should be capable of receiving data from a processor like the 6502/65C02 which is operating at a frequency that is not an integer multiple of the PIC's clock frequency.

As previously stated, there's a lot of work that the PIC's SW has to perform to make the PSP sing. Thus, my first thought is toward making the interface as efficient and fast as possible would be to run the PIC as fast as your selected component allows.

_________________
Michael A.


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

All times are UTC


Who is online

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