IF DT's routine is too complicated for you, which usually is for me, then take a look at this one.
This should be faster then yours I guess.
Code:
<font color="#000000">ErrorCheck:
HighCount = <font color="#FF0000">0
</font>LowCount = <font color="#FF0000">8
</font>i = <font color="#FF0000">0
</font><font color="#000080"><b>WHILE </b></font>i < <font color="#FF0000">8
</font>n = testByte.<font color="#FF0000">0</font>[i] <font color="#000080"><i>'Read bit.
</i></font>LowCount = LowCount - n <font color="#000080"><i>'sub. bits.
</i></font>HighCount = HighCount + n <font color="#000080"><i>'add bits.
</i></font>i = i + <font color="#FF0000">1 </font><font color="#000080"><i>'incr. bit.
</i><b>WEND
</b></font>testByte = <font color="#FF0000">$00 </font><font color="#000080"><i>'Assign value.
</i><b>IF </b></font>HighCount >= LowCount <font color="#000080"><b>THEN </b></font>testByte = <font color="#FF0000">$FF </font><font color="#000080"><i>'change value if true.
</i><b>RETURN
</b></font>
Edit: I did not understand the logic behind this statement:
"This will eliminate any bit errors as long as it's not more than 3 bit errors per byte."
You may cut the loop off if this is true and reduce the time into half of what it takes.
-------------------
Last edited by sayzer; - 2nd January 2009 at 09:22.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks