skip to main  |
      skip to sidebar

07:28

Jegadeesan
 No comments
No comments
 
                       - Write function in C that gets array of chars, and search for  the longest sequence of repeatedly 1 bits. It returns the the first bit  place in the sequence and the number of 1 bits in the sequence.  - (a) loop of 2^0, 2^1, … , 2^7 is done with 1<<j when  0<=j<=7. (b) Take care of remembering the first place of the bit  sequence you are counting.
- You have 16bit register that increment itself and loops  about every second. When the register reach 0xffff it will issue an  interupt and will run the function update_time(). There is a function  unsigned long get_time() that returns the time. You need to implement  the two functions. - (a) You need to count every interrupt in  order to save the number of seconds. (b) The counter will be the 16bit  MSB, and the actual register will be 16bit LSB. (c) If the register will  be at ~0xfff0, you will return MSB that is not correct, because you  will read the counter, then interrupt will accure and increment by one.  Now you have counter that is not correct. (d) You need to check for the  (c) problem, and if you catch the problem, you need to read once again  the register and the counter before you return them. You depend on the  fact the you have about another second until the register will loop.