30F4013 , EasydsPIC2 , default config , dsPascal 4.0
while working on some code i needed accessing individual bits and ( not sure this is legal) programmed something like this :
Code: Select all
program tmp;
var i : byte;
begin
latb := 0;
trisb := 0;
while true do
begin
for i := 0 to 12 do
begin
latb.i := latb.i xor 1;
delay_ms(300);
end;
end;
end.
As such it seems to work but after the first pass through the loop(all PORTB LEDS on my EasydsPIC2 board are on by then ) the bits 0..7 are switched off one by one ( as expected) but arriving on bit8 , the remaining bits (RB8..12) are ALL switched off . As the loop advances the bit's 9..12 are inverted ( again as expected) but from now pattern evolves strange. Then i tested the same but counting from 8 to 12 , same strange behaviour , usefull for next christmas perhaps but not what i needed now. Any enlightment would be welcome .