Binary Codes Classification in Digital Electronics

Binary Codes in Digital Electronics:

Binary codes are combinations of 0s and 1s used to represent alphabets, numbers, symbols, etc. These codes are an essential part of any digital system such as computers, phones, and television. In short, binary codes are extensively used in communication and information systems. The main reasons for the wide use of binary codes include the following reasons:

In digital technology, only two switching states, viz., ON (0) and OFF (1), are available to represent alphabets and numerals. However, the bits 0 and 1 can represent only four (00, 01, 10, and 11) letters or numbers. It can be seen that these four combinations of bits are not sufficient to represent various languages and number systems. For example, English language requires a minimum of 26 different combinations of bits to represent its alphabets. It can be seen that a 5-bit binary coding scheme can produce 25 = 32 different combinations of 1s and 0s and hence such a 5-bit coding scheme can be used to represent the 26 letters from a to z in English language. In such a coding scheme, as an example, 00001 may be used to represent letter a, 00010 may be used to represent letter b, and so on.

By using error-detecting and correcting codes, errors in received bits produced by the noise existing in transmission channels can be detected. Once the errors are detected, they can be corrected using error-correcting codes. These error-detecting and correcting codes thus ensure exact (or approximately exact) reproduction of signals transmitted from distant channels.

Data-compression codes help to transmit large amounts of data in very short duration of time.

Data encrypting codes help to send secret data over transmission channels.

Coding helps to achieve maximum efficiency in signal transmission.

Signals/data from several transmitting sources can be sent through a single channel using multiplexing techniques. This ensures great economy in signal transmission.

Operations of modern smart instruments and equipments (such as smart phones) depend on binary codes for their smartness.

Artificial intelligence depends heavily on binary codes for their implementation.

Binary codes help in the artificial generation of speech and video signals.

Codes form the basis of many computers operations such as picture and sound enhancement, picture morphing, animation, etc.

Binary Codes Classification

At present, a large variety of binary codes are available for different applications in digital technology. Some of these codes are used for source coding (encoding of spoken and written languages for data transmission). Some others are used for channel encoding, which will help to detect and correct noise-generated errors in received signals. Data compression codes help to transmit huge amount of data in a short span of time. Similarly, data encryption codes help to achieve secrecy in data transmission. There exist several more binary codes for various other applications. In this section, we shall discuss the most commonly used binary source codes such as Morse code, Shannon-Fano code, Huffman code, Baudot code, ASCII code and EBDIC.

The first known binary source code is the Morse code, invented by Samuel Morse in 1837. It was used in his telegraph system to send messages over wired channels. Morse code is an uneven code in the sense that the codes used to represent letters and numerals differ in their length. For example letter A is represented by a dot followed by a dash. But letter B is represented by a dash and three dots. Baudot code, invented Emile Baudot in 1870, is an even-length code; all the codes in this scheme has the same length of 5 bits each. It can be seen that a 5-bit scheme has only 25 = 32 codes to represent a given language. As time passed on, demand for more binary combinations became a necessity and this led to the invention of the ASCII code and the EBCDIC. The classification of Binary Codes in Digital Electronics are as follows,

Hexadecimal to Binary Conversion Examples

Hexadecimal to Binary Conversion Examples

In the case of octal to binary conversion, we had used groups of 3 bits for conversion purposes. This was based on the concept that radix of octal system is 8 = 23. The exponent 3 formed the basis of 3-bit group selection. Extending this principle, we use groups of 4 bits each the case of hex since its radix is 16 = 24.. Example 14 will illustrate the procedure of hex to binary conversion.

Example 14: Find the binary equivalent of the hex number E73.

Solution: For the desired conversion, we prepare Table 1.12 based on the principle described in the case of octal to binary conversion. Note that commas are used to identify the groups in the last row.

Table 1.12 Hex-Binary conversion

Given hex number
Binary equivalent of hex in each column
Binary equivalent of E73
1110,0111,0011  1010011

From Table 1.12, we get the desired answer:

(E73)16 = (111001110011)2

Binary to Hexadecimal Conversion Examples

