- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[工学]lecture2-introductions
Microcontroller Principles and Applications for HCS12 Introduction Course Contents Introduction Digital primer Processor vs. controller Basic Concepts/Components Register/stack/interrupts/ Core/Clock/Reset/Timer/Memory/ MCU System Design Development Instructions Assemble programming C programming External Interface button、keypad LED、Numeric/Multiplexed Display、LCD Sensors Motors,Relays,Optocoupler Numbering and coding systems Decimal and binary number system Human being use base 10 system (Decimal) 0,1,2,3,4,5,6,7,8,9 零,一,二,三,四,五,六,七,八,九 Zero,One,two,three,four,five,six,seven,eight,nine I,II,III,IV,V,VI,VII,VIII,IX,X Computers use base 2 system (Binary) 0,1 Yes No True False High Low On Off These two binary digits are called bits Numbering and coding systems Hexadecimal and octal number system Hexadecimal is base 16 system (Hex) 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Octal is base 8 system (Octal) 0,1,2,3,4,5,6,7 Hexadecimal is a convenient representation of binary numbers 0xABCD vs. 0b1010101111001101 Octal is seldom used. Number system converting Decimal to Binary Divide the decimal by 2 Keep track of remainder Continue until quotient is 0 arrange remainder in reverse order Number system converting Binary to Decimal Each bit in a binary number has a weight Add the weighted number of each bit to get the decimal number 23 22 21 20 (weight) %1 0 1 1 = 1?(23) + 0? (22) + 1? (21) + 1? (20) = 1?(8) + 0? (4) + 1? (2) + 1? (1) = 8 + 0 + 2 + 1 = 11 Decimal Number system converting Converting between Binary and Hex Nibble -- four-bit aggregation A Hex for each nibble Binary to Hex Start from the right, group 4 bits for a nibble, replace each nibble with equivalent Hex Binary 1100 0101 1011 0110 Hex = C 5 B 6 Hex to Binary Replace each nibble with equivalent binary Hex $A B C Binary % 1010 1011 1100 Binary %
文档评论(0)