There is an array of n elements. Each element stored the pulse width from a PulsIn. Then according to pulse width, the bit_array bit will be 0 or 1. But if it is out of range then a new data set will be collected.
If the byte_array(x) is between a and b then bit_array.0(x)=0
If the byte_array(x) is between c and d then bit_array.0(x)=1
if complete n elements then continue, else goto parse new byte_array data.
Seems easy but could not find a way to exit the loop!
Any help please?
Code:
parse byte_array
find_bit:
if byte_array[index]>145 then '>725ìs
if byte_array[index]<180 then
bit_array.0[index]=0
index=index+1
if index<n then find_bit
endif
endif
if byte_array[index]<100 then '>725ìs
if byte_array[index]>75 then
bit_array.0[index]=1
index=index+1
if index<n then find_bit
endif
endif
Ioannis
Bookmarks