Differentuating a different logic states/pulses on oscilloscope

Discussions about Sinclair ZX80 and ZX81 Hardware
willinliv
Posts: 7
Joined: Sun Jun 28, 2020 9:07 pm

Differentuating a different logic states/pulses on oscilloscope

Post by willinliv »

Hi All,

Quite new to digital electronics and I'm have trouble telling my highs, from my pulses or my pulse highs!

I'm trying to learn from a functioning Issue 3 board, in order to eventually troubleshoot an issue 1. The issue 1 has ULA issues as no clock on pin 14. I have found useful posts on here (such as this one https://www.sinclairzxworld.com/viewtop ... f=7&t=1851) in which other users have shared what logic state each pin should have on respective chips, specifying Pulse, High, Low, Open, Pulse High, Pulse Low, Pulse High Low. I have a laser logic probe but it doesn't seem to pick up on any pulsing at all!

I do however have an oscilloscope, and I have been examining the ourputs of each pin, but I can't tell the difference between states. I have a feeling that it does not really matter, and the some of the decriptions are nominal, but I'd like to know! Could anyone give me a pointer?

I attach a few pics from the scopes screen when testing pins on the ULA of the working machine

Picture 1 - Pin 1 - High?
Picture 2 - Pin 15 - Pulse High?
Picture 3 - Pin 19 - Pulse?

Thanks and best wishes to all, Will
Attachments
Picture 2.jpg
Picture 3.jpg
picture 1.jpg

User avatar
1024MAK
Posts: 2989
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Differentuating a different logic states/pulses on oscilloscope

Post by 1024MAK »

Okay, let’s start slowly.

In even a simple computer like the ZX81, things get complicated very, very fast. What appears to be simple on the outside is not always representative of what’s happening out of sight to these large water filled bags of salty water that have descended from apes that sit in front of the keyboard...

Primarily because the human eye and the human brain, wonderful though they are, are just far too slow to process data at the speeds that even 1980s electronics can manage.

Hence when a human is reading the LED display on a logic probe, or on a oscilloscope, rather than trying to get someone who may be inexperienced with electronics to try to actually describe what they are seeing, and end up with a lot of confused and therefore not very helpful information, it’s easier to break it down into just a handful of states. Of course, there is a great heap of subjectivity with some of the states.

Note that in the following text, all measurements are referenced to the system 0V/GND/ground connections. In a ZX80, ZX81, TS1000, ZX Spectrum etc... this is either the metal tab of the 7805 voltage regulator, it’s heatsink, the case of the modulator or any other suitable point that is electrically connected to this same power network. Please note that these points are not directly connected to mains earth (ground) or to any other earth or ground (unless you are using a different PSU or your TV / monitor or another peripheral or interface has a connection to mains earth / ground). 0V/GND is used because it is the common electrical return path for both the power feeds and all the signals.

In a ZX80, ZX81, TS1000, ZX Spectrum, in fact any computer using a NMOS Z80 processor, all the logic levels (bar a couple) are to the TTL logic levels.

So starting with static (unchanging) states:
Logic low or logic zero means the voltage level on the digital signal line is between 0V and 0.8V.
Logic high or logic one (binary one) means the voltage level on the digital signal line is between 2V and 5V.
Over on another forum, StarDot, I posted a diagram showing the TTL logic levels link.

On certain control pins, you will normally find such static signals, e.g. on the Z80 on pin 25.

However on most of the connections, the signals are constantly changing and at a fast speed. The master clock, which is (supposed to be) a nice square wave (Z80 pin 6) has a frequency of about 3.25MHz. That’s 325 times faster than a 10kHz audio tone that most humans can hear. If a good quality logic probe is used on a signal like this, both the green (low) and red (high) LEDs will appear to light up dimly.

Internally, the Z80 runs its operations at this speed. Or at a lower frequency.

If a signal is mostly logic high, but occasionally changes to a logic low, but only for a short time, this is described as a low pulse.
Similarly if a signal is mostly logic low, but occasionally changes to a logic high, but only for a short time, this is described as a high pulse.
Where a signal is not predominantly at either logic low or logic high, then that is described as a pulsing signal.

More later...

Mark

User avatar
1024MAK
Posts: 2989
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Differentuating a different logic states/pulses on oscilloscope

Post by 1024MAK »

Because some of these pulses are of a very short duration, your eye will be far too slow to pick up a fast narrow pulse. So some logic probes have a pulse detector / pulse stretcher circuit, which then feeds a (normally yellow) LED and lights it for long enough that you can see it. Some logic probes have a sounder that changes tone between a logic zero, a pulse and a logic one.

[By the way, I have a nasty tendency to switch without warning between logic low / high and logic zero / one terminology :roll: Blame me for having many fingers in many pies :mrgreen: ]

