AnsweredAssumed Answered

How to efficiently shift long bit-strings in kinetis?

Question asked by Diego Colombo on Jun 8, 2018
Latest reply on Jun 10, 2018 by xiangjun.rong


once i receive a serial code i have to put it in a variable from right to left or left to right.If the bit-string is shorter than 32 bit it is easy ,it should work even in this trivial way:

unsigned int rx_bit_var,final_var;

rx_bit_var=RecvFuction();//i waste a int for a bit ,it can be 0x00000001 or 0x00000000

final_var |=rx_bit_var;
final_var <<=1;

but what if the string is 100 bits long?
In a 9S08 i would dare to rotate variables through carry.
Is there any hardware in low end Kinetis microcontroller that can ease ths process?
It would be possible to profite of some register in serial modules as SPI,I2C or UART?
Many thanks