Introduction to Embedded Microcomputer Systems Lecture 3.1

Similar documents
Memory is implemented as an array of electronic switches

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

ASCII Code. Numerous codes were invented, including Émile Baudot's code (known as Baudot

URL encoding uses hex code prefixed by %. Quoted Printable encoding uses hex code prefixed by =.

BAR CODE 39 ELFRING FONTS INC.

Chapter 5. Binary, octal and hexadecimal numbers

Xi2000 Series Configuration Guide

Chapter 1. Binary, octal and hexadecimal numbers

Voyager 9520/40 Voyager GS9590 Eclipse 5145

DEBT COLLECTION SYSTEM ACCOUNT SUBMISSION FILE

The ASCII Character Set

BARCODE READER V 2.1 EN USER MANUAL

Symbols in subject lines. An in-depth look at symbols

Representação de Caracteres

This is great when speed is important and relatively few words are necessary, but Max would be a terrible language for writing a text editor.

ASCII CODES WITH GREEK CHARACTERS

BI-300. Barcode configuration and commands Manual

Systems I: Computer Organization and Architecture

Barcode Magstripe. Decoder & Scanner. Programming Manual

ESPA Nov 1984 PROPOSAL FOR SERIAL DATA INTERFACE FOR PAGING EQUIPMENT CONTENTS 1. INTRODUCTION 2. CHARACTER DESCRIPTION

CHAPTER 8 BAR CODE CONTROL

Command Emulator STAR Line Mode Command Specifications

Digital Logic Design. Introduction

ASCII Characters. 146 CHAPTER 3 Information Representation. The sign bit is 1, so the number is negative. Converting to decimal gives

Counting in base 10, 2 and 16

Computer Science 281 Binary and Hexadecimal Review

Create!form Barcodes. User Guide

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Model 200 / 250 / 260 Programming Guide

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

IBM Emulation Mode Printer Commands

DL910 SERIES. Instruction Manual

MK-SERIE 1000/1500/2000 AllOfBarcode.de Michael Krug Traunstein BARCODE SCANNER

TELOCATOR ALPHANUMERIC PROTOCOL (TAP)

Lecture 2. Binary and Hexadecimal Numbers

Characters & Strings Lesson 1 Outline

Part No. : MUL PROGRAMMING GUIDE

7-Bit coded Character Set

INTERNATIONAL STANDARD

Teletypewriter Communication Codes

2011, The McGraw-Hill Companies, Inc. Chapter 3

Binary Representation

Security Protection of Software Programs by Information Sharing and Authentication Techniques Using Invisible ASCII Control Codes

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Chapter 4: Computer Codes

Talk Encoding Issues. An overview to understand and be able to handle encoding issues in a better way. Susanne Ebrecht

ASCII control characters (character code 0-31)

Useful Number Systems

Scanner Configuration

Applied Data Communication Lecture 14

Number Representation

Decimal to Binary Conversion

BRMO 80 / ETH-IP. User Manual. Réf : MU-BRMO 80-ETH-IP-1.4-EN

Solution for Homework 2

Chapter 7D The Java Virtual Machine

Enter/Exit programming

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Chapter 1: Digital Systems and Binary Numbers

MIPS Assembly Language Programming CS50 Discussion and Project Book. Daniel J. Ellard

The Answer to the 14 Most Frequently Asked Modbus Questions

MINIMAG. Magnetic Stripe Reader Keyboard Wedge. User s Manual

C Examples! Jennifer Rexford!

MK D Imager Barcode Scanner Configuration Guide

Numbering Systems. InThisAppendix...

