Question: Programming MPLABX please answer part a,b,c 3-9 Fast shifting. Because it is so fast, the multiply instruction can be used as a swifter shifter, throwing
3-9 Fast shifting. Because it is so fast, the multiply instruction can be used as a swifter shifter, throwing away bits at one end of the number and filling in zeros at the other end. The operand is moved to WREG and multiplied by a power of 2 corresponding to the desired number of shifts. For example, if the number B'11000101' is multiplied by 8, then PRODH will equal B'00000110' and PRODL will equal B'00101000'. Note that PRODH contains the original number shifted right five places. PRODL contains the original number shifted left three places. The selected byte can finally be written back to the original operand. (a) What is the general rule for shifting a number left n places (where 2 = ns 7)? (b) What is the general rule for shifting a number right n places (where 2 sn s 7)? (c) Write the code to shift the l-byte variable TEMP left three places, using "rotate left" in- structions and then clearing the three least-significant bits
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
