Introduction To CodeWarrior™ – Simulating The - Freescale ...
Introduction To CodeWarrior™ – Simulating The - Freescale ...
Introduction To CodeWarrior™ – Simulating The - Freescale ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Page 3: Check the language support you want (Assembly) and click Next.<br />
Page 4: Check Relocatable Assembly.<br />
Page 5: Check Full Chip Simulation and P&E Multilink/Cyclone Pro and click Finish.<br />
In the Project Manager Window<br />
4. Switch to the Full Chip Simulation for debugging by clicking the pull down arrow and selecting Full Chip Simulation. (This<br />
does not use the hardware for debugging. If you want to actually use the HCS12 hardware, choose P&E Multilink Cyclone<br />
Pro.)<br />
5. Create listing files by opening the Simulator Settings panel by clicking the icon shown above.<br />
a. Click on + next to Target in the Target Settings.<br />
b. Highlight Assembler for HC12 and in that panel click on Options.<br />
(i) Check Generate a listing file.<br />
(ii) Check Object File Format. Choose ELF/DWARF 2.0 Object File Format.<br />
(iii) Click OK.<br />
c. Click OK.<br />
6. Open the Sources folder (click on the + if it is not open).<br />
7. Double click on main.asm and enter the following code after the comment<br />
; Your program code goes here.<br />
; Your program code goes here<br />
; Initialize I/O<br />
main_loop:<br />
; DO<br />
nop ; A "no operation" operation<br />
ldx #ConstData ; Initialize X with an address<br />
ldab #$02 ; Initialize a counter with data<br />
; Load and store data in a loop<br />
loop:<br />
ldaa 0,x ; Get the data<br />
staa VarData ; Store it in RAM<br />
ldaa 2,x ; Get another byte<br />
staa VarData+1 ; Store it<br />
inx ; Increment the pointer<br />
decb ; Decrement the counter<br />
bne loop ; Loop until B = 0<br />
nop<br />
; Forever<br />
bra main_loop<br />
<strong>Freescale</strong> Semiconductor LABS12CINTRO03S, Rev 1 3