PRINTED MANUAL AGG Software (

Barcode Scanning Made Easy. Programming Guide

Index...1. Introduction...3. Installation- Keyboard Wedge...3 RS USB...3. Default Setting for each barcode shown as below:...

Barcode Scanning Made Easy. WWS500 Programming Guide

The Hexadecimal Number System and Memory Addressing

HANDHELD LASER SCANNER

S302D. Programming Guide. 2D Imaging Barcode Scanner. Advanced Handheld High-Speed Laser Scanner

Intel Hexadecimal Object File Format Specification Revision A, 1/6/88

HOMEWORK # 2 SOLUTIO


EE 261 Introduction to Logic Circuits. Module #2 Number Systems

ESC/POS Command Specifications

The programming language C. sws1 1

CSI 333 Lecture 1 Number Systems

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

DNA Data and Program Representation. Alexandre David

Bar Code CCD Scanner OPERATION MANUAL

ND48-RS ASCII A2.04 Communication Protocol

Base Conversion written by Cathy Saxton

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

The string of digits in the binary number system represents the quantity

Hexadecimal Object File Format Specification

Technical Support Bulletin Nr.18 Modbus Tips

Barcode reader setup manual

Memory Systems. Static Random Access Memory (SRAM) Cell

Binary, Hexadecimal, Octal, and BCD Numbers

ASCII Character Set and Numeric Values The American Standard Code for Information Interchange

How To Use A Microsoft Powerbook With A Microtron 2 (Ios) On A Microsatellite (Ipl) On An Iphone Or Ipro (Iphones) On Your Computer Or Ipo (Iphone)

Software Developer's Manual

Number Systems. Introduction / Number Systems

!"#$$$$First in Document Technology BARCODE User Guide & Programming Manual

Chapter 5 Instructor's Manual

PROPERTY MANAGEMENT SYSTEM

NVT (Network Virtual Terminal) description

Transcription:

Introduction to Embedded Microcomputer Systems Lecture 3.1 Recap Get the reference materials on 9S12 instructions TExaS simulates hardware and software Overview How numbers are stored on the computer Precision, basis of numbers Unsigned and signed numbers Binary, hexadecimal, decimal TExaS ViewBox and Help system 2. Information. Precision is the number of distinct or different values. The ranges are given for unsigned decimal numbers. Binary bits Bytes Alternatives 8 1 256 10 2 1024 12 2 4096 16 2 65536 20 3 1,048,576 24 3 16,777,216 30 4 1,073,741,824 32 4 4,294,967,296 n [[n/8]] 2 n Table 3.1. Relationship between bits, bytes and alternatives as units of precision. EE319K Lecture 3 in class worksheet Question 1. How many alternatives is 12 bits? Question 2. Range is -999 to 999. How many bits are needed? Decimal digits are used to specify precision of multimeters 0,1,2,3,4,5,6,7,8,9 is a full decimal digit (10 choices) 0,1 is a half decimal digit (2 choices) 0,1,2,3 is three quarters decimal digit (4 choices) + or - is a half decimal digit (2 choices) + or - 0,1 is three quarters decimal digit (4 choices) Table 3.2. represents THE DEFINITION of decimal digits. The specification of decimal digits goes 4, 4½, 4¾, 5, with no other possibilities in between. The numbers 4.3 and 4⅛ are not valid representations of decimal digits.

Introduction to Embedded Microcomputer Systems Lecture 3.2 3½ decimal digits 3¾ decimal digits 4½ decimal digits 000.0 kω 000.0 kω 000.00 kω 000.1 kω 000.1 kω 000.01 kω......... 199.9 kω 399.9 kω 199.99 kω resolution 0.1kΩ 0.1kΩ 0.01kΩ precision 2000 4000 20000 alternatives range 0 to 199.9kΩ 0 to 399.9kΩ 0 to 199.9kΩ decimal digits exact range exact alternatives 3 0 to 999 1,000 3½ 0 to 1999 2,000 3¾ 0 to 3999 4,000 4 0 to 9999 10,000 4½ 0 to 19,999 20,000 4¾ 0 to 39,999 40,000 5 0 to 99,999 100,000 5½ 0 to 199,999 200,000 5¾ 0 to 399,999 400,000 N 0 to 10 N -1 10 N N½ 0 to 2*10 N -1 2*10 N N¾ 0 to 4*10 N -1 4*10 N Table 3.2. Standard definition of decimal digits. Question 3. How many alternatives is 2¾ decimal digits? Question 4. Range is -999 to 999. How many decimal digits are needed? Hexadecimal representation base 16 convenient to represent binary information environment binary hex decimal Freescale %01111010 $7A 122 Intel and TI 01111010B 7AH 122 C language 0x7A 122 LC-3 x7a 122 Table 2.1. Comparison of various formats. Easy to convert from binary to hexadecimal: binary nibbles %11011001111101 0011 0110 0111 1101 hexadecimal Figure 2.1. Example conversion binary to hex to convert from hexadecimal to binary we can: 1) convert each hexadecimal digit into its corresponding 4-bit binary nibble, 2) combine the nibbles into a single binary number. hexadecimal nibbles binary Figure 2.2. Example conversion from hex to binary. $367D $1B3F 0001 1011 0011 1111 %0001101100111111

Introduction to Embedded Microcomputer Systems Lecture 3.3 3.3. 8-bit unsigned numbers Figure 3.3. 8-bit binary format. b7 b6 b5 b4 b3 b2 b1 b0 the value of the number is N = 128 b7 +64 b6 +32 b5 +16 b4 +8 b3 +4 b2 +2 b1 +b0 Notice that the significance of bit n is 2 n. There are 256 different unsigned 8-bit numbers. binary hex Calculation decimal %00000000 $00 0 %00100100 $24 32+4 36 %01000101 $45 64+4+1 69 %11111111 $FF 128+64+32+16+8+4+2+1 255 Table 3.4. Examples The basis of a number system a subset from which linear combinations of the basis elements can be used to construct the entire set. {1, 2, 4, 8, 16, 32, 64, 128} The values of a binary number system can only be 0 or 1. For example, 69 is (0,1,0,0,0,1,0,1) (128,64,32,16,8,4,2,1) What is the 8-bit unsigned binary for 175? Number Basis Need it? bit Operation 175 128 yes bit 7=1 subtract 175-128 47 64 no bit 6=0 none 47 32 yes bit 5=1 subtract 47-32 15 16 no bit 4=0 none 15 8 yes bit 3=1 subtract 15-8 7 4 yes bit 2=1 subtract 7-4 3 2 yes bit 1=1 subtract 3-2 1 1 yes bit 0=1 subtract 1-1 Table 3.5. Example conversion. 1010,1111 is $AF Question 5. What are the 8-bit unsigned binary and hex representations for decimal 50? 8-bit signed numbers b7 b6 b5 b4 b3 b2 b1 b0 Figure 3.3. two s complement number system N= -128 b7+64 b6 +32 b5 +16 b4 +8 b3 +4 b2 +2 b1 +b0-128 10000000 +127=01111111 There are 256 different signed 8-bit numbers. binary hex Calculation dec %00000000 $00 0 %01000010 $41 64+2 66 %11000110 $C6-128+64+4+2-58 %11111111 $FF -128+64+32+16+8+4+2+1-1 Table 3.6. Example conversions For the signed 8-bit number system the basis is

Introduction to Embedded Microcomputer Systems Lecture 3.4 {1, 2, 4, 8, 16, 32, 64, -128} Observation: The most significant bit in a two s complement signed number will specify the sign. %11111111 could represent either 255 or -1. You keep track of the number format. The computer can not determine if signed or unsigned. signed or unsigned by the assembly instructions you select e.g., lsra versus asra What is the 8-bit unsigned binary for -90? Number Basis Need it bit Operation -90-128 yes bit 7=1 subtract -90 - -128 38 64 no bit 6=0 none 38 32 yes bit 5=1 subtract 38-32 6 16 no bit 4=0 none 6 8 no bit 3=0 none 4 4 yes bit 2=1 subtract 6-4 2 2 yes bit 1=1 subtract 2-2 0 1 no bit 0=0 none Table 3.7. Example conversion 1010,0110 is $A6 Observation: To take the negative of a two s complement signed number we first complement (flip) all the bits, then add 1. A second way to convert negative numbers into binary is to first convert them into unsigned binary, then do a two s complement negate. A third way to convert negative numbers into binary is to first add 256 to the number, then convert the unsigned result to binary using the unsigned method. Common Error: An error will occur if you use signed operations on unsigned numbers, or use unsigned operations on signed numbers. Maintenance Tip: To improve the clarity of our software, always specify the format of your data (signed versus unsigned) when defining or accessing the data. 3.10. Character information American Standard Code for Information Interchange (ASCII) code. BITS 4 to 6 0 1 2 3 4 5 6 7 0 NUL DLE SP 0 @ P ` p B 1 SOH DC1! 1 A Q a q I 2 STX DC2 " 2 B R b r T 3 ETX DC3 # 3 C S c s S 4 EOT DC4 $ 4 D T d t 5 ENQ NAK % 5 E U e u 0 6 ACK SYN & 6 F V f v 7 BEL ETB ' 7 G W g w T 8 BS CAN ( 8 H X h x O 9 HT EM ) 9 I Y i y A LF SUB * : J Z j z 3 B VT ESC + ; K [ k { C FF FS, < L \ l D CR GS - = M ] m } E SO RS. > N ^ n ~ F S1 US /? O _ o DEL Table 3.21. Standard 7-bit ASCII.

Introduction to Embedded Microcomputer Systems Lecture 3.5 Pointer $56 $61 $6C $76 $61 $6E $6F $00 Figure 3.33. Strings are stored as a sequence of ASCII characters, followed by a null. Unicode Standard, see http://www.unicode.org/. a unique number for every character, no matter what the platform, no matter what the program, no matter what the language. 3.4. 16-bit unsigned numbers A word or double byte contains 16 bits V a l v a n o Figure 3.4. 16-bit binary format. b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 For the unsigned 16-bit number system the basis is {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768} For the signed 16-bit number system the basis is {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, -32768} Common Error: An error will occur if you use 16-bit operations on 8-bit numbers, or use 8-bit operations on 16-bit numbers. Maintenance Tip: To improve the clarity of your software, always specify the precision of your data when defining or accessing the data. 4.1.1. Big and little endian $0050 $03 $0051 $E8 Big Endian Figure 4.1. Example of big and little endian formats $0050 $E8 $0051 $03 Little Endian

Introduction to Embedded Microcomputer Systems Lecture 3.6 $0050 $12 $0051 $34 $0052 $56 $0053 $78 Big Endian Figure 4.1. Example of big and little endian formats $0050 $78 $0051 $56 $0052 $34 $0053 $12 Little Endian Download at http://users.ece.utexas.edu/~valvano/starterfiles/square_dg128asm.zip Run the Square example, reduce period show the Windows show Help system The bottom line Everything is binary inside the computer Programmer must keep track of format Precision, decimal digits, basis, ASCII Unsigned, signed (2 s complement) Big and little endian