ELECTRONIC CIRCUITS AND DIGITAL:BINARY NUMBERS

BINARY NUMBERS

The binary number system is a set of rules and procedures for representing and processing numerical quantities in digital equipment. Because the base of the binary number system is 2, only two symbols (0 and 1) are used to represent any quantity. The symbols 0 and 1 are called binary digits or bits. For example, the 6-bit number 101101 represents the decimal number 45. Your understanding of how digital circuits, microprocessors, and related equipment process data is tied directly to an understanding of the binary number system.

The reason for using binary numbers in digital equipment is the ease with which they can be implemented. The electronic components and circuits used to represent and process binary data must be capable of assuming two discrete states to represent 0 and 1. Examples of two-state components are switches and transistors. When a switch is closed or on, it can represent a binary 1. When the switch is open or off, it can represent a binary 0. A conducting transistor may represent a 1, whereas a cut-off transistor may represent a 0. The representation may also be voltage levels. For example, a binary 1 may be represented by +3.3 V and a binary 0 by 0 V as previously shown in Figure 5.1.

Binary-to-Decimal Conversions

The binary system is similar to the decimal system in that the position of a digit in a number determines its weight. Recall that in the decimal system the weights are powers of 10. The right-most digit is units or 1’s, and then 10’s, 100’s, 1000’s, and so on, moving from right to left from one digit to the next. The position weights of a binary number are powers of 2:

Electronics-Explained-0085_thumb1_th

Now let’s evaluate the decimal quantity associated with a given binary number, 101101. You simply multiply each bit by its position weight and add the values to get the decimal equivalent, 45.

Electronics-Explained-0086_thumb_thu

You can see that positions with a 0 bit have no effect on the value. Therefore, they can be ignored. To quickly determine the decimal equivalent of a binary number, simply sum the weights of the positions containing a 1 bit. For example, in the number 11101, the weights of those positions with a 1 bit from right to left are 1 + 4 + 8 + 16 = 29.

Using Hardware to Represent Binary Quantities

Switches are widely used to enter binary data into computers and digital equipment. If the switch is set to the up position, a binary 1 is represented. If the switch is down, a binary 0 is represented. The switch contacts can be open or closed depending on the circuit in which the switch is connected. Figure 5.2 shows a group of slide switches set to represent a binary number, 11000101 or 197.

Indicator lights such as light-emitting diodes (LEDs) are sometimes used to read out binary data in digital equipment. An “on” light is a binary 1 and an “off” light is a binary 0. See Figure 5.3. The decimal value being represented by the display is 178.

Decimal-to-Binary Conversions

You may find it necessary to convert decimal numbers into their binary equivalents. This can be done by dividing the decimal number by 2, dividing the quotient by 2, dividing that quotient by 2, and so on, recording the remainders until the quotient is zero. The remainders form the binary equivalent.

Electronics-Explained-0087_thumb_thu

Electronics-Explained-0088_thumb_thu

You can always check your work by reconverting the binary number back to decimal using the procedure described earlier. Also, keep in mind that some scientific calculators can do binary-to-decimal and decimal-to-binary conversions.

Another name for a binary number is binary word. The term word is more general. It refers to a fixed group of bits that can mean numbers, letters, or special characters and codes. We say that digital equipment processes binary data words.

All digital circuits and microcomputers work with a fixed-length binary word. A common binary word length in microcomputers and other digital equipment is 8 bits. All data storage, processing, manipulation, and trans- mission are carried out in 8-bit groups. Word lengths of 4, 8, 12, 16, 32, and 64 bits are common in digital equipment.

An 8-bit word is usually called a byte. In data communication applications, an 8-bit word is sometimes called an octet. A 4-bit word is sometimes referred to as a nibble.

Maximum Decimal Value for N Bits

The number of bits in a binary word determines the maximum decimal value that can be represented by that word. This maximum value is determined with the formula:

Electronics-Explained-0089_thumb_thu

where M is the maximum decimal value and N is the number of bits in the word.

For example, what is the largest decimal number that can be represented by 4 bits?

Electronics-Explained-0090_thumb_thu

With 4 bits, the maximum possible number is binary 1111, or decimal 15.

The maximum decimal number that can be represented with 1 byte is 255 or 11111111. An 8-bit word greatly restricts the range of numbers that can be accommodated. But this is usually overcome by using larger words.

There is one important point to know before you leave this subject. The formula M = 2N – 1 determines the maximum decimal quantity (M) that can be represented with a binary word of N bits. This value is 1 less than the maxi- mum number of values that can be represented. The maximum number of values that can be represented (Q) is determined with the formula:

Electronics-Explained-0091_thumb_thu

With 8 bits, the maximum number of values is 256 or 0 through 255.

