Top Banner
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume Lecture #10
27

ME 4447/6405

Feb 04, 2016

Download

Documents

marci

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume Lecture #10. ASCII Character Codes. ASCII – A merican S tandard C ode for I nformation I nterchange - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

ME 4447/6405Microprocessor Control of Manufacturing Systems

andIntroduction to Mechatronics

Instructor: Professor Charles Ume

Lecture #10

Page 2: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Page 3: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405 ASCII Character Codes

ASCII – American Standard Code for Information InterchangeASCII assigns a hexadecimal ‘code’ to individual characters

Examples:Character ASCII‘A $41‘E $45‘e $65 (Note: Different codes for lower and upper case)‘1 $31BS$08 (Note: BS is Backspace. )

A microcontroller must send these codes to a display terminal in order for the terminal to display these characters.

Page 4: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405 ASCII Character Codes (continued)

Hex to ASCII Conversion table from Programming Reference Guide Page 58

Page 5: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405 ASCII Character Codes

An array of characters is called a stringExample:

character array String ASCII Representation‘H ‘e ‘l ‘l ‘o “Hello” $48 $65 $6C $6C $6F

Note:Character ASCII‘H $48‘e $65‘l $6C‘o $6F

Page 6: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Page 7: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Assembly Directive Types

Assembly Control • ORG, END

Symbol Definition • EQU

Data Definition/Storage Allocation• FCC, FCB, FDB, RMB, ZMB, BSZ, FILL

Listing Control• PAGE, OPT

Page 8: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Assembly Control

Page 9: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405ORG and END

ORG : Stores translated machine language instructions in sequence starting at given address for any mnemonic instructions that follow

END: Stop translating mnemonics instructions until another ORG is encountered

(Note: These were already discussed in Lecture 7)

Page 10: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Symbol Definition

Page 11: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405 EQUEQU lets you refer to a number or an address as a variable name.

Example:VALA EQU $10 *LABEL VALA USED TO REFER TO $10 ORG $1000 LDAA #VALA *LOAD HEX NUMBER $10 IN ACCUMULATOR A LDAB VALA *LOAD CONTENT OF MEMORY LOCATION $10 *IN ACC. B

SWIEND

Same As:

VALA EQU $10 *LABEL VALA USED TO REFER TO $10 ORG $1000 LDAA #$10 *LOAD HEX NUMBER $10 IN ACCUMULATOR A LDAB $10 *LOAD CONTENT OF MEMORY *LOCATION $10 IN ACC. B

SWIEND

Page 12: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Data Definition/Storage Allocation

Page 13: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

FCC FCC – Form Constant Character string• FCC stores ASCII characters into consecutive bytes of memory. • Any printable ASCII characters can be contained in the string. • String is specified between two identical delimiters, which can be

any printable ASCII character. • First non-blank character after the string is used as a delimiter.

Page 14: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

FCC Cont’d

$0400

$0401

$0402

$0403

$0404

Address Prebyte Opcode Operand

3132

33

34

35

Example:

ORG $0400FCC “12345”

Result

Page 15: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

FCB

FCB – Form Constant Byte• FCB has one or more operands. • Value of each operand is truncated to eight bits, and is

stored in single byte of object program. • Operand may be a numeric constant, character

constant, a symbol or an expression. • Multiple operands are separated by commas, and are

stored in successive memory bytes.

Page 16: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

FCB Cont’d

Example: VALA EQU $10ORG $0400FCB $34,’A, $28AC, $0A ,VALA

$0400

$0401

$0402

$0403

Address Prebyte Opcode Operand

3441

AC

0A

Result

$0404 10

Page 17: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

FDB

FDB – Form Constant Double Byte• FDB stores a double (two byte) word. • May have one or more operands separated by

commas.• Operand may be a numeric constant, a character

constant, a symbol, or an expression.

Page 18: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

FDB Cont’d

Example:

ORG $0400FDB $1234,’&,’G

Note: ASCII value for & is $26 ASCII value for G is $47

$0400

$0401

$0402

$0403

$0404

Address Prebyte Opcode Operand

12

34

00

26

00

47$0405

Result

Page 19: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405RMB

RMB – Reserve Memory Byte•RMB saves a place in memory for a number. Example: ORG $0400XVAR RMB 2 *TWO MEMORY *LOCATIONS $0400 *and $0401 ARE *RESERVED FOR XVAR

ORG $1000LDD #$FFAASTD XVARSWIEND $0400

$0401

Address Prebyte Opcode Operand

FFAA

Result

Page 20: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Question a student asked:

What happens if you change the previous example to "XVAR RMB 3" instead of "XVAR RMB 2" ? What happens to the 3rd reserved byte when a 2 byte number is stored in XVAR?

Modified Program:

ORG $0400XVAR RMB 3

ORG $1000LDD #$FFAASTD XVARSWIEND

Answer: Remains unchanged

Page 21: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405 ZMB, BSZZMB – Zero Memory Byte and BSZ – Block Storage of Zero• These directives fill a given number of memory locations with zero. • Causes assembler to allocate a block of memory bytes, and each

memory byte is assigned a value of zero. • Both directives do the same thing.• Number of bytes allocated is given in the operand field.

Example:ORG $0400ZMB #$02BSZ #$02

$0400$0401

Address Prebyte Opcode Operand

0000

$0402$0403

0000

Result

Page 22: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

FILL

Fill given number of memory locations with any number. (Note: Fill uses one byte. If two bytes are specified, then it

will truncate it and use LS Byte.)

Example:

ORG $0400FILL #$FF, #$02 $0400

$0401

Address Prebyte Opcode Operand

FFFF

Result

Page 23: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Question a student asked:What happens when the previous example is changed to "FILL #$9ABC, #$02" instead of "FILL #$FF,#$02"? What happens if you fill memory with a 2 byte number? Answer: FILL will just use the LS Byte

Modified Example:

ORG $0400FILL #$9ABC,#$02END

(Note: There is no ”go 1000” on the screen since these are just assembly directives and not a program)

Page 24: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

Listing Control

Page 25: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

PAGE

PAGE • The PAGE directive causes a page break in

the list file. • If no source listing is being produced, the

PAGE directive will have no effect. • The directive is not printed on the source

listing.

Page 26: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

OPTOPT• Allows for various options in assembly of a program, including generating a listing and counting instruction cycles.

Options:nol-no output listing (default)l-do an output listing noc-no cycle number count (default)c-turn on cycle count using zero initial valuecontc-turn cycle count on, begin with last valuecre-create a cross reference table (default anyway) RMBs-create a symbol table (default anyway) EQU

Example:OPT l – Print source listing from this point

Page 27: ME 4447/6405

George W. Woodruff School of Mechanical Engineering, Georgia Tech

ME4447/6405ME4447/6405

QUESTIONS???