Shifting data out
Hi there
I have a 5x5 dot matrix font encoded into the 25 MSBs of a long. I am trying to shift this out testing the MSB each time. I thought an & would be fine for this.
However, it does not work. I'm guessing that it's something really silly - but being stupid I can't see what it is. Any clues?
Cheers
Richard
I have a 5x5 dot matrix font encoded into the 25 MSBs of a long. I am trying to shift this out testing the MSB each time. I thought an & would be fine for this.
Pri Letter_shifter | G_data, shift
G_data := $746B5E80
Repeat 5
Repeat shift from 0 to 4
IF G_data & $80000000 == $8000000
BEEP.synth("A", TX_Pin, TX_Freq + shift)
waitcnt(clkfreq+cnt)
BEEP.synth("A", TX_Pin, 0)
G_data <<= 1
However, it does not work. I'm guessing that it's something really silly - but being stupid I can't see what it is. Any clues?
Cheers
Richard

Comments
-Phil
Cheers
Richard
pub shifter(bits) bits <<= (32-25) ' shift msb to bit31 repeat 25 outa[DTA] := (bits <-= 1) & 1 ' rotate to bit0 for output outa[CLK] := 1 ' clock the bit outa[CLK] := 0Here's a way to stop getting caught out like this again: Only ever have one copy of the constant's value in the CON section - refer to it by name everywhere else (if you get that wrong you'll get a handy error report from the compiler).
The basic principle of placing values (and strings) in one place only in the source code is very powerful - when someone wants to change the code they won't be able to only change some of the copies of the value (and cause inconsistency), thus another source of errors is eliminated.
Thanks for the tip.
Cheers
Richard