Schau mal, wie man es machen könnte: Ohne Gewähr, ich hab keine Cube zum testen
Vielleicht ist das eine Hilfe
Code:
$regfile = "m16def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 16000000
$baud = 9600
Dim Temp As Byte
Dim Wait_time As Word
Config Porta = Output
Config Portc = Output
Gnd1 Alias Portc.2
Gnd2 Alias Portc.1
Gnd3 Alias Portc.0
'ebene: 0 ist an
'led: 1 ist an
Porta = 0
Portc = 0
Gnd1 = 1
Gnd2 = 1
Gnd3 = 1
Do
Restore Daten 'Datenzeiger auf das erste Tabellenbyte
' ------------ ebene EINS -----------------
Gnd1 = 0
Gnd2 = 1
Gnd3 = 1
Gosub Eine_ebene
' ------------ ebene ZWEI -----------------
Gnd1 = 1
Gnd2 = 0
Gnd3 = 1
Gosub Eine_ebene
' ------------ ebene DREI -----------------
Gnd1 = 1
Gnd2 = 1
Gnd3 = 0
Gosub Eine_ebene
Loop ' und wieder
End
'================ subroutine für eine Ebene =================
Eine_ebene:
'-------- 1 reihe ---------
Read Temp
Porta = Temp ' bit 0, 1, 2
'-------- 2 reihe ---------
Read Temp
Shift Temp , Left , 3 ' 3 bits nach links
' bit 3, 4, 5
Porta = Porta Or Temp ' dazumischen
'-------- 3 reihe ---------
Read Temp
Shift Temp , Left , 5 ' 5 bits nach links
Portc = Portc Or Temp ' zu den GND's dazumischen
Read Wait_time ' wait-time
Waitms Wait_time ' warten nnn millisek
' Leds abdrehen
Porta = Porta And &B11000000 ' Bits 0,1,2,3,4,5
Portc = Portc And &B00011111 ' Bits 5,6,7
Return
' test daten: alle Leds leuchten
Daten:
' ------------- 1.ebene -------------------
Data &B00000111 ' Bit vorne
Data &B00000111 ' Bit mitte
Data &B00000111 ' Bit hinten
Data 1000% 'wait-time 1000 mS
' ------------- 2.ebene -------------------
Data &B00000111 ' Bit vorne
Data &B00000111 ' Bit mitte
Data &B00000111 ' Bit hinten
Data 1000% 'wait-time 1000 mS
' ------------- 3.ebene -------------------
Data &B00000111 ' Bit vorne
Data &B00000111 ' Bit mitte
Data &B00000111 ' Bit hinten
Data 1000% 'wait-time 1000 mS
Lesezeichen