In the case of octal-binary conversion, we had used 3-bit groups. Following this concept, we use 4-bit groups for hex-binary conversion. Example 15 will illustrate the procedure.

Example 15: Convert binary number 11110100010 into equivalent hex number.

Solution: To solve the given problem, we prepare Table 1.13. In this case also, we use commas to separate the 4-bit groups and add padding bit (0) as the first bit in the first group of 111 to make it into a 4-bit group.

Table 1.13 Binary-hex conversion

Given binary number separated into 43-bit groups
Bits in groups
Corresponding hexl numbers
Hex equivalent of the given binary number

From Table 1.13, we get the desired answer:

(111 1010 0010 0110)2 ≡ (7A26)16

Conversion of Decimal to Hexadecimal Numbers

Conversion of Decimal to Hexadecimal Numbers

Example 12: Convert decimal number 312 to its hexadecimal equivalent.

Solution: As in the previous cases, here also we prepare the decimal-hex conversion table, which is illustrated in Table 1.10. Inspection of the result given below proves that a larger decimal number is reduced to a smaller hex number; this fact points to the compact nature of hex numbers compared to decimal numbers.
From Table 1.10, we get

(312)10 ≡ (138)16­

Hexadecimal Fraction

Example 13: Convert decimal fraction 0.28125 into equivalent hexadecimal fraction.

Solution: Table 1.11 illustrates the desired conversion.

From Table 1.11, we get:

(0.28125)10 ยบ (0.48)16

Conversion from Decimal to Octal Fractions

Octal fractions can be obtained in the same fashion as binary fractions by adopting the procedures developed for the case of binary fractions.

Example 10: Convert the octal fraction 0.352 to equivalent decimal fraction.

Solution: Using the basic definition of fractions, we get

(0.352)8 = 3 ´ 8–1 + 5 ´ 8–2 + 2 ´ 8–3    

Conversion of Decimal Fraction into Octal Fraction

Example 11: Convert the decimal number 83.44 into its equivalent to octal number.

Solution: The conversion is done as shown in Table 1.9, which is the combined integer-fraction table; integer part is towards the left and fractional part is towards right.  In the tabular form shown, we have divided the number into its integral and fractional parts.

From Table 1.9, we get the desired answer as

(83.5625)10 ≡ (123.44)8

Octal Number System and Conversion

Octal Number System: 

In the octal number system, the base or radix is 8 and we have digits from 0 to 7 as its basic elements. For example, 127 is a valid octal number. But 128 is an invalid number in the octal system.

Conversion of a Decimal Number into Its Equivalent Octal Number

Example 7: Convert decimal number 83 into its equivalent octal number.

Solution: We prepare the decimal-octal conversion table as illustrated in Table 1.6, based on the discussions in Section 1.4.2.
From Table 1.6, we get
                                                                     (83)10 = (123)8
Conversion of Octal Number into Equivalent Binary Number

To convert an octal number into binary, we first convert it into its equivalent decimal number, which is then converted into its equivalent binary number. This procedure is illustrated using Example 8.

Example 8: Consider the octal number (123)8. Its decimal equivalent number was obtained in Example 6 as (83)10. We can convert (83)10 into binary as described in Section 1.4.2. However, we can perform the conversion using yet another simpler method. In this process, we divide 83 as the sum of the set of decimal numbers, which are powers of 2. For example, we have seen that 20 = 1, 21 = 2, 23 = 8, and so on. Using this principle, we now decimate 83 into powers of 2 as follows:                                                                        

                                 83 = 64 + 16 + 2 + 1

Now, it is very easy to convert this decimated numbers into equivalent binary. Thus

           (83)10 = 1 ´ 26 + 1 ´ 24 + 1´21 +1´20 = (1010011)2

The above procedure is lengthy and time consuming. There is an easy and faster method to convert octal numbers into binary numbers. For this, first we prepare the octal-binary conversion table, Table 1.7 as shown below. The octal number is then entered in the topmost cells of table. Then its 3-bit binary equivalents are written into the cells in the second row of the table. Finally, we remove the barriers in the table cells and write the combined bits in the third row of Table 1.7, as shown, which gives the desired answer. Commas are used in the last row to identify binary groups.

