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

Correct resistor for a circuit?

Discussion in 'Circuit Simulation & PCB Design' started by halleffector, May 5, 2016.

  1. Les Jones

    Les Jones Well-Known Member

    Joined:
    May 15, 2015
    Messages:
    1,446
    Likes:
    187
    Location:
    Lancashire UK
    Hi hallefector,
    I built the circuit in the most minimal way. I did not add any pullup resistors. As I said I did not use the 470R pull down resistors on the data lines. I THINK at first I clocked it at about 100 Hz when looking at the address lines with a scope but when I connected LEDs I think I reduced the clock rate to a few Hz so I could see the low address bits flashing. As it just worked I did not do anything else. As the thread seemed to die after a few days I used the bit of veroboard it was built on for something else. I have not used Z80s in any projects for at least 10 years but I never remember having a problem with a Z80 not working.

    Les.
     
  2. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    The address lines 0-7 are also used to refresh dynamic RAM , try another led / resistor on higher addresses. not sure the purpose of this project , if it is to learn about Z80 , there are better options , if it is a test rig , having it perform NOP's is not proving much... your CMOS Z80 should go from dc to several Mhz . ( reset pin should be tied to Vcc via a resistor )
     
  3. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    Thanks again for the help.

    Perhaps my problem is this? "Some would argue that resetting the CPU with a button creates the same variation problems that crop up when you try to clock-pulse the CPU with a button; However, this worked for me." (from: http://lateblt.tripod.com/z80proj1.htm )

    My reason for doing this is just for fun and to learn, and I don't want to give up on this now that I've spent so much time on it.

    Edit: I doubt the issue is what I quoted. I tried to solder in a microswitch instead of the normal switch I'd been using and there was no difference. All address lines are still always set to 1, and set to 0 while giving it a reset signal.
     
    Last edited: Jun 12, 2016
  4. dave

    Dave New Member

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


     
  5. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK

    HE ... is the circuit as shown in your OP , all the pullups , pull downs ? The concept as has been said is the first fetch from from all address from h'0 to h' FFFF should be a nop ,(h'00) ( even if reset switch bounces ) , higher addresses should be indicating this .

    Totally understand having fun... but not sure where you take it, being a mpu it Z80 needs external code ( instructions ) can be done but becomes complicated . been there 40 years ago...

    Have a look here http://www.shaels.net/index.php/mini80/mini80-general/119-mini8o-overview
     
    Last edited: Jun 13, 2016
  6. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    Very nice project, thank you.

    Maybe I should switch to something simpler, but the whole point is to have external code for me, the fun part is having discrete separate chips. At least that makes it fun for me, which is subjective.

    At least I want to get this simple tester circuit working before I do anything else, it shouldn't be that hard.
     
  7. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    Ok HE ... is your test circuit as it is shown in the original post link ? Have you tried other address pins with led / resistor . I think Z80 requires several clock pulses to perform a reset ,also your CMOS Z80 will be more susceptible to switch bounce , and may not achieve a clean reset , a small ceramic (.1uF - . 47uF) capacitor may help ( pin - gnd) .

    Stick with your set up , its as simple as it gets ! , Did you read the Z80 link text ?, author uses the Z80 to load its own boot in operating system to battery backed SRAM...
     
  8. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    More ramblings ... When i was "doing" Z80 , and then also got interested in PIC controllers, I got to thinking about a hybrid , ( not a new concept ) , The big stumbling block to Z80 development and the like is, code, and how to make it available to the Z80 , a chicken and egg situation, if you had or have access to rom programmers etc OK , or get hold of pre programmed system roms, (Not keen on that solution ) ,Thinking along today's chips what I came up with is a PIC running a supervisor program with FTDI link to PC terminal, for all the HEX loading / running of a 32k SRAM , Z80 could also use PIC serial for its own I/O ... Z80SUPER.jpg
     
  9. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    I have it connected as in the original link, except I've since then wired the data bus directly to ground.

    The expected result is to see the LEDs flash.

    Actual result is that all address lines are pulled up to a high state (4.023 volts).

    I have the following setup:

    Code (text):

    A11 (pin 1): Floating.
    A12 (pin 2): Floating.
    A13 (pin 3): Floating.
    A14 (pin 4): Floating.
    A15 (pin 5): Floating.
    CLK (pin 6): Connected to 12 Hz square wave, verified to be good on oscilloscope.
    D4 (pin 7): Connected directly to ground.
    D3 (pin 8): Connected directly to ground.
    D5 (pin 9): Connected directly to ground.
    D6 (pin 10): Connected directly to ground.
    +5V (pin 11): Connected to +5 volts.
    D2 (pin 12): Connected directly to ground.
    D7 (pin 13): Connected directly to ground.
    D0 (pin 14): Connected directly to ground.
    D1 (pin 15): Connected directly to ground.
    INT (pin 16): Connected to +5 volts.
    NMI (pin 17): Connected to +5 volts.
    HALT (pin 18): Floating. (Note: HALT is an output pin!)
    MREQ (pin 19): Floating.
    IRQ (pin 20): Floating.
    RD (pin 21): Floating.
    WR (pin 22): Floating.
    BUSAK (pin 23): Floating.
    WAIT (pin 24): Connected to +5 volts.
    BUSRQ (pin 25): Connected to +5 volts.
    RESET (pin 26): Connected to +5 volts, pulled to ground via pull-down resistor when a switch is toggled. Untoggled is +5.
    M1 (pin 27): Floating.
    REFSH (pin 28): Floating.
    GND (pin 29): Connected to ground.
    A0 (pin 30): Connected to LED via 470 ohm resistor.
    A1 (pin 31): Connected to LED via 470 ohm resistor.
    A2 (pin 32): Connected to LED via 470 ohm resistor.
    A3 (pin 33): Floating.
    A4 (pin 34): Floating.
    A5 (pin 35): Floating.
    A6 (pin 36): Floating.
    A7 (pin 37): Floating.
    A8 (pin 38): Floating.
    A9 (pin 39): Floating.
    A10 (pin 40): Floating.
     
    The circuit draws around 100.5 mA at 5.13 volts (including the two transistor oscillator circuit that gives it the 12 Hz square wave).

    I have a 1 uF cap between +5 and ground.

    I've tried three different Z80 CPUs (z84C0020PEC).

    I've tried two different switches, now I'm using a microswitch.

    I've tried to use 470 ohm resistors on the data bus, now it is just directly connected to ground. It makes no difference.


    Edit: As far as future projects go, I have a EPROM/EEPROM programmer, and I intend to use that to give it the code. But that's getting a bit ahead of myself when I can't even get the tester circuit to work!
     
    Last edited: Jun 14, 2016
  10. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    Why ? :arghh:
    Several thing occur to me ,,,Mainly this Z80 test lash-up takes no consideration of the Z80 electrical limits, even the 470R on the data / address bus is stressing the output drive capability my DS says outputs are 2 mA sink and 1.6mA source .
    100 mA total suggests to me you killed it (them ) , unless the 12hz osc is taking 80 mA .
    CMOS if over driven can suffer latch up , and fail. Good that you want to learn by a DIY approach but I changed my mind , forget this "circuit" , build / buy something better ....
     
  11. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    I tried that just because another person in the thread here had success with pulling them directly to ground.

    It would seem I'm doing something wrong though, since this person on the forum made it work, and I'm assuming the original designer of the circuit also got it working.

    The oscillator circuit draws only around 10 mA by itself.

    When I hit the reset switch the whole circuit draws around an additional 10 mA too, even though the LEDs all turn off when I hit reset. I release it, it dips down below normal (and the three LEDs turn on and stay on) and then stabilize again.
     
  12. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    Hi HE . 10 /10 for perseverance , The 100 mA has to be wrong, take the Z80 out of the socket , measure the current now ( or is 100mA the power supply as well ? ) . You seem to have all the techie equipment , to make something better , with respect, if you do succeed with this 'test' , you have learned very little about the Z80.
    I had fun with Z80 in the past so I am quickly trying to see if a hybrid would work out Z84C00 . (10Mhz) PIC18F4520 and 32k x 8 SRAM on some vero (strip) board as i speak (type)... Not used PIC18 before only PIC 16 and 24 ,32 . (its too wet to garden here this week )
     
  13. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    Unfortunately it is correct.

    Measuring across both the Z80, its three LEDs, the 1 uF cap, and oscillator circuit: 106.7 mA at 5.13 V
    Measuring only the oscillator circuit and the 1 uF cap: 10.97 mA at 5.13 V

    I keep thinking that there is something missing that should not be floating, that should be pulled to ground or +5. But the halt pin is an output, and I can't think of anything else.

    Any other ideas? Anything I can measure to get me an indication of what the problem is? I'm stuck. Should I replace some components? Try yet another type of switch (I've only tried two different types)?
     
  14. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    Hi HE , most of the reset circuits i have found have some kind of debounce, usually a schmitt gate / capacitor, Reset signal needs to be a clean, 1...0....1 are the Z80's from scrap boards ?.
    Nothing else stands,, out looking at your pin list...
    Perhaps a photo of your 'circuit ' may help...
    I am a couple of hours from my z80PIC hybrid test...:nailbiting:
     
  15. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    Nice. I'm looking forward to seeing that. :)

    What should I search for to find an example of a circuit that deals with this debounce issue?

    This? http://www.labbookpages.co.uk/electronics/debounce.html

    I'd rather just buy some part that does this for me, so I don't mess it up. If you know of a suitable and very simple to use part then please let me know.
     
  16. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    Hi he .. Reset debounce ... was thinking a simple gate / cap set up, as diagram ...not sure this is your problem ! just straw clutching.. are these Z80s "new" ? This is my hybrid so far . think I will start a new thread during its development, thinking the PIC side of it could plug into the z80 bus and load the SRAM from a file on the PC , as you would a mcu programmer... z80test.gif

    HYPICZ80.jpg
     
  17. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    Nice, so you implemented one of Thomas Scherrer's more advanced (compared to my project) designs?

    The Z80's I have are new in the sense that I recently bought them. I cannot tell if they were actually new or previously used. No marks or wear on the print on the DIP.

    I tried to switch to a lower frequency for the oscillator, now at less than 1 Hz.

    I still have the same issue. The LEDs come on, and remain on. No counting.

    However, I did notice that it takes a few clocks after a reset for the LEDs to come on again, as it it needs a few clock cycles to initialize itself. Is this normal behaviour, or is this an indication of some fault?
     
  18. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    if the duty cycle is 12/65536 =0.0001846

    The average brightness is reduced (x) by this amount.

    Try code that uses a 50% duty cycle at 12 Hz or less.

    Consider DSR / DTR with 2.2k active low using Iv > 1000 mcd any color
     
    Last edited: Jun 17, 2016
  19. halleffector

    halleffector Member

    Joined:
    Jan 30, 2016
    Messages:
    98
    Likes:
    0
    Thanks for the suggestion, but I'm afraid I don't understand what your suggestion is.

    Keep in mind that this setup has no code at all, except pulling the data bus to zero to simulate NOPs.
     
  20. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    750
    Likes:
    75
    Location:
    Worcestershire UK
    Not really, the Thomas Scherrer was a 'clean' reset example. after the reset it takes 3 full clocks to start running ,you would have to hold the reset > 3 seconds at 1Hz But if reset switch is noisy on release it will cause problems, check the data sheet. My hybrid is just to test the concept , a Z80 and SRAM with Clock , RD WR etc controlled by PIC , too soon to post a circuit, hope to start the pic code today.. from your observations the fetch instruction is not happening or Z80 not reading h'00 , can you see the M1 change state ? ( use slow clock ) I suggest you put a cap 1uF on the reset pin + [| - gnd with the resistor and switch, it might start as 'designed' on a power up.

    HE ...What are the voltages on all the address pins ?
     
    Last edited: Jun 18, 2016
  21. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    start with LED + R to 5V ,and Cathode ( flat edge) to test point like ground or logic low.
    Then use as a voltmeter for outputs with Anode + R to 5V detecting low level outputs with cathode wire, if you have no meter. Sink current of a couple mA with 2.2k should be brilliant with any Ultrabright colour 1-20 Candela.
     
    Last edited: Jun 18, 2016

Share This Page