Question: Write a code fragment in code warrior for the HCS12 microcontroller that stores the sines of the angles 0 through 10 degrees in one-degree increments

Write a code fragment in code warrior for the HCS12 microcontroller that stores the sines of the angles 0 through 10 degrees in one-degree increments in addresses $5000 through $500A. The sines should be stored as 3-digit integers since the microcontroller cant do floating point arithmetic (i.e., the sine of 5o = 0.087; this should be stored as 087).

Modify your code to do the following:

a) Read a byte from Port H

b) Clear bits 4-7 of the byte read from Port H

c) Use the resulting 4-bit number to pick the corresponding number from the list above and move it to Port B (e.g., if the number at Port H is $5, copy the number in address $5005 to Port B).

d) Repeat steps (a) through (c) forever.

Remember to set up the DDRs for Ports H and B.

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!