Rather basic bus question

Discussions about Sinclair ZX80 and ZX81 Hardware
User avatar
RetroTechie
Posts: 379
Joined: Tue Nov 01, 2011 12:16 am
Location: Hengelo, NL
Contact:

Re: Rather basic bus question

Post by RetroTechie »

Thommy wrote:So when designing a circuit I need to ensure that:
  • each line has only one outputting device physically attached;
  • that it has only one logically attached either because some can float when appropriate;
  • that I've found a route to wired-or; or
  • as in the ZX80 (and, off topic, presumably the Spectrum?) I've split the line with resistors so that the signal on one side doesn't damage components communicating on the other?
No there's only 1 HARD rule:

You should make sure that at any time, there are no multiple outputs trying to drive the same signal to a different voltage level.

Since that would be like a 'short circuit' - very unhealthy for the electronics, and also bad for other reasons. Chip selects, tri-state outputs, open collector outputs etc are all just a means to that end. Series resistors limit the 'short-circuit' current in case there are conflicts (like for ZX81 databus). Pull-up resistors make sure that when no output drives a signal, that signal goes to a defined logic level, rather than 'unknown' or 'random changing'.

There's another use for open-collector though: to drive signals with IC's that operate on different supply voltages (not the case for ZX80/ZX81 btw). For example you could hook up a LED+resistor to 9V, and connect - side to open collector output of an IC operating at 3V, and also to OC output of an IC operating at 5V, and also to OC output of a CMOS part operating at 15V (all simultaneously). Either IC could then pull the LED's - wire to ground, making it light up. But there'd never be a conflict since none of the IC's ever tries to drive that wire to an other voltage than 0. This example would be a good reason to find open-collector outputs used somewhere: mixed-voltage systems.
sirmorris wrote:The ZX81 has pull-up resistors on a couple of ULA lines, RAMCS / ROMCS for example, (..)
Schematic says otherwise - these 2 signals have series resistors between ULA and those ROM/RAM pins (not sure exactly why they would be needed btw), but AFAICT no pull-ups.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Rather basic bus question

Post by PokeMon »

zx80nut wrote: The pull-ups perform two purposes
1. any address not handed by the rom or ram would always be read as FF.
2. TTL pull-ups are quite weak, which is why the logic 1 voltage is quite a bit lower than 5V. The pull-ups would help drag this voltage higher, especially as the data has passed through resistors, dropping the voltage lower.
1. This is a good idea in general but not needed for the ZX81 as RAM is not fully decoded and the same RAM is mirrored many times on different addresses.
So the RAM test is made not with check contents FF - its filled and after decremented its contents incremently and checked if memory was decremented before. This will show duplicated RAM addresses and memory test stops. Unused ROM would not help much because the ROM has to know which address is used by ROM and for what. FF wouldn't help this way.

2. As TTL allows voltage to be dropped down to 2,0 V (which is definetly treated as high, same way as 5,0 V) this is not necessary. I never heard that somebody used this to "improve" logic voltage as this would increase power consumption only and it really doesn't matter if voltage is 2,0 V or 3,5 V or 5,0 V. All voltage upper 2,0 V is definetly high. And too many or unused pullups would increase the output low voltage of TTL's.

