# Does computer memory record the zero binary state?

It's been two years since I started reading about electronics and computer circuits. I fell in love with the homemade computers and the possibility of building one by myself. You will see: When somebody explains computer memory, says "There is, and there isn't" "There's Voltage (1) or there isn't voltage (0)"

Is there a way computers record the zero state? (If it's with different voltages, how do they recognize it)

For example, if I want to create a serial paper tape I'm going to put a hole where there's a one, and I'm not going to do so when there's a zero. But my computer will not recognize that "lack of hole" as a zero, and when reading:

If the original signal is: 1010

Then in the tape it's: 1(Nothing)1(Nothing)

Wich turns out on the final data as: 11 (That is, not correct)

I know that computers use something like timing or control signals whether must be data or not. Can someone explain me that?

Thanks by now.

PD: I don't know if it's the best forum. But since my question is about the electronic way computers read and write data, I decided to post here. Don't kill me, please T.T!!

• of course a computer(at least the memory) needs to save the 0 as well. actully. if this is really zero is not necessary. we just need two different representations. e.g. two different voltages represrnting the two binary states. – Sir Sy Jul 9 '18 at 20:11
• Keep in mind, zero is a voltage. It is recognized by comparing it relative to other voltages. – evildemonic Jul 9 '18 at 20:36
• But my computer will not recognize that "lack of hole" as a zero ... that is not true .... punched paper tape has sprocket holes that are used to move the tape over a sensor (like a movie film) .... the tape will move a fixed distance for each "bit" of data, at which point the tape is read by a sensor .... that way, holes and no-holes can be read – jsotola Jul 9 '18 at 23:12
• Well obviously, your computer does have to recognize the lack of a hole as a 0! – immibis Jul 10 '18 at 0:35
• I suppose you could label the high state 1 and the low state 2 – laptop2d Jul 12 '18 at 5:41

If the original signal is 1010 then in the tape it's 1 (Nothing) 1 (Nothing) which turns out on the final data as 11. (That is, not correct.)

You have spotted the problem with basic binary serial transmission. There are two common ways around this:

• Send a separate clock pulse alongside the data. In your paper tape example it would mean punching a second line of holes, one per bit. Now we monitor both lines of holes and the 'clock' holes tell us when to look for a data hole. If we find one we record a '1' and if we don't we record a '0'. This scheme is called synchronous data transmission.

Figure 1. Asynchronous serial data transmission. Source: Wikipedia.

• Agree a data rate (see baud rate). In this scheme we both agree that the '1's and '0's are going to be a certain distance or time apart. On your paper tape that might be a 3 mm pitch. All that is required is to start the machine up, punch one hole for a 'start' bit and then punch or not punch subsequent bits according to the data pattern. A problem with this is that any error in the feed rate will accumulate and the timing will go off. To get around this a start-bit is transmitted every so often. For RS232, for example, the data is broken up into 7 or 8-bit words and each is preceded with a start bit ('1') and terminated with one or two stop bits ('0'). This allows the receiver to retrain. This method is called asynchronous transmission.

A further note that may help your understanding: When the start bit is received the receiver will wait one and a half cycles and start sampling in the centre of the subsequent bits. That way if the clocks are slightly fast or slow the sampling should be still within the bit width and allow accurate data recovery.

• third common way: Manchester and alikes. It requires a "piece" of knowledge about rate, but not quite an agreed rate (just a maximum duration for an on- or off-state). Another option is of course full clock recovery from the data stream, but that's already pretty close to agreeing on a rate. – Marcus Müller Jul 9 '18 at 20:33
• It might be worth mentioning that in a paper tape system, the "clock holes" you describe would actually exist as sprocket holes which are used to move the tape to successive punch positions. So unlike typical electronic transmission, the data bit timing is actually controlled by the reader: any irregularities in the punching will affect the tape movement rather than the reader's timing. – Kevin Reid Jul 9 '18 at 22:12

A common misconception is that you can have a point in a circuit with "no voltage". That's not really true, and when people say that they usually mean that there is a voltage of 0V. Another important thing to remember is that when we talk about the voltage at a point in a circuit we really mean the voltage difference between that point and a common reference point that is usually called ground.

So, when we say that binary data is stored as voltages, what we really mean is that a logic '1' is a relatively high voltage and a '0' is a relatively low voltage, where again all voltages are measured with respect to ground. For a digital circuit operating at 3.0V, any voltage greater than 2.0V might be interpreted to be a '1' and any voltage less than 1.0V might be interpreted to be a '0'.

Of course, if you are transmitting data then there must be a way to tell when a valid data bit is present on the signal line. This is a separate issue from how data is stored as voltages, and @Transistor did a good job of addressing those issues.

• Thanks, but how does the system realize that 2.5 volts is a 1 and 0.5 volts is a 0? How the final output ends being On or Off (Like on a led or lamp) and not 'Strong' or 'Weak'. I mean, A voltage grater than 2 volts will be brighter than one below 1 volt. Do you understand me? Thanks for your answer. – coldSunday Jul 9 '18 at 22:48
• @user193176 - by using transistors that are designed to turn either completely on or completely off within a very small voltage range, and avoiding having any data that is inside that voltage range, so there's effectively nothing in the mid-range and you only ever see whatever the highest voltage in the circuit is or 0V as an output. – Jules Jul 10 '18 at 0:23
• @user193176 look up how logic gates are built out of transistors. Really the transistors don't know whether it's a 1 or a 0. – immibis Jul 10 '18 at 1:24

As you've worked out, obviously, your computer does have to be able to store 0s. You can either use a different symbol for 0, or you can use the lack of a 1 to store a 0 - but in that case, the computer has to know where the 1's could be so that it can tell between a 0, and something that's not actually part of the data.

In electronic signals, we can use a voltage for 1 and no voltage for 0. Key to this is that the computer is only looking for voltage on the signal wires. There's no voltage between the wires, or on the plastic case, but it's not a problem because the computer isn't looking there.

In the simplest SRAM memory cell, for example, you have two gates - one of which is on, and one of which is off. You pick one side and say "this is the side that stores the bit". If that side is on it's a 1, if that side is off it's a 0. There's no other possibility (both gates can't be off, unless the computer is unplugged) and there's no possibility of looking in the wrong place (the computer isn't going to miswire itself and try to read from where there isn't a memory cell). So there's basically no possibility for a screwup of this sort.

