1. The following C code counts the number of 1 bits in u8_j and returns the answer in u8_k. Convert this to PIC24 assembly code. You may want to convert the for loop structure to a while loop...


1. The following
C
code counts the number of 1 bits in u8_j and returns the answer in u8_k. Convert this to PIC24 assembly code. You may want to convert the for loop structure to a while loop structure.


uint8_t u8_i,u8_j,u8_k;


u8_k = 0; // init bit count


for (u8_i = 0; u8_i != 8; u8_i++) { // do for 8 bits


if ((u8_j & 0x01) == 1) {


u8_k++; // LSb = 1, increment count


}


u8_j = u8_j >> 1; // look at the next bit


}






May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here