Digital Electronics Number System And Binary Codes Pdf
File Name: digital electronics number system and binary codes .zip
Electronic and Digital systems may use a variety of different number systems, e. Decimal, Hexadecimal, Octal, Binary. In the above, d n-1 to d 0 is integer part, then follows a radix point, and then d -1 to d -m is fractional part.
- Module 1.0
- Digital Electronics - Number Systems and Codes
- Digital Number System
- Binary Number System
In a digital system, the system can understand only the optional number system. In these systems, digits symbols are used to represent different values, depending on the index from which it settled in the number system. In simple terms, for representing the information, we use the number system in the digital system. In the digital computer, there are various types of number systems used for representing information.
In computing and electronic systems, binary-coded decimal BCD is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits , usually four or eight. Sometimes, special bit patterns are used for a sign or other indications e. In byte -oriented systems i. The precise 4-bit encoding, however, may vary for technical reasons e.
BCD's main virtue, in comparison to binary positional systems , is its more accurate representation and rounding of decimal quantities, as well as its ease of conversion into conventional human-readable representations. Its principal drawbacks are a slight increase in the complexity of the circuits needed to implement basic arithmetic as well as slightly less dense storage. BCD per se is not as widely used as in the past and it is no longer implemented in newer computers' instruction sets e.
However, decimal fixed-point and floating-point formats are still important and continue to be used in financial, commercial, and industrial computing, where the subtle conversion and fractional rounding errors that are inherent in floating point binary representations cannot be tolerated. BCD takes advantage of the fact that any one decimal numeral can be represented by a four bit pattern. The most obvious way of encoding digits is Natural BCD NBCD , where each decimal digit is represented by its corresponding four-bit binary value, as shown in the following table.
This is also called "" encoding. The following table represents decimal digits from 0 to 9 in various BCD encoding systems. As most computers deal with data in 8-bit bytes , it is possible to use one of the following methods to encode a BCD number:. As an example, encoding the decimal number 91 using unpacked BCD results in the following binary pattern of two bytes:. Hence the numerical range for one unpacked BCD byte is zero through nine inclusive, whereas the range for one packed BCD byte is zero through ninety-nine inclusive.
To represent numbers larger than the range of a single byte any number of contiguous bytes may be used. For example, to represent the decimal number in packed BCD, using big-endian format, a program would encode as follows:.
Here, the most significant nibble of the most significant byte has been encoded as zero, so the number is stored as but formatting routines might replace or remove leading zeros. Packed BCD is more efficient in storage usage than unpacked BCD; encoding the same number with the leading zero in unpacked format would consume twice the storage.
Shifting and masking operations are used to pack or unpack a packed BCD digit. Other bitwise operations are used to convert a numeral to its equivalent bit pattern or reverse the process.
In packed BCD or simply packed decimal  , each of the two nibbles of each byte represent a decimal digit. Most implementations are big endian , i. The lower nibble of the rightmost byte is usually used as the sign flag, although some unsigned representations lack a sign flag. As an example, a 4-byte value consists of 8 nibbles, wherein the upper 7 nibbles store the digits of a 7-digit decimal value, and the lowest nibble indicates the sign of the decimal integer value.
Other allowed signs are A and E for positive and B for negative. Most implementations also provide unsigned BCD values with a sign nibble of F. Burroughs systems used D for negative, and any other value is considered a positive sign value the processors will normalize a positive sign to C. No matter how many bytes wide a word is, there is always an even number of nibbles because each byte has two of them.
The extra storage requirements are usually offset by the need for the accuracy and compatibility with calculator or hand calculation that fixed-point decimal arithmetic provides. Denser packings of BCD exist which avoid the storage penalty and also need no arithmetic operations for common conversions.
Ten's complement representations for negative numbers offer an alternative approach to encoding the sign of packed and other BCD numbers. In this case, positive numbers always have a most significant digit between 0 and 4 inclusive , while negative numbers are represented by the 10's complement of the corresponding positive number. As with two's complement binary numbers, the range is not symmetric about zero.
These languages allow the programmer to specify an implicit decimal point in front of one of the digits. The decimal point is not actually stored in memory, as the packed BCD storage format does not provide for it. Its location is simply known to the compiler, and the generated code acts accordingly for the various arithmetic operations. If a decimal digit requires four bits, then three decimal digits require 12 bits.
However, since 2 10 1, is greater than 10 3 1, , if three decimal digits are encoded together, only 10 bits are needed. The latter has the advantage that subsets of the encoding encode two digits in the optimal seven bits and one digit in four bits, as in regular BCD.
Some implementations, for example IBM mainframe systems, support zoned decimal numeric representations. Each decimal digit is stored in one byte, with the lower four bits encoding the digit in BCD form. The upper four bits, called the "zone" bits, are usually set to a fixed value so that the byte holds a character value corresponding to the digit.
For signed zoned decimal values, the rightmost least significant zone nibble holds the sign digit, which is the same set of values that are used for signed packed decimal numbers see above. The IBM series are character-addressable machines, each location being six bits labeled B, A, 8, 4, 2 and 1, plus an odd parity check bit C and a word mark bit M.
For encoding digits 1 through 9 , B and A are zero and the digit value represented by standard 4-bit BCD in bits 8 through 1. For most other characters bits B and A are derived simply from the "12", "11", and "0" "zone punches" in the punched card character code, and bits 8 through 1 from the 1 through 9 punches.
A "12 zone" punch set both B and A , an "11 zone" set B , and a "0 zone" a 0 punch combined with any others set A. Thus the letter A , which is 12,1 in the punched card format, is encoded B,A,1. This allows the circuitry to convert between the punched card format and the internal storage format to be very simple with only a few special cases. One important special case is digit 0 , represented by a lone 0 punch in the card, and 8,2 in core memory.
The memory of the IBM is organized into 6-bit addressable digits, the usual 8, 4, 2, 1 plus F , used as a flag bit and C , an odd parity check bit.
BCD alphamerics are encoded using digit pairs, with the "zone" in the even-addressed digit and the "digit" in the odd-addressed digit, the "zone" being related to the 12 , 11 , and 0 "zone punches" as in the series. A variable length Packed BCD numeric data type is also implemented, providing machine instructions that perform arithmetic directly on packed decimal data. All of these are used within hardware registers and processing units, and in software.
The MicroVAX and later VAX implementations dropped this ability from the CPU but retained code compatibility with earlier machines by implementing the missing instructions in an operating system-supplied software library. This is invoked automatically via exception handling when the defunct instructions are encountered, so that programs using them can execute without modification on the newer machines. The Intel x86 architecture supports a unique digit ten-byte BCD format that can be loaded into and stored from the floating point registers, from where computations can be performed.
The Motorola series had BCD instructions. In more recent computers such capabilities are almost always implemented in software rather than the CPU's instruction set, but BCD numeric data are still extremely common in commercial and financial applications. There are tricks for implementing packed BCD and zoned decimal add—or—subtract operations using short but difficult to understand sequences of word-parallel logic and binary arithmetic operations.
BCD is very common in electronic systems where a numeric value is to be displayed, especially in systems consisting solely of digital logic, and not containing a microprocessor. By employing BCD, the manipulation of numerical data for display can be greatly simplified by treating each digit as a separate single sub-circuit. This matches much more closely the physical reality of display hardware—a designer might choose to use a series of separate identical seven-segment displays to build a metering circuit, for example.
If the numeric quantity were stored and manipulated as pure binary, interfacing with such a display would require complex circuitry. Therefore, in cases where the calculations are relatively simple, working throughout with BCD can lead to an overall simpler system than converting to and from binary.
Most pocket calculators do all their calculations in BCD. The same argument applies when hardware of this type uses an embedded microcontroller or other small processor. Often, representing numbers internally in BCD format results in smaller code, since a conversion from or to binary representation can be expensive on such limited processors.
For these applications, some small processors feature dedicated arithmetic modes, which assist when writing routines that manipulate BCD quantities. It is possible to perform addition by first adding in binary, and then converting to BCD afterwards.
For example:. In BCD as in decimal, there cannot exist a value greater than 9 per digit. To correct this, 6 is added to the total, and then the result is treated as two nibbles:. The two nibbles of the result, and , correspond to the digits "1" and "7". This yields "17" in BCD, which is the correct result. This technique can be extended to adding multiple digits by adding in groups from right to left, propagating the second digit as a carry, always comparing the 5-bit result of each digit-pair sum to 9.
Some CPUs provide a half-carry flag to facilitate BCD arithmetic adjustments following binary addition and subtraction operations. Subtraction is done by adding the ten's complement of the subtrahend to the minuend. To represent the sign of a number in BCD, the number is used to represent a positive number , and is used to represent a negative number. The remaining 14 combinations are invalid signs. In signed BCD, is The ten's complement of can be obtained by taking the nine's complement of , and then adding one.
Since BCD is a form of decimal representation, several of the digit sums above are invalid. In the event that an invalid entry any BCD digit greater than exists, 6 is added to generate a carry bit and cause the sum to become a valid entry. So, adding 6 to the invalid entries results in the following:.
To confirm the result, note that the first digit is 9, which means negative. The remaining nibbles are BCD, so is Various BCD implementations exist that employ other representations for numbers.
Programmable calculators manufactured by Texas Instruments , Hewlett-Packard , and others typically employ a floating-point BCD format, typically with two or three digits for the decimal exponent. Signed decimal values may be represented in several ways. The COBOL programming language, for example, supports a total of five zoned decimal formats, each one encoding the numeric sign in a different way:. Bits, octets and digits indexed from 1, bits from the right, digits and octets from the left.
If errors in representation and computation are more important than the speed of conversion to and from display, a scaled binary representation may be used, which stores a decimal number as a binary-encoded integer and a binary-encoded signed decimal exponent.
For example, 0. This representation allows rapid multiplication and division, but may require shifting by a power of 10 during addition and subtraction to align the decimal points. It is appropriate for applications with a fixed number of decimal places that do not then require this adjustment—particularly financial applications where 2 or 4 digits after the decimal point are usually enough.
Indeed, this is almost a form of fixed point arithmetic since the position of the radix point is implied. The Hertz and Chen—Ho encodings provide Boolean transformations for converting groups of three BCD-encoded digits to and from bit values [nb 1] that can be efficiently encoded in hardware with only 2 or 3 gate delays.
Digital Electronics - Number Systems and Codes
In computing and electronic systems, binary-coded decimal BCD is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits , usually four or eight. Sometimes, special bit patterns are used for a sign or other indications e. In byte -oriented systems i. The precise 4-bit encoding, however, may vary for technical reasons e. BCD's main virtue, in comparison to binary positional systems , is its more accurate representation and rounding of decimal quantities, as well as its ease of conversion into conventional human-readable representations. Its principal drawbacks are a slight increase in the complexity of the circuits needed to implement basic arithmetic as well as slightly less dense storage.
The octal numeral system , or oct for short, is the base -8 number system, and uses the digits 0 to 7. Octal numerals can be made from binary numerals by grouping consecutive binary digits into groups of three starting from the right. For example, the binary representation for decimal 74 is Two zeroes can be added at the left: 00 1 , corresponding the octal digits 1 1 2 , yielding the octal representation The Yuki language in California and the Pamean languages  in Mexico have octal systems because the speakers count using the spaces between their fingers rather than the fingers themselves. Octal was an ideal abbreviation of binary for these machines because their word size is divisible by three each octal digit represents three binary digits. So two, four, eight or twelve digits could concisely display an entire machine word.
octal number can be converted into a binary number by converting each of the Many modern digital computers employ the binary (base-2) number system to represent In some cases circuits are included which indicate when an error has.
Digital Number System
A digital system can understand positional number system only where there are a few symbols called digits and these symbols represent different values depending on the position they occupy in the number. The base of the number system where base is defined as the total number of digits available in the number system. The number system that we use in our day-to-day life is the decimal number system. Decimal number system has base 10 as it uses 10 digits from 0 to 9.
The binary number system , also called the base-2 number system , is a method of representing numbers that counts by using combinations of only two numerals: zero 0 and one 1. Computers use the binary number system to manipulate and store all of their data including numbers, words, videos, graphics, and music. The term bit, the smallest unit of digital technology, stands for "BInary digiT. A kilobyte is 1, bytes or 8, bits.
Binary Number System
The binary system is a number system where numbers are represented using the digits 0 and 1. It is used in the computers, since they work with two voltage levels, and thus their natural number system is the binary system 1 - ON, 0 - OFF. The hexadecimal number system or hexadecimal system sometimes shortened as Hex is a number system that uses 16 symbols: from 0 to 9 and A, B, C, D, E and F. Its current use is highly linked to Computer Science, since the computers use the byte or octet as a basic memory unit.
Solved examples with detailed answer description, explanation are given and it would be easy to understand. Here you can find objective type Digital Electronics Number Systems and Codes questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided. You can easily solve all kind of Digital Electronics questions based on Number Systems and Codes by practicing the objective type exercises given below, also get shortcut methods to solve Digital Electronics Number Systems and Codes problems. All Rights Reserved. Contact us: info.
The Web This site. Ask most people what the most commonly used number system is, and they would probably reply after a bit of thought , the decimal system. But actually many number systems, and counting systems are used, without the users thinking much about it.
Each Hexadecimal Number digit can represent a 4-bit Binary Number. Sum each product term to get a decimal equivalent number. Take, for example, the number
Filling the register with non-significant zeros is fine - if the number is smaller than the maximum value the register will hold, but how about larger numbers? These must be dealt with by dividing the binary number into groups of 8 bits, each of which can be stored in a one-byte location, and using several locations to hold the different parts of the total value. Just how the number is split up depends on the design of the electronic system involved.
In our previous section, we learned different types of number systems such as binary, decimal, octal, and hexadecimal. In this part of the tutorial, we will learn how we can change a number from one number system to another number system. As, we have four types of number systems so each one can be converted into the remaining three systems. There are the following conversions possible in Number System.
The reflected binary code RBC , also known just as reflected binary RB or Gray code after Frank Gray , is an ordering of the binary numeral system such that two successive values differ in only one bit binary digit. For example, the representation of the decimal value "1" in binary would normally be "" and "2" would be "". In Gray code, these values are represented as "" and "". That way, incrementing a value from 1 to 2 requires only one bit to change, instead of two.
- Коммандер, - сказала она, - если вы инструктировали Дэвида сегодня утром по телефону из машины, кто-то мог перехватить… - Один шанс на миллион, - возразил Стратмор, стараясь ее успокоить. - Подслушивающий должен был находиться в непосредственной близости и точно знать, что надо подслушивать. - Он положил руку ей на плечо.