An oscilloscope can show far more than any logic probe. However, a lot of the time, what we are looking for is activity on a signal line, and are the logic levels in the valid voltage ranges. Not what information the signal line is (trying) to convey. Why you ask? Because in order to work out the meaning, you need context, and for that you have to know what a lot of the other signals are doing at that exact time (and just beforehand).

Note that although comparing a faulty system to a working system is a good thing to do, keep in mind that bit about context. In a working system, the Z80 will be correctly following the instructions from the ROM. In a system that is not working correctly, any number of different things can be going on because there is a high likelihood that the Z80 is reading garbage instructions due to a fault somewhere. Alas, just one signal being affected can mess up the whole operation of the computer :(

More later...

Mark

User avatar
1024MAK
Posts: 2989
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Differentuating a different logic states/pulses on oscilloscope

Post by 1024MAK »

So, how do you know what to expect on the various digital signal lines in a ZX81 or TS1000 computer (or indeed on any computer based on a Z80 microprocessor)?

Well for that we really need to start with the basics of computer architecture.

A microprocessor (including the Z80, the 8080, the 8085, the 6502, the 6809, the 68xxx (‘68k’), the 8088, 8086 etc...) are all very, very dumb. But they are also very quick. They are extremely obedient and (for the most part) do exactly what they are told to do.

The following applies to a Z80, but the other microprocessors listed above are somewhat similar.

The Z80 needs a heartbeat. It needs a signal to help it keep the world in a nice repetitive ordered sequence. This is the clock signal. It controls the timing of the internal Z80 sequencing. In a ZX81 this is a 3.25MHz signal. Without a clock, the Z80 will just sit there doing nothing at all. The clock input is on pin 6. Everything as far as the Z80 and all the chips it communicates with are concerned are timed by this clock frequency.

When an electronic circuit is powered up, it’s a total world of chaos, nothing can remember what state it should be in. Including the Z80. Hence it has a special input, called /RESET.

Before going any further a slight aside. What’s the “/” all about?

In a lot of computer systems, so called negative logic is used (not to be confused with equipment that runs off negative DC power supplies, don’t ask, no really, don’t).

What do I mean?

Well let’s look at positive logic first. When a signal is logic low (zero), it’s “off” or a binary zero. Or in numbers, it’s the number 0. If you have four such signals, you can count in binary:
0000 = zero
0001 = one
0010 = two
0011 = three
Etc...
up to...
1111 = fifteen

:arrow: if you don’t understand binary, go and learn about it now. Also learn about hexadecimal at the same time ;)

If a control input is using positive logic, a binary 1 turns it on, or makes it active, while a 0 turns it off, or deactivates it.

That’s positive logic.

But we can’t have life nice and simple, that makes it far too easy...

Anyway due to the nature of how the chips actually work, negative logic is more useful.

So with negative logic, instead of a binary 1 turning it on, instead a binary 0 turns it on, or makes it active, while a 1 turns it off, or deactivates it.

To denote this on diagrams and in text, a circuits function or name will have a bar over it or an overline (hint to the technical admins, this can now be enabled in phpBB forum software, see this link and an example of it being used is in this topic and this topic on Spectrum Computing).

You can see the Z80 control signals with the bars above the function / pin names in the chip pin-outs in this topic (also linked in my sig.).

But where it is not possible to do an overline, instead we use a forward slash / just before the function or name, like so:
/MREQ

Hence the /MREQ signal is logic high when inactive and goes low to signal that it is in its active state. The computer system logic will therefore only respond to /MREQ when it is logic low. This is negative logic.

So back to /RESET...

The Z80 needs to be told after the power has been applied to er, reset and to clear certain registers and flags (memories) and to start execution from a fixed preset address in memory.

Hence the computer system board should take the /RESET pin low for a short time just after power is applied to ensure that the Z80 is reset and that it will automatically start executing code as soon as the reset pulse ends (that is /RESET goes high).

If /RESET is held low for any reason, the Z80 will obediently wait until it goes high before doing anything useful.

More tomorrow...

Mark

Moggy
Posts: 2031
Joined: Wed Jun 18, 2008 2:00 pm

Re: Differentuating a different logic states/pulses on oscilloscope

Post by Moggy »

Excellent just excellent. :D

willinliv
Posts: 7
Joined: Sun Jun 28, 2020 9:07 pm

Re: Differentuating a different logic states/pulses on oscilloscope

Post by willinliv »

Hi Mark, Thanks so much for taking the time to write for me such an easy to understand and forgiving starting point to my question!