The trick with the resistors is during video display routine.
* in the first 2 clock states of M1, ULA pulls down the databus to zero for executing nops instead of the real code (and during first clock state read the "code" in the display file.
* then in the next clock states (refresh cycle) the ULA uses the read char before to overload the address on the rom (here real addressbus from cpu is coupled off with the 1k resistor)

The databus of the CPU is in input mode during the first 2 clock states and after in tristate mode during refresh (or floating which is simply same as tristate).
The ULA databus is in input mode during first cycle, output mode (nop) during second cycle and input mode again during T3 and T4.
I think ROM CS is not fast enough to go high and low in between and deliver data within short 300ns - so its kept low and just the address changes for reading another address cell in ROM. So the ROM is not disturbed when showing NOPs to CPU while discoupled with 470R resistor - but can pull down databus low when cpu is in refresh cycle and databus floating and ULA databus is in input mode. So you have a voltage of 10k to 470R divisor of about 0,22 V which means low.

This is described more detailed here by Wilf Rigter:
http://www.user.dccnet.com/wrigter/inde ... torial.htm

As mentioned before, open collector outputs are used for switching different voltages than VCC for low voltage conversion of ICs with 3,3 V for example or high voltages. Tristate (or Z-state) is just for sharing a signal, mostly address and databus in modern computer systems. This is the way DMA is working in your PC (direct memory access) for fast transfer of data from disk to memory. The disk get the read command and the address where data has to be stored, reads internally data while CPU does something else more useful than waiting for data ;) and when the disk is ready to transfer it catches the bus through a signal (bus request), transfers data to memory itself and releases when finished. This is more quickly than let the cpu wait for data, read it first from disk to cpu and write it after from cpu to memory.

Back to the resistors in general for open collectors:
In principle you can drive the databus low without pullup resistors but this takes more time as Z80 input current is maybe only 5uA and you always have capacitors in input and open collector output. Let's say 5pF up to 10pF (input and output). 5uA has the same result like a 1MegOhm resistor and need 5 up to 10 us (microseconds) to get maybe low. But as it is clocked at high frequency you need more fast transistions. As you find in many datasheets, delay time is measured always with a defined (very low) resistor and capacitor (as you can not avoid capacitors in general).

As you find here http://www.datasheetcatalog.org/datashe ... 209_DS.pdf for the 74LS00 - short delay of 3 to 10ns is defined with a 2k resistor and max. 15pF. For the open collector 74LS07 the resistor is defined with 110R for fast switching.

If you study transistor datasheets you will find that the maximum operating frequency is possible only at a defined minimum collector current and will decrease significantly for very low currents. This is always a decision of either fast switching or low power consumption. You can not have all. :mrgreen:
http://www.datasheetcatalog.org/datashe ... yzqszz.pdf (See gain-bandwith product versus collector current)
It has nearly 300 (e.g. gain 30 at 10 MHz at 5 V) with 20mA collector current - but only about 35 (gain 3.5 at 10 MHz at 5V) at 0,1 mA.

PS: Okay - I know about newer HC, HCT families. This only as example for better understanding the basics for the thread opener.
Last edited by PokeMon on Tue Nov 01, 2011 5:29 am, edited 2 times in total.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Rather basic bus question

Post by PokeMon »

RetroTechie wrote: Schematic says otherwise - these 2 signals have series resistors between ULA and those ROM/RAM pins (not sure exactly why they would be needed btw), but AFAICT no pull-ups.
This is used for switch off the internal RAM when putting external RAM expansion on the slot. I think You could switch off ROM same way to use an external (modified) ROM.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Rather basic bus question

Post by sirmorris »

RetroTechie wrote:Schematic says otherwise - these 2 signals have series resistors between ULA and those ROM/RAM pins (not sure exactly why they would be needed btw), but AFAICT no pull-ups.
I stand corrected! :)

Thommy - is any of this helping?? :?
Thommy
Posts: 52
Joined: Wed Sep 28, 2011 6:37 pm

Re: Rather basic bus question

Post by Thommy »

sirmorris wrote:Thommy - is any of this helping?? :?
To an extent but I'm going to need some digestion time, and possibly some sort of resource on basic electrics...

In terms of the emulator, simple wired-or with no direct consideration of electrons seems to work but I'm really more concerned about my overall education. Even if I were interested only to the extent of writing the emulator, there are a bunch of tricky software engineering decisions that I think I would be better placed to make with a better understanding of hardware engineering.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Rather basic bus question

Post by PokeMon »

I think it will help in the beginning just to study datasheets from the used components (Z80 CPU, 2114 RAM, 38818P ROM), espescially timing diagrams and leaving out the electrical specifications. Of course it could be fun to really calculate current, voltage, resistors, capacitors or at least delay times of signals.
Post Reply