Hi Vladimir,
I'm a beginner - so might have got this wrong.....
It looks like you'll want to NOT shift left on the first loop through.
Consider if your first received bit is a '1', followed by five '0's received.
Before loop: Rx_Byte = 0000 0000
After first pass through loop Rx_Byte = 0000 0010
when you want it to = 0000 0001
After all six passes through loop, Rx_Byte = 0100 0000
when you wanted Rx_Byte = 0010 0000
You could try adding in something like this...
IF W THEN
Rx_Byte = Rx_Byte << 1
EndIF
Will only shift if W is above 0 (not onh first pass through loop).




Bookmarks