1 / 20

Styrteknik: Binära tal, talsystem och koder D3:1

Styrteknik: Binära tal, talsystem och koder D3:1. Digitala kursmoment D1 Boolesk algebra D2 Grundläggande logiska funktioner D3 Binära tal, talsystem och koder. Styrteknik :Binära tal, talsystem och koder D3:2. Inga kommentarer…….

admon
Télécharger la présentation

Styrteknik: Binära tal, talsystem och koder D3:1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Styrteknik: Binära tal, talsystem och koder D3:1 Digitala kursmoment D1 Boolesk algebra D2 Grundläggande logiska funktioner D3 Binära tal, talsystem och koder

  2. Styrteknik :Binära tal, talsystem och koder D3:2 Inga kommentarer……

  3. Styrteknik :Binära tal, talsystem och koder D3:3 Decimaltal: 34310 = 3*102 + 4*101 + 3 *100 Basen 10, siffrorna 0,1,2,3,4,5,6,7,8,9 Binärtal: 1011012 =1*25+0*24+1*23+1*22+0*21+1*20 Basen 2, siffrorna 0,1 (1011012 =1*32+0*16+1*8+1*4+0*2+1*1 = 4510

  4. Styrteknik :Binära tal, talsystem och koder D3:4 Omvandlingar Decimaltal=>Binärtal: 232-128=104 104-64= 40 40 = 32 + 8 23210 = 111010002

  5. Styrteknik :Binära tal, talsystem och koder D3:5 Omvandlingar Binärtal => Decimaltal: 111111112 = 128+64+32+16+8+4+2+1 = 25510 För positiva heltal gäller: 8 bitar => Största heltal 28 – 1 = 256 - 1 = 255 16 bitar => Största heltal 216 -1 = 65 535 32 bitar => Största heltal 232-1 = 4 294 967 295

  6. Styrteknik :Binära tal, talsystem och koder D3:6 Heltal på tvåkomplementform 011 = +3 010 = +2 001 = +1 000 = +0 111 = -1 110 = -2 101 = -3 100 = -4

  7. Styrteknik :Binära tal, talsystem och koder D3:7 8 bitar => 01111111 = +127 00000000 = 0 11111111 = -1 10000000 = -128 Talområde +127 till -128 För heltal på tvåkomplementform gäller: Talområde för: 16 bitar => +32 767 till -32 268 32 bitar => +2 147 483 647 till -2 147 483 648

  8. Styrteknik :Binära tal, talsystem och koder D3:8 Basen 16, Siffrorna 0..9, A,B,C,D,E,F Ex: 3AF16 = 3*162 + 10*161 +15*160 = = 3*256+16*10+15*1 = 94310 Omvandling hexadecimalt-binärt, varje siffra skrivs med 4 bitar: Ex: 3AF = 0011 1010 1111 = 1110101111 1010111110 = 0010 1011 1110 = 2BE Hexadecimala tal:

  9. Styrteknik :Binära tal, talsystem och koder D3:9 0 0000 8 1000 1 0001 9 1001 2 0010 (10) A 1010 3 0011 (11) B 1011 4 0100 (12) C 1100 5 0101 (13) D 1101 6 0110 (14) E 1110 7 0111 (15) F 1111 Hexadecimal tabell:

  10. Styrteknik :Binära tal, talsystem och koder D3:10 BCD-kod Binary Coded Decimal: Varje decimal siffra kodas med 4 bitar. Ex 93710 = 1001 0011 0111 (BCD) Koden har vikterna 8421 ASCII-kod (American Standard Code for Information Interchange): Ex: 7 bitars ASCII: A = X100 0001 = 41 C = X100 0011 = 43 X biten kan användas som kontrollbit Ex: Jämn paritet A = 0100 0001 C = 1100 0011 Även 8-bitars ASCII-kod är vanlig

  11. Styrteknik :Binära tal, talsystem och koder D3:11 0 000 1 001 2 011 3 010 4 110 5 111 6 101 7 100 Används för olika typer av läges- eller vinkelgivare. Koden ändras bara i en bit mellan två närliggande värden. Gray-kod

  12. Styrteknik :Binära tal, talsystem och koder D3:12 We can then manipulate the inputs or outputs using Boolean operations. Boolean algebra has been discussed before for variables with single values, but it is the same for multiple bits. Common operations that use multiple bits in numbers are shown in Figure 13.8. These operations compare only one bit at a time in the number, except the shift instructions that move all the bits one place left or right. Bitvis AND, OR, …..

  13. Styrteknik :Binära tal, talsystem och koder D3:13 Binary numbers come in three basic forms - a bit, a byte and a word. A bit is a single binary digit, a byte is eight binary digits, and a word is 16 digits. Words and bytes are shown in Figure 13.5. Notice that on both numbers the least significant digit is on the right hand side of the numbers. And, in the word there are two bytes, and the right hand one is the least significant byte.

  14. Styrteknik :Binära tal, talsystem och koder D3:14 Olika binära talsystem OBS För signed finns de två värden för 0: 0000 0000 = 0 (positiv nolla?) 1000 0000 = 0 (negativ nolla?)

  15. Styrteknik :Binära tal, talsystem och koder D3:15 Addition av tal på 2-komplementform. 8-bitars tal Talområde: +127 till -128 Resultat utanför talområdet ska ge overflow (OF, O).

  16. Styrteknik :Binära tal, talsystem och koder D3:16 Paritet Errors often occur when data is transmitted or stored. This is very important when transmitting data in noisy factories, over phone lines, etc. Parity bits can be added to data as a simple check of transmitted data for errors. If the data contains error it can be retransmitted,or ignored. Parity bits are normally suitable for single bytes, but are not reliable for data with a number of bits.

  17. Styrteknik :Binära tal, talsystem och koder D3:17 Checksummor Checksums are very common in data transmission, but these are also hidden from the average user. If you plan to transmit data to or from a PLC you will need to considerparity and checksum values to verify the data. Small errors in data can have major consequencesin received data. Consider an oven temperature transmitted as a binary integer (1023d = 0000 0100 0000 0000b). If a single bit were to be changed, and was not detected the temperature might become (0000 0110 0000 0000b = 1535d) This small change woulddramatically change the process.

  18. Styrteknik :Binära tal, talsystem och koder D3:18

  19. Styrteknik :Binära tal, talsystem och koder D3:19 5. Convert the BCD number below to a decimal number, 0110 0010 0111 1001 6. Convert the following binary number to a BCD number, 0100 1011 7. Convert the following binary number to a Hexadecimal value, 0100 1011 8. Convert the following binary number to a octal, 0100 1011 9. Convert the decimal value below to a binary byte, and then determine the odd parity bit, 97 10. Convert the following from binary to decimal, hexadecimal, BCD and octal. a) 101101 b) 11011011 c) 10000000001 d) 0010110110101

  20. Styrteknik :Binära tal, talsystem och koder D3:20 11. Convert the following from decimal to binary, hexadecimal, BCD and octal. a) 1 b) 17 c) 20456 d) -10 12. Convert the following from hexadecimal to binary, decimal, BCD and octal. a) 1 b) 17 c) ABC d) –A 13. Convert the following from BCD to binary, decimal, hexadecimal and octal. a) 1001 b) 1001 0011 c) 0011 0110 0001 d) 0000 0101 0111 0100

More Related