Given octal number

Binary equivalents


(001 010 011)2

From Table 1.7, we get the desired answer as

   (123)8 = (001010011)2 = (1010011)2

From Example 8, we find that it is very easy to convert octal number to binary.  Similarly, the reverse process also is very fast. For this, we divide the binary numbers into groups of 3 bits each, starting from the right-most bit and then write the corresponding decimal number below these groups.  The final answer will be the octal equivalent of the binary.

Example 9: Find the octal equivalent of (11110100010)2.

Solution: Proceeding as described above, we first prepare the binary-to-octal conversion table, designated as Table 1.8. To draw the columns of this table, we first count the number of bits in the given binary number and then divide it by 3. In the given problem, we have 11 bits. This means that there are three groups of 3 bits each. The remaining two bits form the fourth group. It may be noticed that the grouping process starts from the rightmost three bits, and continue in the left direction. We may separate the groups by using commas as given below:

                                                            11, 110, 100,010

After having decided the groups and its member bits, we draw Table 1.8 and make entries in it as shown. We first enter the given binary number in the first row of Table 1.8. In the second row, we make entries of the groups in their respective cells. It may be noticed that the first cell in this row contains only two bits. To make it into a 3-bit group, we add a 0 (shown in bold font) as its starting bit, so that the given binary number now reads as  011, 110, 100,010. It is clear that this 0 has no significance; it is only added as a padding bit to form a 3-bit group.

After completing the entries in second row of Table 1.8, we proceed to make entries in the cells of the third row. In the cells of this row, we write the decimal equivalent number below each 3-bit group of row two. Thus, below the rightmost group of 010, we enter in row three its decimal equivalent number 2. Continuing this operation, we enter 4 below the group of 100, 6 below 110, and 3 below 011, as shown. In the fourth row of Table 1.2, we combine the digits of row 3 to yield the octal number 3642 as the equivalent of the binary number 11110100010.

It may be noted that the explanation given above is quite lengthy; however, its implementation can be seen to be very fast because there is no need for any lengthy explanations in drawing Table 1.8. Once the principles are clear, drawing Table 1.8 is easy.

                                                        Table 1.8 Binary-Octal conversion
Given binary number separated into 3-bit groups
Bits in groups
Corresponding octal numbers
Octal equivalent of the given binary number

From Table 1.8, we get the desired answer as

(11110100010)2 = (3642)8

Example 10: Find the binary equivalent of the octal number (4321)8.

Solution: Table 1.2 shows the desired octal-binary conversion table. From table 1.2, we get the desired answer as:

(4321)8 = (100011010001)2

Table 1.2 Octal-Binary conversion table

Octal number
Cell binary
Binary equivalent of given octal number
100 011 010 001

Conversion of Mixed Decimal Numbers to Mixed Binary Numbers

Example 6: Convert the decimal number (26.012) into equivalent binary number.

Solution: We first convert 26 into binary whole number, and then (0.012)10 into binary fraction.  This is done as shown in Table 1.4.

From table 1.4, we obtain the binary equivalent of decimal number 26 as 11010. Next, we consider the fractional part. This is done as shown in Table 1.5. From Table 1.5, we find that the binary equivalent of decimal fraction 0.6875 is 0.1011.

Combining the integer and fractional parts, we get

(26.6875)10  = (11010.1011)2

Applications and Advantages of MRI over CT Scan

Applications of MRI:

1. Diffusion MRI measures the diffusion of water molecules in biological tissue
2. Magnetic Resonance Angiography (MRA) is used to generate pictures of arteries in order to analyze their working and abnormalities.
3. Functional MRI measures signal changes in the brain that are due to changing neural activity.
4. In clinical applications, MRI is used to distinguish pathologic tissues such as brain tumor from normal tissues.
 5. An MRI scan can be used as an extremely accurate method of disease detection throughout the body.
6. Neurosurgeons use an MRI scan in order to define brain anatomy and to evaluate the integrity of the spinal cord.
7. It provides valuable information on glands and organs within the abdomen.

Advantages of MRI over CAT:

