1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Z80 to PIC interface ?

Discussion in 'Microcontrollers' started by sae140, Jun 29, 2010.

  1. sae140

    sae140 New Member

    Joined:
    Feb 4, 2004
    Messages:
    17
    Likes:
    0
    I'm currently firming-up an ultra-low-power minimalistic Z80 SBC.
    128Kb of static ram, some of it configured as ROM, and a real-time clock - and only 3 chips so far .....

    Ok - the time has come to consider I/O, and the obvious choice would be to use a single PIC - say a 18F4520 or similar, so that I could use the Slave Port (maybe ?) and gain access to the impresssive range of peripherals that the PIC offers.

    I've had a look at the Parallel Slave Port, and can see that it would need an extra interrupt/ handshaking line for efficient bi-directional communication - but before taking this any further, thought I'd check with you guys first: if you were tackling this job - what form of Z80 to PIC communication would you choose ? Simplicity and reliability being more important here than speed.
    Thanks
     
  2. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    If you do not speed and want to keep it simple look at using a SPI interface between the Z80 and the PIC.
     
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,233
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    An excellent VLSI peripheral IC for use with the Z80 is the Z84C90, it a 84 pin PLCC device.
     

    Attached Files:

    Last edited: Jun 30, 2010
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. kjennejohn

    kjennejohn New Member

    Joined:
    Mar 19, 2006
    Messages:
    338
    Likes:
    8
    Location:
    Bay Area, California

    Just about all the 28- and 40-pin PICs have a hardware USART. Just about anything in the 16F and 18F series should suffice. These have a receiver and transmitter register, both with multibyte buffers and interrupt capability. This leaves you free to have the PIC running chores until you start pumping a serial stream from the Z80 into the Receiver's buffer. This causes an interrupt. The PIC drops what it's doing and starts processing the serial input. This would have a simple command structure using one- or two-letter commands, combined with values as needed, to define what needs to be done. A simple one-letter command may be just a "report status" command, in which case the PIC takes, say, several ADC readings and I/O port values (looking at switches and stuff) and sends them to the Z80. The Z80 then parses all this data and maybe sends further commands based on the contents.

    Microchip also makes a series whose models start with "MPC", I don't know the rest. These are ICs specifically designed for jobs like yours. They have a serial control system used by any processor that can do serial, actually SPI I think. You should do a search on uchip's site for these.
    Have a fun project.
    ken
     
  6. sae140

    sae140 New Member

    Joined:
    Feb 4, 2004
    Messages:
    17
    Likes:
    0
    Some useful replies there - much appreciated.

    I particularly want to stick to my philosophy of having a minimum chip count, and serial comms of any kind will need at least one more chip at the Z80 end. If inter-processor comms were going off-board, then I would certainly consider some form of serial.

    Although I'll definitely be using a PIC as a peripheral device, ironically I found Eric's suggestion to be the most useful - not in using the Zilog peripheral itself - but rather his suggestion to use a device in a PLCC package.

    Without realising it, I'd set myself an upper limit of 40-pin DIL (for obvious ease of proto-typing), but on checking some of the larger quad-packaged PIC's I find that many have 7 or more tri-state I/O ports. With so many ports to play with I could even invoke /BUSRQ and write the I/O data directly into a reserved area of the Z80's RAM, without using so much as one external decoding chip or tristate buffer !

    Or I could stay with the PSP, create 2 extra handshaking lines (RTS:- Output Buffer Full, request Z80 read, and CTS:- Input Buffer NOT Full, Z80 may send) to convert a Slave Port into an active port, and transfer I/O data in a more conventional way.

    Plenty to think about now.

    Many thanks
     
  7. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,233
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    If you live in the UK, I will send you a couple of Z84C90's, FOC.
     
  8. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    I agree with Eric on this one.
     
  9. sae140

    sae140 New Member

    Joined:
    Feb 4, 2004
    Messages:
    17
    Likes:
    0
    Eric - many thanks for your generous offer - but I've just realised that I've been looking at this in a 'back-to-front' manner:
    For ease of prototyping I started-off by considering 2 x 40-pin DILs: a Z80 and a PIC (16F8877 or 18F4520) talking to each other.

    Then, because of losing valuable pins from the PIC in the process of establishing a comms link, I was prepared to venture into pastures new (and a tad scary !) by hand-soldering an 80-pin quad-packaged PIC onto an adapter ...

    So - why not reverse things, and hand-solder a 100-pin quad-packaged Z84C015 instead - which of course has an on-board UART - and opt for a 40-pin DIL PIC (with on-board UART, of course) to supply all the rest of the toys ... ?
    And, by using a 'conventional' comms link, the PIC can then be programmed much more easily in a high-level language.

    So I think this is the way I'll proceed now. I really appreciate the input from this forum - it's helped me crystallise the design. Just 4 chips - can't be bad.

    And now to make it. If anyone has first-hand experience of hand-soldering large quad packages - especially with dodgy eyesight ! - any tips would be appreciated.

    Thanks
    Colin
     
  10. kjennejohn

    kjennejohn New Member

    Joined:
    Mar 19, 2006
    Messages:
    338
    Likes:
    8
    Location:
    Bay Area, California
  11. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ
    Hi there,

    There's also the simple 74LS138 approach. Maybe one chip for inputs and one chip for outputs.
     
  12. sae140

    sae140 New Member

    Joined:
    Feb 4, 2004
    Messages:
    17
    Likes:
    0
    Excellent - thanks. I see there's also one there by the same guy using a clothes-iron to remove SMDs - think I'll have a play with doing that to get some practice in with re-soldering, while I wait for the Zilog chips to arrive.

    BTW - does anyone have a source for 100-pin QFP adapters - 0.65mm pitch, 30 x 20 pin matrix ? UK preferred if possible. I can't see any on Ebay, although there's a guy in Thailand selling 144-pin 0.65mm pitch adapters, so I could use those at a pinch.


    MrAl - yes indeed - the '138 and '139 are my favourite decoding chips - but on this project I'm after a minimum chip count.
    By careful selection of chips (some might say 'over-careful' !) a CP/M-capable design with an array of clever peripherals has resulted using just 4 chips with no decoding or glue logic - although I have cheated a bit by using one resistor-diode 'OR gate'. I only hope the proposed system works !!

    'best
    Colin
     
    Last edited: Jul 4, 2010
  13. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,233
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
  14. sae140

    sae140 New Member

    Joined:
    Feb 4, 2004
    Messages:
    17
    Likes:
    0
    Mornin' Eric - that site is pretty typical of many I've looked at - every adapter in the book, except the one I'm looking for !

    I have found a supplier, but they're in Thailand, and their ordering page is written in Thai ! Well, no-one said that this was going to be straightforward ;^) Time for an email, methinks ....

    S03-13 TQFP 100 -0.55mm/TQFP 100-0.65mm to IDC26x4 (the one I want's on the right - with assymetric pin layout)

    'best, Colin
     
  15. sae140

    sae140 New Member

    Joined:
    Feb 4, 2004
    Messages:
    17
    Likes:
    0
    The continuing saga of the TQFP adapter ...
    Just in case anyone else needs one of these - the Thai company I mentioned above sells 'em on Ebay. Item no: 320557649948

    Strange thing is - before today this item wasn't showing up on Ebay's search engine - but now it is. Spooky.
     

Share This Page