Question: Use HCS12 assembly language only - not C code Using CodeWarrior to create a new project that uses assembly language. Write an assembly program that

Use HCS12 assembly language only - not C code

Using CodeWarrior to create a new project that uses assembly language. Write an assembly program that turns on the red LED at the beginning. It switches to off 2 seconds later and switches back to on after three more seconds. (That is, it stays on for 2 seconds and off for 3 seconds.) This switching process lasts forever. Use a loop (or nested loops) for each of the 2/3-second delay where the loop body of the inner-most loop should contain only multiple instances of the NOP instruction. Use trial-and-error in adjusting the loop iterations to achieve the delay. Write down instructions in the (nested) loops of your program, identify the number of clock cycles needed for each instruction in the loops, and calculate the total number of cycles to get the amount of delay. Use that information to calculate the clock speed of the CPU in MHz, given that the clock speed is an integer in MHz.

Hint: You may use the DBNE instruction for the loop control. In order to find out the number of clock cycles for a particular HCS12 CPU instruction, you may either get it from the data sheet or use the Full Chip Simulation in CodeWarrior, in case you have trouble determining the proper machine code version from the data sheet.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!