I did have a logic probe which was supposed to include a yellow led to indicate pulsing but it didn't seem to function (I think by it's chirping I could probably have reakoned that this was a pulse) but keen to get my oscillocope out. Ive actually gone through all of the pins tonight to examine nature/type of signals and levels. I do need to follow up upon some of the early links you put in your posts there about digital logic, but your description of high pulse now makes sense, in the same way that a northerly wind is blowing towards the north rather than originating from the north (I've probably got that wrong :lol: ). I did do a bit of digital electonics at uni, the apex for me was making a digital clock out of I think 7405 and 8-segment displays, but it was a long time ago! And obvs really basic, but very enjoyable. I might dig out my old breadboards to recap some things.

I can't remember if you wanted me to ask why some chips are negative logic or not!? Quick read elsewhere and it taking less power to have active low logic but also better for differnutating logic with noise etc. I read on here I think from a question where it got raised that the ULA's clock get's inverted through a transistor circuit to be acceptable on pin 6 of the Z80, so guessing this is it at play. Had seen /Reset but not twigged this or the overline.

Also a really nice starting point to think about the higher level stuff with regard to the what happens on power-on here with the chip. I've only been looking into this a couple of weeks so I need to do a bit of reading. Couple of quick follow-up questions: Are we talking TTL on the ZX81, for example the Z80, or is a mixture? Secondly, and this is where I need to read up on, how does the Z80 know on /reset which registers to clear and also the address in the guessing ROM to start getting instruction from?

Thanks ever so much for you patience and your genorosity of your time in that post! Best, Will

User avatar
1024MAK
Posts: 2989
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Differentuating a different logic states/pulses on oscilloscope

Post by 1024MAK »

The original Z80 line uses NMOS technology that is designed to be signal level compatible with TTL logic chips. Hence why in most computers that use a Z80, the smaller logic chips (“glue logic” because they glue everything together) are 74 series devices (for example 74LSXXX). You can clearly see this in the ZX80 and in the ZX Spectrum (board issues 2 to 4S).

The ROM and the SRAM chips are also not TTL technology, but are also designed to be compatible with TTL logic levels. The ULA does use a type of bipolar transistor technology, but it is not TTL technology. It does have internal interface circuitry so it can communicate with the outside world using TTL level signals if configured (at time of manufacture) to do so.

There are many reasons for negative logic, but I don’t intend to go into great detail here. However I will give you one example: the reset line. A resistor pulls the /RESET line high. At power on, a capacitor connected between the /RESET line and 0V/GND means that as the board gets power, the capacitor holds the /RESET line low for a short time. But any other device can also activate the /RESET line by using a single transistor to take the /RESET line low. Or a push switch can do the same. This is sometimes known as a wired-OR arrangement. It is an extremely cheap and practical way for many devices to be connected to a single control line.

The reason for the transistor in the clock circuit between the ULA and the Z80 has nothing to do with negative logic. The reason for it is because the clock pin on the Z80 is not a TTL signal level type. The clock input pin has a requirement for the high part to be at a greater voltage than a normal TTL level. This is why the transistor is being used, to allow the associated ‘pull-up’ resistor to pull the voltage up to close to the +5V supply rail voltage.

The Z80 has special circuitry to carry out the reset function. It’s hardwired internal logic. The starting address bit is easy to understand, the program counter (PC) register is cleared (reset) to zero. Hence once reset ends, the Z80 will put address zero (0x0000 in hex or 0 in decimal) on the address bus, and hence the first instruction will be fetched from whatever memory responds to address zero. In the ZX80, ZX81, TS1000 and all the ZX Spectrums, at power on, this is always ROM.

Apart from jumping ahead to answer some of your questions, I was intending to go through the hardware basics in a logical, step by step order.

More later...

Mark

User avatar
1024MAK
Posts: 2989
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Differentuating a different logic states/pulses on oscilloscope

Post by 1024MAK »

Before moving into details of the other control lines of the Z80 processor, it’s time to give an overview of the architecture of a microcomputer.

The microprocessor unit (MPU) is the control element. The memory and most input/output (I/O) chips will only respond when the MPU tells them to.

A computer normally has the following elements: CPU (central processor unit) or MPU, non-volatile memory, read and write volatile memory, input and output systems/circuitry.

These days, CPU is the more common term and is used by lay(wo)men to describe any processor, but in the 1980s the correct term for a system only having a single processor was MPU. CPU was a term used for the central processor board in much more expensive and much larger and more powerful computers.

The memory chips can be a number of different types, each of which has different characteristics and different functionality.
For a simple single board computer like a ZX80, ZX81, TS1000 and TS1500, the memory chips used are:
  • non-volatile memory or read only memory - this type retains its data when it is unpowered. It is subdivided into a number of different types:
    • Mask ROM (read only memory), a chip manufactured with the required data permanently fixed in it, known as a mask ROM. Mask ROM chips are only economic if you want tens of thousands made. Hence normally only used by original equipment manufacturers during production runs.
    • EPROM (erasable programmable read only memory). If a ROM is not available or different code is being used (e.g. during development when the code changes as different bugs are removed, new features added etc...). In normal use in a computer system, these work just like a ROM. But a special programmer can programme in (or ‘burn’) new data when required. To erase the data, the EPROM chip has to be put in a special eraser which uses a specific wavelength of UV light to ‘discharge’ the memory cells back to their ‘blank’ state. Note that a programmer can’t undo any programming that has already been done.
  • read and write volatile memory - RAM (random access memory), RAM in the 1980s came in two main types:
    • SRAM (static random access memory) - the easier to use of the two types, but per byte, it was more expensive than DRAM. SRAM chips however could store data words that are 4 bits wide or 8 bits wide. So only two or one chip(s) are needed for a minimalist computer.
    • DRAM (dynamic random access memory) - harder to use than SRAM, but if you need a lot of memory, much cheaper per byte compared to SRAM. The DRAM chips that were available in the early 1980s could only store ONE bit of a eight bit byte, so for a eight bit MPU like the Z80, you need eight DRAM chips. DRAM chips forget the data that they are supposed to be storing if left alone. To retain the data, they have to be subjected to a ‘refresh’ cycle. This refresh cycle tells the chip to restore the data that it already has stored. It will then be fine until the next refresh cycle is due. Typically a refresh cycle occurs every 2ms.
The ZX80 uses one ROM chip and two 4 bit wide SRAM chips. The ZX81 normally uses one ROM chip, and either two 4 bit wide SRAM chips or one 8 bit wide SRAM chip. The TS1000 normally uses one ROM chip and one 8 bit wide SRAM chip. The TS1500 normally uses one ROM chip and eight one bit wide DRAM chips.

All memory chips have at least one data output pin, with EPROM and RAM chips having input pins as well, or combined input/output pins. They also have multiple address pins and some control pins.

Mark

User avatar
1024MAK
Posts: 2989
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Differentuating a different logic states/pulses on oscilloscope

Post by 1024MAK »

Input / output

In a microprocessor system, input and output (I/O) systems and circuitry can take many forms. From relatively simple LED indication lights through to high resolution video displays.

In a Z80 system, the designer of the Z80 used the system that allows input / output circuitry to be separately address compared to main memory. However some computer designers did put some input / output systems as part of the main memory area.

Regardless of how the processor sees the I/O systems, they are connected to the MPU just like memory.

In a ZX81, TS1000 and TS1500, there is only one I/O chip, that’s the ULA.

The busses
The Z80 MPU, in common with most other eight bit processors uses a eight bit data bus. The eight bit data bus uses eight bidirectional lines (signals) to communicate data or instructions between memory or I/O devices/systems and the MPU. Using eight lines allows one eight bit byte to be transferred at a time. The data bus goes between the MPU and all memory chips and I/O chips that the MPU has access to.

In order for the MPU to tell the memory system or the I/O system which memory location or which I/O device it wants to transfer data to/from, the MPU will have an address bus. The Z80 as with most of the other eight bit MPUs uses a sixteen bit address bus. This allows it to address 65536 bytes (or 64 x 1024 = 64k bytes) of memory and up to 65536 I/O registers (or equivalent).

The address bus is however unidirectional, the MPU outputting the address and the memory or I/O circuitry only “reading” the address information.

Unlike the data bus, not all lines of the address bus have to go to all memory chips or all I/O chips. Only the lines actually needed are connected through. Some address lines instead go to the ‘address decoder’ logic.

There is also a control bus. This varies widely between different MPU types. Hence the control bus used with a Z80 is different to that used with a 6502.

The basic principles are however the same. The control bus tells everything else whether the MPU wants to read data, write data, or perform a different operation. Some MPUs also have control inputs, for example, the hardware system may be able to signal an ‘interrupt’ request. Or signal to the MPU to slow down and wait if a particular item of memory or I/O is not yet ready to complete its data transfer.

Some control lines go to memory chips, some to I/O chips and some to the ‘address decoder’ logic. Some may not be used at all.

In a ZX81, TS1000 and TS1500, the ULA does the memory address decoding and the I/O address decoding.

Mark

User avatar
1024MAK
Posts: 2989
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Differentuating a different logic states/pulses on oscilloscope

Post by 1024MAK »

Image
Please note that the control lines and various other circuitry is not shown. The address bus and the data bus are both separated into two sections each in a real machine to support the special way that the ZX81 video system works. But for the purpose of explaining the basics of how a ZX81 works as far as the processor is concerned, I'm leaving these details out.

Mark
Attachments
ZX81 Simplified Block Diagram
ZX81 Simplified Block Diagram

Post Reply