Table 5.1 gives the number of bits in a binary number and the maximum number of states that can be represented.

Electronics-Explained-0092_thumb_thu

The binary numbers we have been discussing are usually referred to as pure binary codes. But there are other types of binary codes. For example, the binary-coded decimal (BCD) system is popular. BCD is a hybrid code between the binary and decimal systems. It was developed in an attempt to simplify the conversion processes between the two systems and to improve human–machine communication.

To represent a decimal number in the BCD system, each digit is replaced by its 4-bit binary equivalent. Thus, the number 729 in BCD is:

Electronics-Explained-0093_thumb_thu

The BCD code is given in Table 5.2.

It is important to note that the 4-bit binary numbers 1010 through 1111 that represent the decimal values 10 through 15 are invalid in BCD.

To convert a BCD number to decimal, simply substitute the decimal equivalent of each 4-bit group. The BCD number 1001 0100 0110 in decimal is 946.

A special form of BCD code is used in computers and data communications systems. It is a 7- or 8-bit code that is used to represent not only numbers but also letters (both uppercase and lowercase), special symbols, and control functions. This code is called the American Standard Code for Information Interchange, or ASCII (pronounced “ask-key”).

Electronics-Explained-0094_thumb_thu

The complete ASCII is given in Table 5.3. It provides the decimal and hexadecimal (hex) values of the codes. The code contains both uppercase and

Electronics-Explained-0095_thumb_thu

Electronics-Explained-0096_thumb_thulowercase letters, the digits 0 through 9, punctuation marks, common mathematical symbols, and many special two- and three-letter codes. The special codes are known as control codes. They are used to indicate the start and end of a string of characters or to initiate special operations. Some examples follow:

Electronics-Explained-0097_thumb_thu

Electronics-Explained-0098_thumb_thu

Parallel and Serial Data

It is frequently necessary for digital devices to communicate. Someone using a computer may have to send data to a printer. Or two people using personal com- puters may have to communicate over a local area network (LAN). To accomplish either of these objectives, one must transmit binary data from one circuit to another. This is done in one of two ways: parallel transmission or serial transmission.

Parallel Data

When the parallel method is used, all bits of a binary word or number are transmitted simultaneously. Figure 5.4 shows an 8-bit word being transferred from logic circuit 1 to logic circuit 2.

A bus is a set of parallel data lines over which digital data is transferred. A data bus can have any number of data lines as required by the application. However, the main characteristic of a bus is parallel data transfer. In physical form, a bus is usually implemented on a connector, with lines of copper on a printed circuit board or with a ribbon cable with one wire per bit.

Because all bits are transmitted at the same time over a parallel bus, data movement is extremely fast. The main benefit of parallel data transmission is its high speed. With high-speed logic circuits, a binary word can be transferred from one point to another in as little as several nanoseconds. Parallel data trans- mission over buses in computers takes place at rates up to several hundred meg- ahertz. It is not uncommon to see a rate of 100 million bits per second (Mbps)

Electronics-Explained-0099_thumb_thu

on a personal computer data bus. On long buses, data rates are slower because the stray inductance and capacitance of the cable typically distorts the data and slows the transmission speed.

Although parallel transmission is fast, it is expensive, because there must be circuitry for each bit on both the sending and receiving ends. There must be one wire per bit in a cable plus a separate ground wire. This increases the complexity and thereby the cost of the circuitry.

Serial Data

The other method of moving binary data from one point to another is serial transmission. In the serial method, the bits of a word are transmitted one at a time, or sequentially. Figure 5.5 shows the waveform of an 8-bit serial binary word. This is the voltage that you would monitor at the single output of the circuit generating the word. It is the waveform that an oscilloscope would dis- play. Each bit occurs for a fixed time interval such as 1.5 milliseconds. Thus, it takes 1.5 X 8 = 12 milliseconds (ms) to transmit an 8-bit word.

The speed of data transmission is measured in bits per second (bps). That figure can be calculated from the expression:

Electronics-Explained-0100_thumb_thu

As seen in Figure 5.5, the MSB is transmitted first. Depending on the system used, however, the LSB can be sent first. In any case, the speed of transmission depends on the number of bits in the word and the duration of each bit. It is this longer transmission time that is the primary disadvantage of the serial method. However, although serial transmission is slower than parallel transmission, it is perfectly suitable for many applications. Common data rates are in excess of millions of bits per second. Data rates of more than 10 Gbps are common.

The main benefits of the serial method are its simplicity and low cost. Only a single line rather than multiple lines is needed to interconnect the equipment. In addition, only one set of sending and receiving circuits is needed. All data transmissions by copper cable or fiber optical cable exceeding about 100 Mbps are made by the serial method. All wireless data transmissions are serial.

Leave a comment

Your email address will not be published. Required fields are marked *