Author Topic: Interfacing CPC with a microcontroller  (Read 2361 times)

0 Members and 1 Guest are viewing this topic.

Offline joska

  • CPC664
  • ***
  • Posts: 102
  • Country: no
  • Liked: 43
  • Likes Given: 6
Interfacing CPC with a microcontroller
« on: 13:27, 11 July 14 »
I want to connect an Arduino or similar to my CPC in order to let the CPC interact with the outside world. I've had Z80-computers since the early 80's (Sharp MZ and MSX) but I've never worked with the Z80 at this level before.

I found this interesting MSX project: Coding Laboratory: Virtual MSX disk drive

Basically it has a simple address decoder that pulls the WAIT/READY line low to force the Z80 to wait until the microcontroller has either read the databus or written to it. Then the microcontroller release WAIT/READY and the Z80 continues.

This looks rather easy, but can the same concept be used on the CPC?

Online Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.051
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 3918
  • Likes Given: 408
Re: Interfacing CPC with a microcontroller
« Reply #1 on: 13:29, 11 July 14 »
As long as you don't hold the wait signal low for too long it should be fine.

Bryce.

Offline joska

  • CPC664
  • ***
  • Posts: 102
  • Country: no
  • Liked: 43
  • Likes Given: 6
Re: Interfacing CPC with a microcontroller
« Reply #2 on: 13:47, 11 July 14 »
So how long would "too long" be?

Offline Nilquader

  • CPC664
  • ***
  • Posts: 81
  • Country: de
  • (void**)NULL
  • Liked: 53
  • Likes Given: 4
Re: Interfacing CPC with a microcontroller
« Reply #3 on: 14:00, 11 July 14 »
Take a look at the CPC Booster+ - That's an ATMEGA connected to the CPC Bus. CPC Booster - CPCWiki
--
Nilquader of SPRING
http://www.nilquader.net/

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.054
  • Country: fr
  • Liked: 1141
  • Likes Given: 637
Re: Interfacing CPC with a microcontroller
« Reply #4 on: 14:21, 11 July 14 »
I already asked this.

to have such stuff woud need :
=cabling properly the Arduino to CPC.
=have some library on both the arduino and CPC to have them do stuff together.

good point with arduino :
you can get the ethernet shield and its micro-SD card plug used as ethernet/internet, or mass data storage...

with such a shield, you may emulate an HDD or Floppy dfisk or even ROMs perhaps, or get online.
the arduino could also be used to perform some additional tasks or functions I guess, like arithmetic functions or whatever...

yeah the ethernet shield doesn't allows to use both the SD card or the ethernet at the same time, not a big deal...

Really I don't understand why no coder-hobbyist did stuff like that.


Anyway, would be cool if TotO could create the cable to plug an Arduino Mega a theses models have a lot of I/O so you may put both an ethernet shield and the CPC) into his MotherX4... had to be the perfect combo and the way to properly use the 4th slot.

lemme check :
MotherX4 : done.
=plAY-CiTy : soon.
=X-MEM : done.
=Booster : done
=empty slot for Arduino then... :P
« Last Edit: 14:37, 11 July 14 by MacDeath »

Offline joska

  • CPC664
  • ***
  • Posts: 102
  • Country: no
  • Liked: 43
  • Likes Given: 6
Re: Interfacing CPC with a microcontroller
« Reply #5 on: 14:34, 11 July 14 »
Take a look at the CPC Booster+ - That's an ATMEGA connected to the CPC Bus. CPC Booster - CPCWiki

Thank you! Very useful. I just took a look at the schematics and it looks like I only need to implement a subset of the CPCBooster to do exactly what I need :)

Offline steve

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.263
  • Country: gb
  • Liked: 178
  • Likes Given: 210
Re: Interfacing CPC with a microcontroller
« Reply #6 on: 14:35, 11 July 14 »
You could link the CPC to a RPi.

Online Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.051
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 3918
  • Likes Given: 408
Re: Interfacing CPC with a microcontroller
« Reply #7 on: 14:38, 11 July 14 »
So how long would "too long" be?

The RAM isn't being refreshed while the /WAIT signal is held low, so more than a couple of milliseconds will cause the RAM to become corrupted or deleted completely.

