Digital processing (microprocessor)

This article is useful for the pupils of colleges and technical schools. The Microprocessor, brain of the computer, carries out all calculations.

Numbering system

Code

A decimal number can be represented by its equivalent in a different code such as:
  • the binary code ;
  • the octal code ;
  • the hexadecimal code .

A code is a whole of rules of representation of data which can be: numerical, alphabetical, or alphanumeric. In addition to the decimal system, the principal numbering systems which one uses in the field of the data processing are: binary systems, octal and hexadecimal. When a code applies to the manner. to state the numbers, it defined a numbering system.

Example - the decimal number 12 is represented:

  • by the number 1100 in the binary code,
  • by the number 14 in the octal code,
  • by the letter C in the hexadecimal code.

Base

A base B characterizes a numbering system in which any number NR can be written: NR = mnBn + mn-1Bn-1 + M1B + m0B0 with all the coefficients m < B.

Examples

  • the number 341 (8) in octal base is written: 3 × 8 ² + 4 × 81 + 1 × 80
  • the number 3AF8 (16) in hexadecimal base is written: 3 × 163 + has × 162 + F × 161+8 × 160

Numerical table

Weighting

To represent a NB number of N figures (or symbols), in a base B given, consists of the writing on line of these N figures in way such as: NB = (§) n-1… (§) i… (§) 5 (§) 4 (§) 3 (§) 2 (§) 1 (§) 0

With: §: any of B figures or symbols of the base, N - 1,…. I, 5,4,3,2,1,0 indices indicating the row or the position of order of the figure starting from the line.

Weighting allows the attribution of a numerical value or weight each row. This weight P depends on the base in which the number is represented and has as a value: P=Brang

Example

In the decimal number 425, figure 5 is in position of order 1 or row 0, figure 2 in position of order 2 or row 1 and quantifies it 4 in position of order 3 or row 2. 4 2 5 number 2 1 0 row

For base 10, decimal system:

  • the first rank or row 0 has as a weight 100 either 1, it is the row of the units,
  • the following row, row 1 has as a weight 101 or 10 (row of tens),
  • row 2 has as a weight 102 or 100 (row of the hundreds),
  • row 3 has for weight 103 Or 1000 (row of the thousands), and so on.

Note

In the binary system one does not speak any more a unit, of ten or hundred but bit (contraction of English binary digit, which means binary row). One distinguishes thus bit 0, bit 1, bit 2, bit 3… the French equivalent of bit is character binary or eb , this term is employed relatively little.

Pure binary code

The pure binary code or natural binary code is a fixed-count code in which the weights are represented by the successive powers of two. The decimal value of the binary number represented is obtained directly by addition of the affected weight to each bit of value 1.

Note

A group of eight bits is called byte (in English byte off 8 bits ). A group of four bits is called four-bit byte (in English byte off 4 bits ).

Example

The binary number 110011 has as a value: 1 × 25 + L × 24 + 0 × 2 ³ + 0 × 2 ² + 1 × 21 + 1 × 20 Maybe into decimal: 32 + 16 + 0 + 0 + 2 + 1 = 51

Code of Gray (considered binary code)

In the pure binary code the passage from one combination to another involves sometimes the simultaneous change several bits. It is for example the case for the transition from the decimal equivalent 3 to the decimal equivalent 4 for which the bits of weight 1 and 2 pass from 1 to 0 and the bit of weight 4 passes from 0 to 1. To avoid this disadvantage, causes risks when the code is used for the representation of physical sizes with continuous variation, information of position for example, it is necessary to imagine codes for which the passage of one combination to following implies only the modification of a bit and one. Such codes are called " codes réfléchis". Among those, the code of Gray is employed the most.

Plus infos on the Code of Gray are available on Internet. See on Google.

Note

A considered code which is a code not balanced cannot be used for the arithmetic operations.

Hexadecimal representation of the binary numbers

The hexadecimal representation or representation at base 16 is a condensed notation of the binary numbers. By noticing that 24 = 16, one can represent a binary byte using one of the 16 symbols of the hexadecimal system. In this system the first ten symbols are identical to those used in the decimal system: 0,1,2,3,4,5,6,7,8 and 9, and the last six correspond to the first letters of the alphabet Latin: With, B, C, D, E and F, which are worth respectively: 10,11,12,13,14 and 15 bases 10 of them.

Transcribing

Passage de la bases 2 at base 16

To represent into hexadecimal a binary number, it is enough to cut out it in group of four bits. Each bit of these groups having a weighting spreading out from 20 to 23, their nap provides the hexadecimal value of each group.

Example

That is to say the binary number 1011100110101100 to convert into hexadecimal. Cutting in four-bit bytes of this number gives: 1011 1001 1010 1100

