Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 80 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
80
Dung lượng
1,96 MB
Nội dung
[...]... the values using the digits 0–9, and the letters A–F (see Table 1. 1) Table 1. 1 Decimal Binary Octal Hexadecimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0000 00 01 0 010 0 011 010 0 010 1 011 0 011 1 10 00 10 01 1 010 10 11 110 0 11 01 111 0 11 11 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17 0 1 2 3 4 5 6 2 8 8 A B C D E F www.newnespress.com 10 Chapter 1 Octal was originally popular because all 8 digits of its format... value 10 1, represents 1 groups of four, 0 groups of two, plus 1 The left-most digit, referred to as the most significant bit or MSB, represents 2ˆ2 (or 4 in base ten) The position of 0 denotes 2 1 (or 2 in base ten) The right-most digit, referred to as the least significant bit or LSB (1) , represents 1 or 2ˆ0 Example 1. 4 10 1 1 *2^2= 10 0 0 *2 ^1= 00 1 *2^0= + 1 1 01 (1* 4 in base ten) (0*2 in base ten) (1* 1... representing 2ˆ 1 Each succeeding position represents an increasing negative power of two as the positions of the digits move to the right This is the same format used with base-ten numbers and it works equally well for binary values For example, the number 1. 01 in binary is actually 1, plus 0 halves and 1 quarter Example 1. 6 1. 01 1 *2^0 = 1 0 2^ -1 = * 0 1 *2^-2 = + 01 1. 01 (1* 1 (0*½ (1* ¼ (1 in in in... it Table 1. 2 is a chart of all 12 8 ASCII codes, referenced by hexadecimal: Table 1. 2 Hex ASCII Hex ASCII Hex ASCII Hex ASCII Hex ASCII Hex ASCII Hex ASCII Hex ASCII 00 NUL 10 DLE 20 SP 30 0 40 @ 50 P 60 ` 70 p 01 SOH 11 DC1 21 ! 31 1 41 A 51 Q 61 a 71 q 02 STX 12 DC2 22 “ 32 2 42 B 52 R 62 b 72 r 03 ETX 13 DC3 23 # 33 3 43 C 53 S 63 c 73 s 04 EOT 14 DC4 24 $ 34 4 44 D 54 T 64 d 74 t 05 ENQ 15 NAK 25... Representing a base-ten 10 in binary is a simple 10 10; however, converting 0 .1 in base ten to binary is somewhat more difficult In fact, to represent 0 .1 in binary (.000 011 0 011 ) requires 10 bits to get a value accurate to within 1% This can cause intermittent inaccuracies when dealing with real-world control applications For example, assume a system that measures temperature to 1 C The value from the... decimal point is considered 10 ˆ0 or 1, as before, and the position just to the right of the decimal point is considered 10 ˆ 1 or 1/ 10 The powers of ten continue to increase negatively as the position of the digits moves to the right of the decimal point So, the number 2.34, actually presents 2 and 3 tenths, plus 4 hundredths Example 1. 2 2.34 2 *10 ^0 = 2 3 *10 ^ 1 = 30 4 *10 ^–2 = + 04 2.34 For most everyday... The left-most value, 2, represents 10 ˆ2 The 3 in the middle represents 10 1, and the right-most 4 represents 1 or 10 ˆ0 Example 1. 1 234 2 *10 ^2= 200 3 *10 ^1= 30 4 *10 ^0= + 4 234 www.newnespress.com Basic Embedded Programming Concepts 3 By using a digit-position-based system based on powers of 10 , we have a simple and compact method for representing numbers To represent negative numbers, we use the convention... Then the value 1 is added to the result The result is a value that, when added to another value using binary math, generates the same value as a binary subtraction As an example, take the subtraction of 2 from 4, since this is the same as adding −2 and +4 First, we need the two’s complement of 2 to represent −2 Example 1. 5 0 010 11 01 111 0 Binary representation of 2 Binary complement of 2 (1s become 0s,... u 06 ACK 16 SYN 26 & 36 6 46 F 56 V 66 f 76 v 07 BEL 17 ETB 27 ‘ 37 7 47 G 57 W 67 g 77 w 08 BS 18 CAN 28 ( 38 8 48 H 58 X 68 h 78 x 09 HT 19 EM 29 ) 39 9 49 I 59 Y 69 I 79 y 0A LF 1A SUB 2A * 3A : 4A J 5A Z 6A j 7A z 0B VT 1B ESC 2B + 3B ; 4B K 5B [ 6B k 7B { 0C FP 1C FS 2C , 3C < 4C L 5C \ 6C l 7C | 0D CR 1D GS 2D - 3D = 4D M 5D ] 6D m 7D } 0E SO 1E RS 2E 3E > 4E N 5E ^ 6E n 7E ~ 0F SI 1F US 2F... digit and the shift is noted by the multiplication of ten raised to the power of the new decimal point location For example: Example 1. 3 Standard notation 2,648.00 1, 343,000.00 0.0000 016 85 Scientific notation 2.648x10^3 1. 343x10^6 1. 685x10^-6 www.newnespress.com 4 Chapter 1 As you can see, the use of scientific notation allows the representation of large and small values in a much more compact, and often . Chapter 1: Basic Embedded Programming Concepts 1 1. 1 Numbering Systems 2 1. 2 Signed Binary Numbers 5 1. 3 Data Structures 13 1. 4 Communications Protocols 29 1. 5 Mathematics 37 1. 6 Numeric. Technology for Embedded Systems Software Development 700 10 .3 Making Development Tool Choices 707 10 .4 Eclipse—Bringing Embedded Tools Together 7 21 10 .5 Embedded Software and UML 725 10 .6 Model-based. 5 .11 The Microprogrammer 350 5 .12 Advantages of Microprogrammers 3 51 5 .13 Disadvantages of Microprogrammers 3 51 5 .14 Receiving a Microprogrammer 352 5 .15 A Basic Microprogrammer 354 5 .16