Presentation laddar. Vänta.

Presentation laddar. Vänta.

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

Liknande presentationer


En presentation över ämnet: "Styrteknik: Binära tal, talsystem och koder D3:1"— Presentationens avskrift:

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* * *100 Basen 10, siffrorna 0,1,2,3,4,5,6,7,8,9 Binärtal: =1*25+0*24+1*23+1*22+0*21+1*20 Basen 2, siffrorna 0,1 ( =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: 128 64 32 16 8 4 2 1 23210 = =104 104-64= 40 40 = 23210 = 1 =

5 Styrteknik :Binära tal, talsystem och koder D3:5
Omvandlingar Binärtal => Decimaltal: = = 25510 För positiva heltal gäller: 8 bitar => Största heltal 28 – 1 = = 255 16 bitar => Största heltal = 32 bitar => Största heltal =

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
För heltal på tvåkomplementform gäller: 8 bitar => = +127 = 0 = -1 = -128 Talområde +127 till -128 Talområde för: 16 bitar => till 32 bitar => till

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

9 Styrteknik :Binära tal, talsystem och koder D3:9
Hexadecimal tabell: (10) A 1010 (11) B 1011 (12) C 1100 (13) D 1101 (14) E 1110 (15) F 1111

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

11 Styrteknik :Binära tal, talsystem och koder D3:11
Gray-kod 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.

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 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: = 0 (positiv nolla?) = 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 = b). If a single bit were to be changed, and was not detected the temperature might become ( b = 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, 6. Convert the following binary number to a BCD number, 7. Convert the following binary number to a Hexadecimal value, 8. Convert the following binary number to a octal, 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) b) c) d)

20 Styrteknik :Binära tal, talsystem och koder D3:20
11. Convert the following from decimal to binary, hexadecimal, BCD and octal. a) b) 17 c) 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) b) c) d)


Ladda ner ppt "Styrteknik: Binära tal, talsystem och koder D3:1"

Liknande presentationer


Google-annonser