# Intro to CodeWarrior TM - PowerPoint PPT Presentation

1 / 5

Intro to CodeWarrior TM. Simulating the Microcontroller in Assembly Language Freescale Univeristy Programs Document Labs12CINTRO03/Rev1. Simulation Program. ; Your program code goes here ; Initialize I/O main_loop : ; DO nop ; A "no operation" operation

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Intro to CodeWarrior TM

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

## Intro to CodeWarrior TM

Simulating the Microcontroller in Assembly Language

FreescaleUniveristy Programs

Document Labs12CINTRO03/Rev1

### Simulation Program

• ; Your program code goes here

• ; Initialize I/O

• main_loop:

• ; DO

• nop ; A "no operation" operation

• ldx#ConstData ; Initialize X with an address

• ldab#\$02 ; Initialize a counter with data

### Simulation (cont.)

• ; Load and store data in a loop

• loop:

• ldaa0,x ; Get the data

• staaVarData; Store it in RAM

• ldaa2,x ; Get another byte

• staaVarData+1 ; Store it

• Inx ; Increment the pointer

• decb ; Decrement the counter

### Simulation (cont.)

• bne loop ; Loop until B = 0

• nop

• ; Forever

• bra main_loop

### Simulation (cont.)

• ;***************************************MyConst:SECTION

• ; Place constant data here

• ConstData: DC.B \$0a,\$0b,\$11,10

• ;***************************************

• MyData: SECTION

• ; Place variable data here

• VarData: DS.B 2 ; Two bytes of storage