@Steve: Yeah sure.

Bryce.

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.054
  • Country: fr
  • Liked: 1141
  • Likes Given: 637
Re: Interfacing CPC with a microcontroller
« Reply #8 on: 14:39, 11 July 14 »
Quote
You could link the CPC to a RPi.
yeah, the CPC being some sort of fancy terminal : big Video Display, soundcard and control/keyboard card...
 :laugh:

Quote
So how long would "too long" be?
this would be something like 33 bit or even more...65.537 would be enough to be "too long".
 ;)
« Last Edit: 14:42, 11 July 14 by MacDeath »

Offline steve

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.263
  • Country: gb
  • Liked: 178
  • Likes Given: 210
Re: Interfacing CPC with a microcontroller
« Reply #9 on: 14:43, 11 July 14 »
I saw a blog where someone had connected one to a C64 if I find the post again I will provide a link here.
There is no difference (conceptually) between connecting a CPC to an RPi and connecting a PC to a server.

Offline joska

  • CPC664
  • ***
  • Posts: 102
  • Country: no
  • Liked: 43
  • Likes Given: 6
Re: Interfacing CPC with a microcontroller
« Reply #10 on: 14:48, 11 July 14 »
I already asked this.

to have such stuff woud need :
=cabling properly the Arduino to CPC.

Basically you need two TTL logic chips to create the address decoder and a 74245 to buffer the databus.

good point with arduino :
you can get the ethernet shield and its micro-SD card plug used as ethernet/internet, or mass data storage...

It would be very easy to use the Arduino/whatever to interface with an SD-card, giving the CPC either direct access to individual SD card sectors or even file system access (FAT driver on the Arduino). However, that would require a custom DOS on the CPC, which if far beyond my capabilities.

with such a shield, you may emulate an HDD or Floppy dfisk or even ROMs perhaps, or get online.

Depending on the microcontroller I guess it would be rather straightforward to emulate the FDC. But I don't think it would be very practical to emulate a ROM-card.

yeah the ethernet shield doesn't allows to use both the SD card or the ethernet at the same time, not a big deal...

I don't see the problem at all. True, both SD-cards and the various ethernet-modules use the SPI-interface, but the SPI-bus can be shared.

Anyway, my goal is not to create some sort of super-expansion for the CPC. I just want to learn something new. I might create a Symbiface compatible mouse (which would be useful to me), but I might also end up with nothing usable at all.

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.054
  • Country: fr
  • Liked: 1141
  • Likes Given: 637
Re: Interfacing CPC with a microcontroller
« Reply #11 on: 14:49, 11 July 14 »
Quote
However, that would require a custom DOS on the CPC, which if far beyond my capabilities.
pretty sure FutureOS could handle that... :D

Offline joska

  • CPC664
  • ***
  • Posts: 102
  • Country: no
  • Liked: 43
  • Likes Given: 6
Re: Interfacing CPC with a microcontroller
« Reply #12 on: 14:52, 11 July 14 »
You could link the CPC to a RPi.

I could, but that would be overkill for my needs. Also, it would cost 10 times as much as a simple Arduino-clone. Btw. what would you use the RPi for?

Offline joska

  • CPC664
  • ***
  • Posts: 102
  • Country: no
  • Liked: 43
  • Likes Given: 6
Re: Interfacing CPC with a microcontroller
« Reply #13 on: 14:58, 11 July 14 »
The RAM isn't being refreshed while the /WAIT signal is held low, so more than a couple of milliseconds will cause the RAM to become corrupted or deleted completely.

I see. A simple ATmega 328 would perform 16000 instructions in 1ms at 16MHz, so I don't think that would be a problem.

Offline steve

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.263
  • Country: gb
  • Liked: 178
  • Likes Given: 210
Re: Interfacing CPC with a microcontroller
« Reply #14 on: 15:09, 11 July 14 »
I could, but that would be overkill for my needs. Also, it would cost 10 times as much as a simple Arduino-clone. Btw. what would you use the RPi for?

Fileserver, internet connection, attach a camera and convert the pictures to some format that could be used as graphics in your programs.