Aber leider sieht das Bild aus der Matrix aus, wie 2 verschiedene Q-Code. Ich habe das Gefühl, das das nicht Richtig auf die Konstante zugegriffen wird.
Als Info, die Ausgabe ist auf eine 8x8 Led Matrix, welche über 2 Schieberegister angesteuert wird.
Unten bei der Data Zuweisung, habe etwas ausgeklammert. Wen ich aber diese Werte zuweisen, wechseln 4 Balken wie erwarte hin und her.
Code: Alles auswählen
program Project1;
uses
intrinsics;
{$O-,J-}
const
Smily: array[0..1, 0..7] of byte = ((
%11111111,
%11111111,
%11111111,
%11111111,
%11111111,
%11111111,
%11111111,
%11111111), (
%00000000,
%00000000,
%00000000,
%00000000,
%00000000,
%00000000,
%00000000,
%00000000));
type
TSPIGPIO = bitpacked record
DataOut, Clock, SlaveSelect, p3, p4, p5, p6, p7: boolean;
end;
var
SPI_PORT: TSPIGPIO absolute PORTB;
SPI_DDR: TSPIGPIO absolute DDRB;
i, j: byte;
p: uint16 = 0;
Counter: uint16 = 0;
Data: array[0..1] of byte;
begin
SPI_DDR.DataOut := True;
SPI_DDR.Clock := True;
SPI_DDR.SlaveSelect := True;
repeat
Inc(p);
if p >= 8 then begin
p := 0;
end;
Data[0] := 1 shl p;
if Counter > 300 then begin
Data[1] := Smily[0, p];
// Data[1] := %1010101010;
end else begin
Data[1] := Smily[1, p];
// Data[1] := %0101010101;
end;
Inc(Counter);
if Counter >= 600 then begin
Counter := 0;
end;
SPI_Port.SlaveSelect := False;
for j := 1 downto 0 do begin
for i := 7 downto 0 do begin
SPI_Port.DataOut := (Data[j] and (1 shl i)) <> 0;
SPI_Port.Clock := True;
SPI_Port.Clock := False;
end;
end;
SPI_Port.SlaveSelect := True;
until False;
end.