1. The most important advantage of MRI scan is that it is proved to be harmless to the patients.
2. It uses a strong magnetic field and non-ionizing radiation in the RF range.
3. MRI provides good contrast resolution than CAT scanning. The contrast resolution is the ability to distinguish the differences between two arbitrarily similar but not identical tissues.
4. In MRI by variation of scanning parameters, tissue contrast can be altered and it can be changed in various ways to detect different features.
5. MRI machines have the ability to change the imaging plane without moving the patient.
6. As the MRI scanning does not use ionizing radiation, it is best suited for cases when a patient is to undergo the test several times successively.
7. The brain, spinal cord and nerves are seen much more clearly with MRI scan

Positron Emission Tomography (PET) Scan

It is a nuclear medicine imaging technique that produces a 3D image or picture of functional processes in the body. A positron emitting radionuclide (tracer) is introduced in the body. PET system detects a pair of gamma rays emitted from the tracer 3D images of tracer concentration within the body are then constructed by computer analysis. Commonly the biologically active module chosen for Positron Emission Tomography (PET) Scan is fluorodeoxyglucose (FDG) which is an analogue of glucose.

Operation in detail:

Before conducting the scan, a short lived radioactive tracer isotope is injected into the living subject.The tracer is chemically incorporated into a biologically active molecule. The molecule most commonly used for this purpose is FDG. There is a waiting period while active molecule becomes concentrated in tissues of interest. Then the subject is placed in the imaging scanner (usually one hour). During the scan a record of tissue concentration is made as the tracer decays.

As the radioisotope undergoes positron emission decay, it emits a position. Positron is an antiparticle of the electron with opposite charge. The emitted positron travels in the tissue for a short distance. This distance is typically dependent on the isotope. During this travel, the positron loses its kinetic energy until it decelerates to a point. At this point it can interact with an electron. The encounter annihilates both electron and positron producing a pair of annihilation (gamma) photons is detected when they reach a scintillator in the scanning device creating a burst of light. A photomultiplier tube or Si APD will detect this light. The PET technique depends on the simultaneous or coincident detection of the pair of photons moving in opposite direction.


The gamma photons are emitted at almost 180 degrees to each other and hence it is possible to localize their source along a straight line of coincidence (called line of response or LOR). In practice the LOR has a finite width. If the resolving time of detectors is less than 500 picoseconds, it is possible to localize the event.

Image reconstruction: 

The PET scanner collects a list of coincidence events which represent the simultaneous or near simultaneous detection of annihilation photons by a pair of detectors.
The PET data suffer from scatter and random events much more dramatically than CT. In practice considerable preprocessing of data is required for the correction of random coincidences, estimation and subtraction of scattered photons etc. A common method used to reconstruct images from projections is Filtered Back Projection (FBP). This algorithm is simple and has a low requirement for computing resources. Another method of reconstruction is iterative expectation -maximization algorithms.

The PET imaging technique is shown briefly in the figure. From the figure we can see that the coincidence detection unit is one of the major units of the PET imaging system.

Attenuation Correction:  

Since different LORs must traverse different thicknesses of tissue, the photons are attenuated differentially. As a result the structure deep in the body may be reconstructed falsely. For more faithful representation, the attenuation-corrected images are commonly used.

2D/3D Reconstruction  

Modern PET scanners have multiple rings of detectors.

We can use two approaches in reconstructing data from such a scanner.

1) Trace each ring as a separate entity so that only coincidences within a ring are detected. Here the image from each ring can then be reconstructed individually. It is 2D reconstruction.

2) In another method coincidences detected between rings and within rings. The entire volume is reconstructed to form 3D.

Typically Positron Emission Tomography (PET) Scan imaging utilizes a dedicated PET camera system which consists of multiple rings of detectors. The Positron Emission Tomography Scan detectors consist of scintillation crystals coupled with photomultiplier tubes. The scintillation crystals commonly used in PET imaging is BGO (Bismuth Germanium Oxide. The basic concept behind ring design is that the two photons detected in close temporal proximity by two opposed detectors in the ring are likely to have originated from a single annihilation event in the body. Such a simultaneous detection is called coincidence.