After weighting, the sum S, bit by bit of each group of four bits are:

The hexadecimal number corresponding to the binary number 1011100110101100 is: B9AC

Passage de la bases 16 at base 2

To convert into binary a hexadecimal number, it is advisable to replace each hexadecimal symbol by its binary four-bit byte are equivalent.

Example

The three binary four-bit bytes equivalent to the hexadecimal number 8D6 are:

The binary number corresponding to the hexadecimal number 8D6 is: 1000 1101 0110

Octal representation of the binary numbers

As the hexadecimal representation the octal representation or representation at base 8 is a condensed notation of the binary numbers. By noticing that 2 ³ = 8, one can represent a binary triplet using one of the 8 symbols of the octal system. These eight symbols are identical to the first eight digits of the decimal system, that is to say: 0,1,2,3,4,5,6 and 7.

To represent into octal a binary number, it is enough to cut out it in group of three bits or triplet. Each bit of these groups having a weighting spreading out 20 with 2 ² their nap provides the octal value of each group.

That is to say the binary number 110101100 to convert into octal. Cutting in triplets of this number gives: 110.101.100

After weighting, the sum S, bit by bit of each group are:

The octal number corresponding to the binary number 110101100 is: 654

Decimal coded binary representation

In the decimal binary representation coded with each decimal element a four-bit byte representative of its binary equivalent corresponds.

As follows:

  • with the 0 (10) corresponds 0000 (2) ;
  • with the 1 (10) corresponds 0001 (2) ;
  • with the 9 (10) corresponds 1001 (2) .

The Decimal Coded Binary code (BCD) is a fixed-count code.

The weights of the representative bits are:

  • for the least significant four-bit byte (the first four-bit byte on the right): 8.4.2.1. ;
  • for the following four-bit byte 80.40.20.10 ;
  • 800.400.200.100. for the third;
  • and so on until the most significant four-bit byte (the last four-bit byte on the left).

Example

The decimal number 2001 (10) becomes in BCD: 0010 0000 0000 0001. Conversely, number BCD 1001 0101 0001 0111 becomes into decimal 9517 .

Recapitulations

Summary table of conversion of the systems

Récapitualtif of the methods of conversion

Binary to decimal conversion

The method consists in breaking up the number into decreasing powers of 2 on the basis of the row highest, that is to say:

  • 1010 (2) = 1 × 2 ³ + 0 × 2 ² + 1 × 21 + 0 × 20
  • 1010 (2) = 8 + 0 + 2 + 0
  • 1010 (2) = 10 (10)

Decimal to binary conversion

One carries out successive divisions by 2 (see more in top).

Conversion hexadecimal - decimal

The method consists in breaking up the number into decreasing powers of 16 on the basis of the row highest, that is to say:

  • BA8 (16) = B × 16 ² + has × 161 + 8 × 160
  • BA8 (16) = 11 × 16 ² + 10 × 161 + 8 × 160
  • BA8 (16) = 2816 + 160 + 8
  • BA8 (16) = 2984 (10)

Conversion decimal - hexadecimal

One carries out successive divisions by 16 (see more in top).

Conversion octal - decimal

The method consists in breaking up the number into decreasing powers of 8 on the basis of the row highest, that is to say:

  • 777 (8) = 7 × 8 ² + 7 × 81 + 7 × 80

  • 777 (8) = 448 + 56 + 7
  • 777 (8) = 511 (10)

Conversion decimal - octal

One carries out successive divisions by 8 (see more in top).

Arithmetic operations bases 2 of them

The most frequent operations bases 2 of them are the addition and the subtraction. These operations are carried out same manner as the decimal operations by using tables of addition and subtraction much simpler.

Binary addition

The addition is the operation which consists in carrying out: initially, the Si sum of two binary digits of the same row such as Ai and Bi for example, then, the second time, a second amount enters the result previously obtained and the value of the carryforward or Ri-1 reserve, resulting from the downstream addition of row I - 1.

Example

To carry out the addition of two binary numbers has and B such as:
  • 110 (6 into decimal)

  • 011 (3 into decimal)

Decomposition of the procedure:
  • in the forefront (20), reserve downstream is inevitably null and the total of A. and B. is quite equal to 1,
  • with the following row (21), reserve downstream is also null, the total of A1 and B1, is equal to 0 but generates a carryforward R1,
  • with the third rank (2 ²) on the whole of A2 and B2 equal to 1 it is necessary to add the R1 carryforward what gives a final total of 0 with a R2 carryforward which affects the row four.

End result

The final result is thus: 1001 are 9 into decimal (6 + 3 = 9).

See too

External bonds

No external bond for the moment.

Random links:Archeozoology | Inference of the types | Segismundo Moret | Stanley G. Weinbaum | Lisburn | Drapeau_d'Ottawa