Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question about PIC 16F87/88. Data: http://ww1.microchip.com/downloads/en/DeviceDoc/30487D.pdf One way to multiply two integers A times B is to add A to itself B times. This is

Question about PIC 16F87/88. Data: http://ww1.microchip.com/downloads/en/DeviceDoc/30487D.pdf

image text in transcribed

One way to multiply two integers A times B is to add A to itself B times. This is not efficient for large numbers (100 times 100) as it requires a large number of additions. But there is a better way using bit shifts. 100 takes only 7 bits (01100100), and by using RLF or RRF operations along with addition the number of iterations can be significantly reduced - depending on the maximum sizes of the numbers allowed in a memory unit. The largest number one can store in the PIC16F88 is 225. With this in mind, consider multiplying two 4-bit numbers together and putting the result into an 8-bit register by using shifting and adding. The table below shows a multiplication of 3 times 13 following such an algorithm where the shifts rotate through carry ("car"). Each row shows the contents of A, B, and C at the end of each iteration, along with the operations performed. The result,0010 0111, is 32 + 7 = 39, which is what you get with 3 times 13. As you can see by the above, when the shift of B sets the carry bit, then one adds A, otherwise one only completes the shifts. Regardless of the numbers A and B, the process always takes exactly 4 iterations. Translate the above algorithm into a functional code block that would allow the multiplication of any 4-bit integers. N.B. Why is it necessary to clear the carry bit between iterations? N.B. Where does B have to sit in a 8-bit register for the shifts to work properly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago