Menu

[Solved] Following Complex Operations Write Sequence Pic 16f1829 Instructions Performs Equivalent O Q37156116

For each of the following complex operations, write a sequence of PIC 16F1829 instructions that performs an equivalent operatGiven an 8-bit variable, YL, perform the multiplication: 4. YL-YL*9 Hint: Note that multiplication by a constant amount can b

For each of the following complex operations, write a sequence of PIC 16F1829 instructions that performs an equivalent operation. Assume that X, Y, and Z are 16-bit values split into individual bytes as shown in the following cblock directive, which defines two additional variables you can use: cblock 0x50 XH, XI YH, YL ZH, ZL TEMP COUNT iHigh and low bytes oI X i High and low bytes OI Y ; High and low bytes of Z i Temporary byte, lI needed iLoop counter, 1I needed endc Each question on this assignment is worth 20 points 1. Perform the 16-bit addition: Z – X + Y. Do not change X or Y when performing this operation. 2. Perform the 16-bit subtraction: Z = X-Y. Do not change X or Y when performing this operation. 3. Perform a 16-bit arithmetic right shift: X = Y >> ZL (Note that, because the shift amount is no greater than 15, a single byte is sufficient to hold that value.) Do not change Y or ZL when performing this operation. Given an 8-bit variable, YL, perform the multiplication: 4. YL-YL*9 Hint: Note that multiplication by a constant amount can be broken into a series of shift and add operations. For example, in general: .X * 2 can be implemented by shifting X to the left by 1 (X<1) X * 5 can be implemented as (X * 4) -(X << 2) + X 5. Given two 8-bit variables stored in XL and ZL, copy the value of bit position ZL within variable XL into the carry flag. For example: If XL 0x03 and ZL-0x00, set C to the value of bit 0 within XL. o Since XL = 0x03-0000 00112, C-1 If XL-OxC2 and ZL Ox04, set C to the value of bit 4 within XL Since XL-OxC2-110000112, C = 0 o Note that: . This operation is very similar to the bit test (BT) instruction in the x86 architecture. .Since ZL is not a constant, you cannot use the value of ZL directly in any of the PIC bit test instructions (for example, btfsc XL, ZL is not a valid instruction). .Your code should not modify either XL or ZL Show transcribed image text For each of the following complex operations, write a sequence of PIC 16F1829 instructions that performs an equivalent operation. Assume that X, Y, and Z are 16-bit values split into individual bytes as shown in the following cblock directive, which defines two additional variables you can use: cblock 0x50 XH, XI YH, YL ZH, ZL TEMP COUNT iHigh and low bytes oI X i High and low bytes OI Y ; High and low bytes of Z i Temporary byte, lI needed iLoop counter, 1I needed endc Each question on this assignment is worth 20 points 1. Perform the 16-bit addition: Z – X + Y. Do not change X or Y when performing this operation. 2. Perform the 16-bit subtraction: Z = X-Y. Do not change X or Y when performing this operation. 3. Perform a 16-bit arithmetic right shift: X = Y >> ZL (Note that, because the shift amount is no greater than 15, a single byte is sufficient to hold that value.) Do not change Y or ZL when performing this operation.
Given an 8-bit variable, YL, perform the multiplication: 4. YL-YL*9 Hint: Note that multiplication by a constant amount can be broken into a series of shift and add operations. For example, in general: .X * 2 can be implemented by shifting X to the left by 1 (X

Expert Answer


Answer to For each of the following complex operations, write a sequence of PIC 16F1829 instructions that performs an equivalent o… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *