Home
Lab 2
Contents
1. www ee nmt edu rison ee308 labs lab02 demoprog s Assemble the program into an s19 file b Load the program into the simulator Run the program How many cycles does it take to execute the entire program How long would this take on the EVBU c Use the fill submenu of the memory window simulator to change the values in addresses 0x0900 through 0x9020 to Oxff Reload the s19 file d Set a break point at repeat e Execute the program again The program should stop the first time it reaches the repeat label with OxO0ainacc b and 0x0000 in x Continue running the program It should stop each time it gets to the repeat label b should be decremented by one x should be incremented by one and there should be a new entry in table2 Note ZAP does not automatically update the memory window You will need to load the memory window again using the Address menu of the MEMORY window g Repeat the above using the EVBU 3 Consider the code of Figure 3 Do parts a and b below be fore coming to lab ldab 200 loopl ldx 50000 loop2 dex bne loop2 decb bne loop1 swi Figure 3 Demo program for part 3 of lab 2 a Answer as part of pre lab How many cycles will it take to execute this program How long will this take on the EVBU Again ignore the swi instruction b Use a text editor to enter the code into a program you will have to add org statements and other assembler directives to make the p
2. EE 308 Lab 2 Spring 2002 EE 308 LAB 2 Further Use of ZAP and the EVBU This laboratory will give you more experience with the tools we will use this semester Be sure to read through the entire lab and do the pre lab for each section before coming to lab 1 Consider the program in Figure 1 prog equ 0800 CODE section text org prog ldab 23 ldaa 142 aba std 980 swi Figure 1 Demo program for Part 1 of Lab 2 Do a b c and d before coming to lab a Hand assemble this program I e determine the op codes the HC12 will use to execute this program b How many instruction cycles will it take the HC12 to execute this program How long in time will this take on the HC12 Do not consider the swi instruction c What will be the state of the N Z V and C bits after each instruction has been executed Ignore the swi instruction d What will be in address 0x0980 after the program executes e Assemble the program using ca6812 clnk and chex Look at the 19 file You should be able to relate the op codes from part a to the data in the S19 file Appendix A of the Evaluation Board User s Manual describes the format of the S19 file f Now execute the program in the ZAP simulator After starting ZAP set the cycle counter to zero You can do this by going to the COMMAND window and giving the instruction eval Stime 0 Trace through the program using ZAP To find out how many cycles it took to exec
3. rmine the number of cycles used on the EVBU For part h use the ASM command of BUFFALO to look at and change the program instruction on the EVBU This is easier than changing the op code in memory 2 Consider the program in Figure 2 which is a program to divide a table of ten values by 2 7 6 8HC11 demo program Bill Rison 7 1 26 99 This is a program to take a table of data and create a new table which is the original prog data count CODE repeat DATA title equ equ equ section org ldab ldx ldaa asra staa inx decb bne swi section org initialize tablel COUNT table divided by 2 LAB 2 Demo Program 0800 0900 10 text prog count tablel Oi x count x repeat data data put program at address 0x0800 put data at address 0x0900 number of entries in table set program counter to 0x0800 ACC B holds number of entries left to process Reg X points to entry to process Get tablel entry into ACC A Divide by 2 Save in table2 REG X points to next entry in tablel Decrement number left to process If not done process next tablel entry Done Exit bytes long EE 308 Lab 2 Spring 2002 tablel dc b S07 ae 4a 3 6c 30 7 12 67 Scf table2 ds b count reserve count bytes for table2 Figure 2 Demo program for part 2 of lab 2 a Use a text editor to enter this program or download it from http
4. rogram work c Assemble the program and run it on the HC12 How long does it take to run This time should match your answer to part a
5. ute go to the COMMAND window an give the instruction eval Stime Compare this to the answer of part b g Look at the condition code register after you have traced over the aba instruction Verify that the Z N V and C bits are what you expect h In the MEMORY window look at the contents of address 0x0980 Does the value agree with your answer of part c Note ZAP does not automatically update the memory window You will need to load the memory window again using the Address menu of the MEMORY window EE 308 Lab 2 Spring 2002 i You could change this program to subtract rather than add by changing the aba instruction to a sba instruction Rather than going back to the text editor modifying the program assembling it and loading the new program into the simulator you can easily change the one instruction of the simulator i ii iii iv G wa Find the address of the aba instruction Do this by looking at the program code in the ASSEMBLE window of the simulator In the CPU12 Reference Manual find the op code for the sba instruction In the MEMORY window go to the address of the aba instruction and change the op code to that of the sba instruction You can change a value in the MEMORY window by double clicking on it and typing in the new value Run the program again and verify that the program now subtracts rather than adds Repeat f through h on your EVBU For part e you will not be able to dete
Download Pdf Manuals
Related Search
Related Contents
none 75119 Instructions / Assembly off-grid solar installation manual. Copyright © All rights reserved.
Failed to retrieve file