On tape and disk media, and serial signals in general, the computer does need to be careful to look where there is data. There are a whole lot of different approaches to this.

Perhaps the simplest is to just have two lines of holes on your paper tape, and say that a hole on the left side is a 1 and a hole on the right side is a 0.

More complicated encoding methods allow the computer to "lock onto" the hole spacing. If you have a hole every half centimetre, and you go half a centimetre without seeing a hole, that's a 0. But what if your computer measures it as 0.499cm instead of 0.500? Or what if the person who wrote the tape measured it as 0.499cm? Then it could drift out of sync and you'd see an extra 0 occasionally, or miss a 0. Therefore there needs to be at least one hole every so often, so the computer can reset its measurement so it doesn't get too far out of sync. The advantage of these kinds of methods, compared to the two-track method, is you can get almost twice as much data in the same space. (You could also go by timing, instead of distance)

In the UART protocol, you have a bit that is always 1, in front of each byte, and the 8 bits in the byte are timed. The 1 bit (which would be a hole in your case) gets the reader in sync for the next 8 bits (at least) and the reader knows not to send the extra bit to the computer.

Another approach could be to use a kind of frequency modulation - where (say) a hole less than 0.5cm from the last hole is a 1, and a hole more than 0.5cm from the last hole is a 0.

There are multiple different types of computer memory, and these all vary in the details, but the basic principles are the same: different voltages are used to represent zeros and ones, and a voltage comparison circuit is used to detect these differences.

For a concrete explanation, I'll stick with just one kind of memory and one kind of voltage detector, in this case the type of memory that's called "dynamic RAM" or "DRAM" and the kind of circuitry called "low voltage CMOS" or "LVCMOS".

There are multiple kinds of DRAM, but the basic principle behind them is the same, so we can ignore those differences here, which means that DRAM is the most common kind of memory. Your computer's main memory is almost certainly using some kind of DRAM.

DRAM stores the voltage that's used in each bit of memory in a (very small) capacitor. When the system needs to read the bit out of memory, that capacitor is connected to an amplifier that produces a voltage which is then used to drive the logic that uses the bit.

There are also multiple kinds of LVCMOS systems, depending on what voltage they run on. A lot of computers have processors that run on 1.8V or 1.5V, for example. This voltage is called "VDD". In an LVCMOS logic system, usually a bit is considered a 1 if the voltage is greater than 0.7 * VDD, and a 0 if it's less than 0.2 * VDD. If the voltage is between these two bands, then it may not be recognised correctly.

As to how it's recognised, LVCMOS systems are built using two different kinds of transistor: N-channel FETs and P-channel FETs. Both of these transistors have a gate input that controls them and a channel between their source and drain connections that is either conducting or not conducting (i.e. they're effectively voltage controlled switches). If an input is connected to an N-channel FET's gate, then that FET's channel will conduct when the input's voltage is high; for a P-channel FET it will conduct when the input's voltage is low. This is used to vary whether the output of the circuit is connected to either VDD or to 0V in different conditions.

I'm neglecting in this description a few odd cases, but it's worth noting that this isn't necessarily the only way of doing things, and there are different systems out there that work differently. Here are some examples:

• You don't necessarily have to only use 2 voltage levels to store 1 bit of data in a single storage cell; there are other options. For example, a lot of cheap flash memory devices use a kind of flash thats called "MLC" or "Multiple Level Cell" -- these have more than 2 voltage levels and use those to store more than 1 bit, e.g. an MLC storage cell could have 0.2V to represent 00, 0.8V to represent 01, 1.4V to represent 10 and 2.0V to represent 11.
• You could use two separate voltage signals to represent a single bit -- in that case, you can have the bit come into your circuit in two separate wires, and then you have a 1 if wire A has a higher voltage than wire B, or 0 if wire B is higher than wire A. This provides an interesting way of telling whether data is present or not: if the voltages are the same you don't have valid data. This is mostly used for communicating between separate devices (e.g. USB, HDMI and many other modern interfaces use this kind of signal), but is also getting more common inside computer systems as well.
• You talk about wanting to build a homebrew computer, so I'll point out that a lot of homebrew computers specifically don't use DRAM, but frequently use Static RAM, simply because it's easier to interface with, even though it's more expensive and only available in smaller quantities. Static RAM stores its memory bit with two transistors whose gates are connected to each others' channels so that any time one of the transistors has its channel turned on and the other is turned off; then a 1 or 0 is determined by which of them is currently turned on.
• While the title is misleading, this has nothing to do with what the question is actually about. In actuality the only "memory" subject to the question is serial storage formats which share a time synchronization problem more commonly thought of in the context of communication interfaces. – Chris Stratton Jul 10 '18 at 0:41
• @ChrisStratton - I see two questions being asked: one about synchronization and one about storage. The question I'm answering is this: You will see: When somebody explains computer memory, says "There is, and there isn't" "There's Voltage (1) or there isn't voltage (0)" Is there a way computers record the zero state? (If it's with different voltages, how do they recognize it) -- also see the comment left by the OP on Elliot Anderson's answer, which is clearly asking about how analogue voltages are identified as a digital signal. – Jules Jul 10 '18 at 0:47