Manchester Decode
This will decode the received manchester code on the pc-side, that’s coded by the Bascom sample .
1 | 'Manchester decoder VB5/6 Evert 2007 V1.0 |
2 | Dim Mansword As Double |
3 | Mansword = Highbyte 'Make a word out of the high and low byte |
4 | Mansword = Mansword * 256 |
5 | Mansword = Mansword + Lowbyte |
6 | Manchesterdecode = 0 'Set output to zero |
7 | For Lus = 1 To 8 'Run loop 8 times |
8 | Manchesterdecode = Manchesterdecode * 2 'Shift the bit to the left |
9 | If (mansword And 49152) = 16384 Then 'If the left 2 bits are 01 |
10 | Manchesterdecode = Manchesterdecode + 1 ' Incr Output |
11 | End If |
12 | Mansword = Mansword * 4 'Shift bit 2x to the left |
13 | Next Lus |
14 | End Function |