LED Matrix Uhr (48x8) mit BASCOM

Hallo HinterBlauenAugen

ich ein wenig rumprobiert aber ich bekommen mit deiner Methode keine LED zum leuchten
eigentlich ist es so einleuchten und müsste funktionieren:(
vielleicht habe ich einen Denkfehler :eek:
hier der letzte Versuch:
Code:
'*******************************************************************************
'                              LED Matix Uhr
'*******************************************************************************

' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output
Config Portd.5 = Output                                     '<-- für PWM

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0
Enableout Alias Portd.5                                     '<-- für PWM

Zeile Alias Porta

' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 1
Enable Timer1

Enable Interrupts
' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Dim Helligkeitswert As Long

Dim Block1(8) As Word
Dim Block2(8) As Word
Dim Block3(8) As Word

'(
  - - - -block1 - - - - -block2 - - - - - -block3 - -
7. 5432109876543210 5432109876543210 5432109876543210
6. 5432109876543210 5432109876543210 5432109876543210
5. 5432109876543210 5432109876543210 5432109876543210
4. 5432109876543210 5432109876543210 5432109876543210
3. 5432109876543210 5432109876543210 5432109876543210
2. 5432109876543210 5432109876543210 5432109876543210
1. 5432109876543210 5432109876543210 5432109876543210
0. 5432109876543210 5432109876543210 5432109876543210
')


Block1(1) = &B000010_001000_0000
Block1(2) = &B000010_010100_0000
Block1(3) = &B000010_100010_0000
Block1(4) = &B000010_000010_0000
Block1(5) = &B100010_111110_0000
Block1(6) = &B100010_100010_0000
Block1(7) = &B011100_100010_0000
Block1(8) = &B000000_000000_0000

Block2(1) = &B000010_001000_0000
Block2(2) = &B000010_010100_0000
Block2(3) = &B000010_100010_0000
Block2(4) = &B000010_000010_0000
Block2(5) = &B100010_111110_0000
Block2(6) = &B100010_100010_0000
Block2(7) = &B011100_100010_0000
Block2(8) = &B000000_000000_0000

Block3(1) = &B000010_001000_0000
Block3(2) = &B000010_010100_0000
Block3(3) = &B000010_100010_0000
Block3(4) = &B000010_000010_0000
Block3(5) = &B100010_111110_0000
Block3(6) = &B100010_100010_0000
Block3(7) = &B011100_100010_0000
Block3(8) = &B000000_000000_0000

' Werte ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Helligkeitswert = 20

'*******************************************************************************
' Hauptschleife
'*******************************************************************************

Do

Pwm1a = Helligkeitswert

Loop

'*******************************************************************************
' SUB ,Gosub
'*******************************************************************************



'*******************************************************************************
' Timer0 --> Anzeige Prozess
'*******************************************************************************

Timer_0:

Porta.zeile = 1                                             'schaltet die vorherige Zeile aus

Incr Zeile

If Zeile = 8 Then Zeile = 0

Strobeout = 0
Shiftout Dataout , Clockout , Block1(zeile + 1) , 0 , 16

Shiftout Dataout , Clockout , Block2(zeile + 1) , 0 , 16

Shiftout Dataout , Clockout , Block3(zeile + 1) , 0 , 16
Strobeout = 1

Porta.zeile = 0                                             'schaltet die neue Zeile ein

Return
'*******************************************************************************
' Zeichen Tabelle
'*******************************************************************************
 
Hallo mnsp2,
nimm mal den Alias von Zeile raus. Der kommt sich mit dem direkten setzen (PortA.Zeile=1) in die Quere.

HBA
 
HALLO HBA

danke für die super schnelle Antwort :)

nimm mal den Alias von Zeile raus. Der kommt sich mit dem direkten setzen (PortA.Zeile=1) in die Quere.

super das wer der Fehler :eek:

jetzt habe ich "JA JA JA" auf der Matrix stehen :D

eine kleiner Problem habe ich jedoch jetzt die PWM Frequenz und Bilderzeugens Frequenz überlagern sich wahrscheinlich
ich habe eine Leichts bis Starkes Zucken/Flackern

programm:
Code:
'*******************************************************************************
'                              LED Matix Uhr
'*******************************************************************************

' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output

Config Portd.5 = Output                                     '<-- für PWM
Config Portc.0 = Input
Portc.0 = 1

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0
Enableout Alias Portd.5                                     '<-- für PWM


' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 8
Enable Timer1

Enable Interrupts
' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim Zeile As Byte
Dim Helligkeitswert As Long

Dim Block1(8) As Word
Dim Block2(8) As Word
Dim Block3(8) As Word


Declare Sub Helligkeit

Dim Tastendruck As Byte
'(
  - - - -block1 - - - - -block2 - - - - - -block3 - -
7. 5432109876543210 5432109876543210 5432109876543210
6. 5432109876543210 5432109876543210 5432109876543210
5. 5432109876543210 5432109876543210 5432109876543210
4. 5432109876543210 5432109876543210 5432109876543210
3. 5432109876543210 5432109876543210 5432109876543210
2. 5432109876543210 5432109876543210 5432109876543210
1. 5432109876543210 5432109876543210 5432109876543210
0. 5432109876543210 5432109876543210 5432109876543210
')


Block1(1) = &B000010_001000_0000
Block1(2) = &B000010_010100_0000
Block1(3) = &B000010_100010_0000
Block1(4) = &B000010_100010_0000
Block1(5) = &B100010_111110_0000
Block1(6) = &B100010_100010_0000
Block1(7) = &B011100_100010_0000
Block1(8) = &B000000_000000_0000

Block2(1) = &B000010_001000_0000
Block2(2) = &B000010_010100_0000
Block2(3) = &B000010_100010_0000
Block2(4) = &B000010_100010_0000
Block2(5) = &B100010_111110_0000
Block2(6) = &B100010_100010_0000
Block2(7) = &B011100_100010_0000
Block2(8) = &B000000_000000_0000

Block3(1) = &B000010_001000_0000
Block3(2) = &B000010_010100_0000
Block3(3) = &B000010_100010_0000
Block3(4) = &B000010_100010_0000
Block3(5) = &B100010_111110_0000
Block3(6) = &B100010_100010_0000
Block3(7) = &B011100_100010_0000
Block3(8) = &B000000_000000_0000

' Werte ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Helligkeitswert = 50

'*******************************************************************************
' Hauptschleife
'*******************************************************************************

Do
Debounce Pinc.0 , 0 , Helligkeit , Sub

Pwm1a = Helligkeitswert

Loop

'*******************************************************************************
' SUB ,Gosub
'*******************************************************************************
Sub Helligkeit

  Incr Tastendruck
  Gosub Pwm

End Sub

Pwm:
   Select Case Tastendruck

   If Tastendruck = 5 Then Tastendruck = 1

   Case 1:
       Helligkeitswert = 20
   Case 2:
       Helligkeitswert = 275
   Case 3:
       Helligkeitswert = 747
   Case 4:
       Helligkeitswert = 1023
   End Select
Return


'*******************************************************************************
' Timer0 --> Anzeige Prozess
'*******************************************************************************

Timer_0:

Porta.zeile = 1                                             'schaltet die vorherige Zeile aus

Incr Zeile

If Zeile = 8 Then Zeile = 0

Strobeout = 0
Shiftout Dataout , Clockout , Block1(zeile + 1) , 0 , 16

Shiftout Dataout , Clockout , Block2(zeile + 1) , 0 , 16

Shiftout Dataout , Clockout , Block3(zeile + 1) , 0 , 16
Strobeout = 1

Porta.zeile = 0                                             'schaltet die neue Zeile ein

Return
'*******************************************************************************
' Zeichen Tabelle
'*******************************************************************************

ich habe schon an Timer0 und Timer2 Prescale = 1,8,64,256,1024 rumgeschraubt aber auf so ein gutes Ergebnis wie mit dem CASE versuch komm ich nicht
was kann ich tun
lg mnsp2
 
Hallo mnsp2,
ich muss jetzt weg, sodass ich dir nicht vor heute Abend antworten kann.
Nimm mal das Enable Timer1 raus, das brauchst du ja nicht.
Wenn du mal ein Video machen kannst, wäre das auch hilfreich.
Ansonsten später mehr.

HBA
 
Hallo,

eine kleiner Problem habe ich jedoch jetzt die PWM Frequenz und Bilderzeugens Frequenz überlagern sich wahrscheinlich
ich habe eine Leichts bis Starkes Zucken/Flackern
...
...
ich habe schon an Timer0 und Timer2 Prescale = 1,8,64,256,1024 rumgeschraubt aber auf so ein gutes Ergebnis wie mit dem CASE versuch komm ich nicht
was kann ich tun
da du zwei verschiedene Takte verwendest bekommst du zwangsläufig eine
Schwebung (Summen- und Differenzfrequenzen). Du kommst nicht drum hin,
deine PWM mit dem Bildaufbau zu synchronisieren. Also sozusagen den
Bildaufbau und die PWM aus einer Taktquelle (einem Timer) laufen zu lassen.

Du mußt also mit kaskadierten Zählern arbeiten. Einen schnellen Zähler für die
PWM und aus dem Überlauf von diesem Zähler erzeugst du den Rhythmus mit
dem du deinen Bildaufbau generierst.

Gruß
Dino
 
eine kleiner Problem habe ich jedoch jetzt die PWM Frequenz und Bilderzeugens Frequenz überlagern sich wahrscheinlich
ich habe eine Leichts bis Starkes Zucken/Flackern
...
rumgeschraubt aber auf so ein gutes Ergebnis wie mit dem CASE versuch komm ich nicht
Bei deinem Case Versuch hast du aber auch nur ein Zeichen ausgegeben, jetzt ist es die ganze Matrix.
Hast du mal geschaut, ob die Chips das Durchschieben der 48 Bit richtig verkraften? Du könntest zum Test mal in deinem Case Programm den Befehl
Shiftout Dataout , Clockout , X1 , 0 , 6
6 mal hintereinander zwischen den Strobeout machen lassen und sehen, ob es dann auch zuckt.

Mit der PWM komplett in Hardware sehe ich jedenfalls keinen Grund, warum ein solcher Effekt auftreten sollte.

HBA
 
Hallo zusammen

die PWM brauch ich für die Helligkeitsanpassung
das heist das wenn es hell ist wird die Anzeige hell wenn es dunkel ist wird die Anzeige dunkel

ich habe das sonst immer so gelöst
Code:
Dim Helligkeitswert As Long
...
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 8   
...
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
...
Do
Helligkeitswert = Getadc(3)
Pwm1a = Helligkeitswert
Loop

Du mußt also mit kaskadierten Zählern arbeiten. Einen schnellen Zähler für die
PWM und aus dem Überlauf von diesem Zähler erzeugst du den Rhythmus mit
dem du deinen Bildaufbau generierst.

wie kann ich das realisieren ?
ein Timer für PWM und Bildaufbau ?
Hast du mal geschaut, ob die Chips das Durchschieben der 48 Bit richtig verkraften? Du könntest zum Test mal in deinem Case Programm den Befehl
Shiftout Dataout , Clockout , X1 , 0 , 6
6 mal hintereinander zwischen den Strobeout machen lassen und sehen, ob es dann auch zuckt.

ich habe es gleich mal ausprobiert und es Zucken/Flackern genau du wie bei dam anden ohne CASE

Programm mit CASE siehe Anhang

wann ich den Eingang enable output von 4094 (den ich für die PWM nutze) auf 1 setze kein Zucken/Flackern
also liegt es denke ich an den sich überlagernden Frequenzen


lg mnsp2
 

Anhänge

  • Shiftout Test 1.1 CASE.bas
    12 KB · Aufrufe: 35
Hallo Zusammen

bei AVR- Praxis ist ja alles so ander :cool:

das Problem mit der PWM habe ich erst mal so gelöst das ich anstatt

Code:
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 1
das so
Code:
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Prescale = 1
mache da durch habe ich zwar nur eine 8bit PWM aber ich habe kein flackern mehr :D

Ich sehe hier hauptsächlich 2 Aufgaben:
1. Im Multiplex Verfahren eine ziemlich große Anzahl an LEDs zu schalten
2. Einen neuen Text für die Anzeige bereitstellen

kommen wir also zu Aufgaben 2
ich möchte ja die Urzeit auf meiner Matrix haben
ich haben eine gut funktionierendes DCF 77 Modul

ich habe in Sachen DCF 77 und BASCOM nicht so die Erfahrung
aber ich habe gelesen
das BASCOM einem großenteile der Arbeit abnimmt
Code:
Config Dcf77 = Pinc.0 , Inverted = 0 , Timer = 1 , Debug = 0 , Check = 1 , Update = 1 , Updatetime = 59 , Gosub = Sectic
Config Date = Dmy , Separator = .

durch " Config Dcf77 = Pinc.0,.... ,Timer = 1 " ist dann( wenn ich das richtig verstanden habe) der Timer1 belegt also muss ich die PWM auf den Timer2 schieben
oder ist Timer2 auch durch die Config Dcf77 belegt?

ich habe dann ja den Sting Time$ im dem meine Uhrzeit steht
das große Problem ist jetzt wie bekomme ich die Uhrzeit (Time$) in meine 3 Blöcke und die 8 Zeilen

lg mnsp2
 
Hallo mnsp2 !

Wie du es schon richtig erkannt hast, wird der Timer1 zwingend von der DCF77-Routine in BASCOM benötigt.
Damit fällt der Timer1 für alle anderen Anwendungen raus!

Wenn du nun einen Dimmer via PWM benötigst hast du jetzt zwei Möglichkeiten.....
  1. Einen anderen Timer für PWM verwenden
  2. Eine andere DCF-Routine verwenden, die NICHT den Timer1 benötigt

Wenn du den PWM mittels Timer1 behalten möchtest, dann schau dir mal die BASCOM DCF77.lib (incl. DCF77_soft.bas) von RN-Wissen an.

Ich verwende beide Varianten.... also die BASCOM-Routine und die von RN-Wissen.
Allerdings nehme ich die Lösung von RN-Wissen lieber, weil sie auch besser und schneller funktioniert. :)



Was das "Aufteilen" der Zeit betrifft:
Du bekommst nicht nur automatisch die String-Variable "Time$"......
sondern auch die einzelnen System-Variablen _hour, _min, _sec !
Gleiches gilt übrigens auch für "Date$" ---> _day , _month , _year

Alle diese Variablen sind allerdings Bytes und keine Strings!

Da du die Zahlen manchmal sowieso zerlegen musst (z.B. die 18 in 1 und 8) würde ich die Byte-Variablen nutzen.



Beide Überlegungen...... DCF77 mit Timer2 und Aufsplitten der Zahlen.... habe ich bei meinem letzten Uhren-Projekt auch verwendet. Schau einfach mal HIER rein. Ab Beitrag Nr. 24 geht es mit dem Programmcode los (der zur Zeit nicht als BASCOM-Highlight dargestellt wird).

Grüße,
Cassio
 
Hallo mnsp2,
wenn du sowieso die Variablen Time$ usw anlegen lässt (durch Config DCF77 ...) dann kannst du dort auch direkt die Stellenwerte abgreifen.
Durch diese Variablen
Dim My_time(8) As Byte At Time$ Overlay '"11:15:56"
Dim My_date(8) As Byte At Date$ Overlay '"03.04.11"
kannst du direkt auf einzelne Stellen Von Uhrzeit und Datum zugreifen.
Minute_einer = My_time(5)
Allerdings stehen in My_time die Ascii Werte der Ziffern. Also musst du dies noch korrigieren
Minute_einer = My_time(5) - 48 '48 = Asc("0")

HBA
 
hallo zusammen
Wenn du nun einen Dimmer via PWM benötigst hast du jetzt zwei Möglichkeiten.....
1. Einen anderen Timer für PWM verwenden
2. Eine andere DCF-Routine verwenden, die NICHT den Timer1 benötigt
ich werde den einfacheren Weg (Möglichkeit 1) gehen und die PWM mit timer2 realisieren
das mit der PWM ist eigentlich nicht ganz so wichtig
Durch diese Variablen
Dim My_time(8) As Byte At Time$ Overlay '"11:15:56"
Dim My_date(8) As Byte At Date$ Overlay '"03.04.11"
kannst du direkt auf einzelne Stellen Von Uhrzeit und Datum zugreifen.
Minute_einer = My_time(5)
Allerdings stehen in My_time die Ascii Werte der Ziffern. Also musst du dies noch korrigieren
Minute_einer = My_time(5) - 48 '48 = Asc("0")

danke für den Tipp werde ich testen

das mit DCF77 ist erstmal geklärt ich habe eigentlich eine anders Problem
Die Darstellung von Zeichen
ich Bekomme es nicht hin aus einer DATA Tabelle Zeichen darzustellen
0 0 0 0 1 0
0 0 0 0 1 0
0 0 0 0 1 0
0 0 0 0 1 0
1 0 0 0 1 0
1 0 0 0 1 0
0 1 1 1 0 0
0 0 0 0 0 0
--->
Data &B000010 , &B000010 , &B000010 , &B000010 , &B100010 , &B100010 , &B011100 , &B000000
Code:
 '*******************************************************************************
'                              LED Matix Uhr
'
' - - - -block1 - - - - - block2 - - - - - block3 - -
'7. 5432109876543210 5432109876543210 5432109876543210
'6. 5432109876543210 5432109876543210 5432109876543210
'5. 5432109876543210 5432109876543210 5432109876543210
'4. 5432109876543210 5432109876543210 5432109876543210
'3. 5432109876543210 5432109876543210 5432109876543210
'2. 5432109876543210 5432109876543210 5432109876543210
'1. 5432109876543210 5432109876543210 5432109876543210
'0. 5432109876543210 5432109876543210 5432109876543210

'*******************************************************************************

' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output

Config Portd.5 = Output                                     '<-- für PWM
Config Portc.0 = Input
Portc.0 = 1

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0
Enableout Alias Portd.5                                     '<-- für PWM


' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

Config Timer2 = Pwm , Compare Pwm = Clear Up , Prescale = 1

Enable Interrupts
' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim Zeile As Byte
Dim Helligkeitswert As Long

Dim Block1 As Word
Dim Block2 As Word
Dim Block3 As Word


Declare Sub Helligkeit

Dim Tastendruck As Byte


' Werte ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Helligkeitswert = 20

'*******************************************************************************
' Hauptschleife
'*******************************************************************************

Do
Debounce Pinc.0 , 0 , Helligkeit , Sub

Ocr2 = Helligkeitswert

Loop

'*******************************************************************************
' SUB ,Gosub
'*******************************************************************************
Sub Helligkeit

  Incr Tastendruck
  Gosub Pwm

End Sub

Pwm:
   Select Case Tastendruck

   If Tastendruck = 5 Then Tastendruck = 1

   Case 1:
       Helligkeitswert = 2
   Case 2:
       Helligkeitswert = 50
   Case 3:
       Helligkeitswert = 170
   Case 4:
       Helligkeitswert = 511
   End Select
Return


'*******************************************************************************
' Timer0 --> Anzeige Prozess
'*******************************************************************************

Timer_0:

Porta.zeile = 1                                             'schaltet die vorherige Zeile aus

Incr Zeile

Block1 = Lookup(zeile , Zeichen )
Block2 = 0
Block2 = 0

If Zeile = 8 Then Zeile = 0

Strobeout = 0
C Dataout , Clockout , Block1 , 0 , 16

Shiftout Dataout , Clockout , Block2 , 0 , 16

Shiftout Dataout , Clockout , Block3 , 0 , 16
Strobeout = 1

Porta.zeile = 0                                             'schaltet die neue Zeile ein

Return
'*******************************************************************************
' Zeichen Tabelle
'*******************************************************************************

Zeichen:
Data &B000010 , &B000010 , &B000010 , &B000010 , &B100010 , &B100010 , &B011100 , &B000000
ich habe leider mit dem Programm nur punkte ohne System (kein J)

Das Problem ist auch das ein Block 16 bit x 8bit hat und ein Zeichen hat 6 bit x 8bit
das heist im einem Bock müssten 2 2/3 Zeichen stehen wie soll man das realisieren
Das zweite Problem ist das ein Byte immer 8 bit hat ...

ich bin ein wenig verzweifelt :cray:
lg mnsp2
 
Erst noch mal eine Frage: Willst du damit auch Laufschrift machen oder nur eine fixe Darstellung, die sich, wie bei der Uhr, nur sehr langsam (sekündlich) ändert?
Mit Laufschrift wird die Sache wesentlich zeitkritischer, sodass ich da einen anderen Ansatz wählen würde, der unübersichtlicher, dafür aber effektiver ist.

HBA
 
Hallo
Angestrebter Ablauf :
1. Uhrzeit "13:45:50" <----------------------------------------------------------------*
wait 30 s
2. Uhrzeit fährt aus dem Bilde und das Datum "09.04.11" folgt
wait 5s
3. Datum fährt aus dem Bilde und Temperatur "20°C" folgt
wait 5s >--------------------------------------------------------------------------------*

Uhrzeit Datum --> DCF77
Temperatur ---> DS18B20
Das ist so das große Ziel ähnlich wie in dem Youtube Video die Ziffern wechsel Animation muss nicht sein ( ist wahrscheinlich auch nicht mach bar)

lg mnsp2
 
Hallo,

Angestrebter Ablauf :
1. Uhrzeit "13:45:50" <----------------------------------------------------------------*
wait 30 s
2. Uhrzeit fährt aus dem Bilde und das Datum "09.04.11" folgt
wait 5s
3. Datum fährt aus dem Bilde und Temperatur "20°C" folgt
wait 5s >--------------------------------------------------------------------------------*
als Tip vorweg ... für das Verständnis wie es ablaufen soll kanst du das Wait nehmen.
Später in deinem Programm wirst du mit einem Wait voll auf dem Bauch landen weil
der Atmel dann die angegebene Zeit garnix macht. Wirklich garnix. Du mußt es also
über eine Art Zeitzähler oder Scheduler machen.

Gruß
Dino
 
Hallo Mnsp2,
Das ist natürlich schon großes Kino.
So etwas habe ich mal für eine 7 -segment Anzeige gemacht.
http://www.youtube.com/watch?v=LtGDgXXdcsA
Das war recht aufwändig. Mal schauen, wie weit du mit deinem Projekt kommst.
Wenn du mit beiden Arten von Animation (nach links rauslaufen und von oben nach unten scrollen) liebäugelst , dann sollte man das schon einmal im Hinterkopf behalten.
Für den durchlaufenden Text würde ich z. B. neben den aktuellen Blöcken1-3 noch die für den nächsten Text in den Blöcken4-6 halten. Für den Wechsel wird dann durchgeshiftet. Aber das kommt später.
Jetzt erst einmal einen neuen Text in die Blöcke1-3 reinbekommen.
Ich habe mal so etwas zusammengebastelt. Sieht etwas kryptisch aus, macht aber im Simulator, was es soll.
Da ich mich bei der Reihenfolge vertan hatte, sind unten die Zuweisungen zu den Blöcken etwas verdreht:

Code:
'*******************************************************************************
'                              LED Matix Uhr
'*******************************************************************************

' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output
Config Portd.5 = Output                                     '<-- für PWM

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0
Enableout Alias Portd.5                                     '<-- für PWM

'Zeile Alias Porta

' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 1
Enable Timer1

'Enable Interrupts
' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Dim Helligkeitswert As Long
Dim Block1(8) As Word
Dim Block2(8) As Word
Dim Block3(8) As Word
Dim Block4(8) As Word
Dim Block5(8) As Word
Dim Block6(8) As Word
Dim Zeile As Byte
Dim Out_str As String * 16
Dim Out_ovly(16) As Byte At Out_str Overlay
Dim Buchstabe As Byte
Dim Offset As Byte
Dim Temp As Byte
Dim Block1_w As Word
Dim Block2_w As Word
Dim Block3_w As Word
Dim Block1_l_b As Byte At Block1_w Overlay
Dim Block1_h_b As Byte At Block1_w + 1 Overlay
Dim Block2_l_b As Byte At Block2_w Overlay
Dim Block2_h_b As Byte At Block2_w + 1 Overlay
Dim Block3_l_b As Byte At Block3_w Overlay
Dim Block3_h_b As Byte At Block3_w + 1 Overlay
Dim Block4_w As Word
Dim Block1_2_long As Long At Block1_w Overlay
Dim Block2_3_long As Long At Block2_w Overlay
'(
  - - - -block1 - - - - -block2 - - - - - -block3 - - - - - -block4 - - - - -block5 - - - - - -block6 - -
7. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
6. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
5. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
4. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
3. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
2. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
1. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
0. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210

   11111122_22223333 33444444_55555566 66667777_77888888 1111112222223333 3344444455555566 6666777777888888
   Blck_3_l_blck_3_h Blck_2_l_blck_2_h Blck_1_l_blck_1_h
   76543210_76543210 76543210_76543210 76543210_76543210

Out_str = "ABCDEFIJ"

Do
   For Zeile = 6 To 0 Step -1
      For Buchstabe = 1 To 8
         If Buchstabe = 6 Then
            Shift Block3_w , Left , 6
         Elseif Buchstabe = 7 Then
            Shift Block3_w , Left , 4
         End If
         Shift Block1_2_long , Left , 6
         Offset = Out_ovly(buchstabe) - 65                  'A ist der erste Buchstabe, also 0
         Offset = Offset * 8
         Offset = Offset + Zeile
         Temp = Lookup(offset , My_data)
         Block1_l_b = Block1_l_b + Temp                     'dies überschreibt nur die unteren 6 Bit
         If Buchstabe = 8 Then Exit For
         Temp = Block2_h_b
         If Buchstabe = 7 Then
            Shift Temp , Right , 2
         Else
            Block3_l_b = 0
         End If
         Block3_l_b = Block3_l_b + Temp
      Next Buchstabe
      Incr Offset
      Block1(zeile+1) = Block3_w
      Block2(zeile+1) = Block2_w
      Block3(zeile+1) = Block1_w
   Next Zeile
Loop

End
Timer_0:
   Porta.zeile = 1                                             'schaltet die vorherige Zeile aus
   Incr Zeile
   If Zeile = 8 Then Zeile = 0
   Strobeout = 0
   Print Bin(block1(zeile + 1))
   Shiftout Dataout , Clockout , Block1(zeile + 1) , 0 , 16
   Shiftout Dataout , Clockout , Block2(zeile + 1) , 0 , 16
   Shiftout Dataout , Clockout , Block3(zeile + 1) , 0 , 16
   Strobeout = 1
   Porta.zeile = 0                                             'schaltet die neue Zeile ein
Return

$data
My_data:
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       'A
Data &B111100 , &B100010 , &B100010 , &B111100 , &B100010 , &B100010 , &B111100       'B
Data &B011100 , &B100010 , &B100000 , &B100000 , &B100000 , &B100010 , &B011100       'C
Data &B111100 , &B100010 , &B100010 , &B100010 , &B100010 , &B100010 , &B111100       'D
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B111110       'E
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B100000       'F
Data &B011100 , &B100010 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B011100 , &B001000 , &B001000 , &B001000 , &B001000 , &B001000 , &B011100       'I
Data &B000010 , &B000010 , &B000010 , &B000010 , &B100010 , &B100010 , &B011100       'J
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B100010 , &B110010 , &B110010 , &B101010 , &B101010 , &B100110 , &B100010       'N

Probier es mal aus, ob dabei irgendwas Vernünftiges rauskommt. Die ganze Schleife dauert etwa 0,8 ms bei deinen 16MHz, was ich noch als ok ansehe.

Was passiert eigentlich bei deinen Schieberegistern, wenn du anstelle von 48 Bit z.B. 60 Bit ausgibst? Werden dann die letzten 48 dargestellt?
Wenn ja, wäre das eine supergünstige Art den alten Text rauszuschieben. Du bräuchtest nur ein Pixel nach dem anderen von dem neuen Text zusätzlich mit auszugeben.

HBA
 
Hallo,

als Tip vorweg ... für das Verständnis wie es ablaufen soll kanst du das Wait nehmen.
das Wait war nur zum besserem Verständnis das Ablaufes

Wenn du mit beiden Arten von Animation (nach links rauslaufen und von oben nach unten scrollen) liebäugelst , dann sollte man das schon einmal im Hinterkopf behalten.
ich liebäugel schon mit den Animationen aber ich weiß nicht in wieweit das so zu schaffen ist
ich muss es erst mal hin bekommen die Datum, Uhrzeit und Temperatur sichtbar zu machen
alles andere sind dann die Feinheiten (richtig ist das man das schon im Hinterkopf behält)
Jetzt erst einmal einen neuen Text in die Blöcke1-3 rein bekommen.

Was passiert eigentlich bei deinen Schieberegistern, wenn du anstelle von 48 Bit z.B. 60 Bit ausgibst? Werden dann die letzten 48 dargestellt?
Wenn ja, wäre das eine supergünstige Art den alten Text rauszuschieben. Du bräuchtest nur ein Pixel nach dem anderen von dem neuen Text zusätzlich mit auszugeben.
Ja wenn ich z.B. 60 Bit einschiebe dann werden die letzten 48 Bit angezeigt und die erste 12 Bit "fallen runter" (das seitliche scrollen sollte machbar sein)

zu dem Programm
Danke HinterBlauenAugen das du mir so Hilfst :adore:
ich habe das Programm so auf mein Atmega32 gebrannt :
Code:
' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0

'Zeile Alias Porta

' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

'Enable Interrupts

' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Dim Block1(8) As Word
Dim Block2(8) As Word
Dim Block3(8) As Word

Dim Block4(8) As Word
Dim Block5(8) As Word
Dim Block6(8) As Word

Dim Zeile As Byte

Dim Out_str As String * 16
Dim Out_ovly(16) As Byte At Out_str Overlay

Dim Buchstabe As Byte
Dim Offset As Byte
Dim Temp As Byte

Dim Block1_w As Word
Dim Block2_w As Word
Dim Block3_w As Word
Dim Block4_w As Word

Dim Block1_l_b As Byte At Block1_w Overlay
Dim Block1_h_b As Byte At Block1_w + 1 Overlay

Dim Block2_l_b As Byte At Block2_w Overlay
Dim Block2_h_b As Byte At Block2_w + 1 Overlay

Dim Block3_l_b As Byte At Block3_w Overlay
Dim Block3_h_b As Byte At Block3_w + 1 Overlay

Dim Block1_2_long As Long At Block1_w Overlay
Dim Block2_3_long As Long At Block2_w Overlay

'  - - - -block1 - - - - -block2 - - - - - -block3 - - - - - -block4 - - - - -block5 - - - - - -block6 - -
'7. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'6. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'5. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'4. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'3. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'2. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'1. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'0. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
'
'   11111122_22223333 33444444_55555566 66667777_77888888 1111112222223333 3344444455555566 6666777777888888
'   Blck_3_l_blck_3_h Blck_2_l_blck_2_h Blck_1_l_blck_1_h
'   76543210_76543210 76543210_76543210 76543210_76543210


' Werte ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Out_str = "ABCDEFIJ"

'*******************************************************************************
' Hauptschleife
'*******************************************************************************
Do
'
   For Zeile = 6 To 0 Step -1

'                         ---------------------
         For Buchstabe = 1 To 8

            If Buchstabe = 6 Then
               Shift Block3_w , Left , 6
            Elseif Buchstabe = 7 Then
               Shift Block3_w , Left , 4
            End If

            Shift Block1_2_long , Left , 6
            Offset = Out_ovly(buchstabe) - 65               'A ist der erste Buchstabe, also 0
            Offset = Offset * 8
            Offset = Offset + Zeile
            Temp = Lookup(offset , My_data)

            Block1_l_b = Block1_l_b + Temp                  'dies überschreibt nur die unteren 6 Bit

            If Buchstabe = 8 Then Exit For

            Temp = Block2_h_b

            If Buchstabe = 7 Then
               Shift Temp , Right , 2
            Else
               Block3_l_b = 0
            End If

            Block3_l_b = Block3_l_b + Temp
         Next Buchstabe
'                         --------------------

      Incr Offset
      Block1(zeile + 1) = Block3_w
      Block2(zeile + 1) = Block2_w
      Block3(zeile + 1) = Block1_w

   Next Zeile
Loop

End

'*******************************************************************************
' Timer0 --> Anzeige Prozess
'*******************************************************************************

Timer_0:

   Porta.zeile = 1                                          'schaltet die vorherige Zeile aus
   Incr Zeile
   If Zeile = 8 Then Zeile = 0
   Strobeout = 0
   'Print Bin(block1(zeile + 1))
   Shiftout Dataout , Clockout , Block1(zeile + 1) , 0 , 16
   Shiftout Dataout , Clockout , Block2(zeile + 1) , 0 , 16
   Shiftout Dataout , Clockout , Block3(zeile + 1) , 0 , 16
   Strobeout = 1
   Porta.zeile = 0                                          'schaltet die neue Zeile ein

Return

'*******************************************************************************
' Zeichen Tabelle
'*******************************************************************************
$data
My_data:
Data &B001000 , &B010100 , &B100010 , &B100010 , &B111110 , &B100010 , &B100010       'A
Data &B111100 , &B100010 , &B100010 , &B111100 , &B100010 , &B100010 , &B111100       'B
Data &B011100 , &B100010 , &B100000 , &B100000 , &B100000 , &B100010 , &B011100       'C
Data &B111100 , &B100010 , &B100010 , &B100010 , &B100010 , &B100010 , &B111100       'D
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B111110       'E
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B100000       'F
Data &B011100 , &B100010 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B011100 , &B001000 , &B001000 , &B001000 , &B001000 , &B001000 , &B011100       'I
Data &B000010 , &B000010 , &B000010 , &B000010 , &B100010 , &B100010 , &B011100       'J
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B100010 , &B110010 , &B110010 , &B101010 , &B101010 , &B100110 , &B100010       'N
ich habe nur unregelmäßige streifen von oben nach unten auf der Matrix :confused:
ich habe versucht die DO .LOOP schliefe nach zu vollziehen leider aber nicht mit erfolg :eek:

lg mnsp2
 
Hallo mnsp2,
da ich etwas Probleme habe, die Sache in Hardware auszuprobieren, kann ich nur im Simulator testen.
Schau doch mal, ob die Ausgabe der Prints in diesem Programm im Simulator das Gleiche ist, wie auf deiner Anzeige. Dann kann ich es so immer testen.

Code:
'*******************************************************************************
'                              LED Matix Uhr
'*******************************************************************************

' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output
Config Portd.5 = Output                                     '<-- für PWM

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0
Enableout Alias Portd.5                                     '<-- für PWM

'Zeile Alias Porta

' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Dim Helligkeitswert As Long
Dim Block1(8) As Word
Dim Block2(8) As Word
Dim Block3(8) As Word
Dim Block4(8) As Word
Dim Block5(8) As Word
Dim Block6(8) As Word
Dim Zeile As Byte
Dim Out_str As String * 16
Dim Out_ovly(16) As Byte At Out_str Overlay
Dim Buchstabe As Byte
Dim Offset As Byte
Dim Temp As Byte
Dim Block1_w As Word
Dim Block2_w As Word
Dim Block3_w As Word
Dim Block1_l_b As Byte At Block1_w Overlay
Dim Block1_h_b As Byte At Block1_w + 1 Overlay
Dim Block2_l_b As Byte At Block2_w Overlay
Dim Block2_h_b As Byte At Block2_w + 1 Overlay
Dim Block3_l_b As Byte At Block3_w Overlay
Dim Block3_h_b As Byte At Block3_w + 1 Overlay
Dim Block4_w As Word
Dim Block1_2_long As Long At Block1_w Overlay
Dim Block2_3_long As Long At Block2_w Overlay
'(
   - - - -block1 - - - - -block2 - - - - - -block3 - - - - - -block4 - - - - -block5 - - - - - -block6 - -
7. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
6. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
5. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
4. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
3. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
2. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
1. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
0. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210

   11111122_22223333 33444444_55555566 66667777_77888888 1111112222223333 3344444455555566 6666777777888888
   Blck_3_l_blck_3_h Blck_2_l_blck_2_h Blck_1_l_blck_1_h
   76543210_76543210 76543210_76543210 76543210_76543210
                                                011100
                                         011100
                                  0111 00100001
')
'Block1_w = &B0110011011111111
'Block2_w = &B1001100100000000
'Block3_w = &B1111000000001111
'Shift Block0_double , Left , 1
'Shift Block0_double , Right , 1
Out_str = "ABCDEFIJ"

' Werte ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Helligkeitswert = 20

'*******************************************************************************
' Hauptschleife
'*******************************************************************************
'Block1(1) = &B000010_001000_0000
'Block1(2) = &B000010_010100_0000
'Block1(3) = &B000010_100010_0000
'Block1(4) = &B000010_000010_0000
'Block1(5) = &B100010_111110_0000
'Block1(6) = &B100010_100010_0000
'Block1(7) = &B011100_100010_011100_100010_011100_100010
'Block1(8) = &B000000_000000_0000

'Block2(1) = &B000010_001000_0000
'Block2(2) = &B000010_010100_0000
'Block2(3) = &B000010_100010_0000
'Block2(4) = &B000010_000010_0000
'Block2(5) = &B100010_111110_0000
'Block2(6) = &B100010_100010_0000
'Block2(7) = &B011100_100010_0000
'Block2(8) = &B000000_000000_0000

'Block3(1) = &B000010_001000_0000
'Block3(2) = &B000010_010100_0000
'Block3(3) = &B000010_100010_0000
'Block3(4) = &B000010_000010_0000
'Block3(5) = &B100010_111110_0000
'Block3(6) = &B100010_100010_0000
'Block3(7) = &B011100_100010_0000
'Block3(8) = &B000000_000000_0000
Config Base = 0
For Zeile = 6 To 0 Step -1
   For Buchstabe = 0 To 7
      If Buchstabe = 5 Then
         Shift Block3_w , Left , 6
      Elseif Buchstabe = 6 Then
         Shift Block3_w , Left , 4
      End If
      Shift Block1_2_long , Left , 6
      Offset = Out_ovly(buchstabe) - 65                  'A ist der erste Buchstabe, also 0
      Offset = Offset * 7
      Offset = Offset + Zeile
      Temp = Lookup(offset , My_data)
      Block1_l_b = Block1_l_b + Temp                     'dies überschreibt nur die unteren 6 Bit
      If Buchstabe = 7 Then Exit For
      Temp = Block2_h_b
      If Buchstabe = 6 Then
         Shift Temp , Right , 2
         Temp = Temp And &B00001111
         Block3_l_b = Block3_l_b + Temp
      Else
         Block3_l_b = Temp
      End If
   Next Buchstabe
   Incr Offset
   Block1(zeile ) = Block3_w
   Block2(zeile ) = Block2_w
   Block3(zeile ) = Block1_w
   Print Bin(block1(zeile )) ; " " ; Bin(block2(zeile )) ; " " ; Bin(block3(zeile ))
Next Zeile

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 1
Enable Timer1

Enable Interrupts

Do
   nop
Loop
End


'*******************************************************************************
' Timer0 --> Anzeige Prozess
'*******************************************************************************

Timer_0:

Porta.zeile = 1                                             'schaltet die vorherige Zeile aus

Incr Zeile

If Zeile = 8 Then Zeile = 0

Strobeout = 0
Print Bin(block1(zeile ))
Shiftout Dataout , Clockout , Block1(zeile ) , 0 , 16
Shiftout Dataout , Clockout , Block2(zeile) , 0 , 16
Shiftout Dataout , Clockout , Block3(zeile ) , 0 , 16
Strobeout = 1

Porta.zeile = 0                                             'schaltet die neue Zeile ein

Return
'*******************************************************************************
' Zeichen Tabelle
'*******************************************************************************

$data
My_data:
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       'A
Data &B111100 , &B100010 , &B100010 , &B111100 , &B100010 , &B100010 , &B111100       'B
Data &B011100 , &B100010 , &B100000 , &B100000 , &B100000 , &B100010 , &B011100       'C
Data &B111100 , &B100010 , &B100010 , &B100010 , &B100010 , &B100010 , &B111100       'D
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B111110       'E
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B100000       'F
Data &B011100 , &B100010 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B011100 , &B001000 , &B001000 , &B001000 , &B001000 , &B001000 , &B011100       'I
Data &B000010 , &B000010 , &B000010 , &B000010 , &B100010 , &B100010 , &B011100       'J
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B100010 , &B110010 , &B110010 , &B101010 , &B101010 , &B100110 , &B100010       'N

Ich habe diesmal das Füllen der Blöcke1-3 vor die Hauptschleife gemacht. Das muss ja zunächst nur einmal ausgeführt werden.

HBA
 
Hallo HinterBlauenAugen

ich habe dein Programm getestet und es funktioniert :dance3:
ich musste nur aus der "Timer_0:" schleife das "Print Bin(block1(zeile ))" entfernen sonst habe ich ein sehr flackerndes und schwaches Bild

man kann im Simulator das gleiche sehen was auch auf der Matrix zusehen ist (im Simulator ist es nur auf kopf) :cool:



vor dem A ist ein undefinierbares Zeichen

hier letzterstand Programm:
Code:
'*******************************************************************************
'                              LED Matix Uhr
'*******************************************************************************

' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output
Config Portd.5 = Output                                     '<-- für PWM

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0
Enableout Alias Portd.5                                     '<-- für PWM

'Zeile Alias Porta

' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Dim Helligkeitswert As Long

Dim Block1(8) As Word
Dim Block2(8) As Word
Dim Block3(8) As Word
Dim Block4(8) As Word
Dim Block5(8) As Word
Dim Block6(8) As Word

Dim Zeile As Byte

Dim Out_str As String * 16
Dim Out_ovly(16) As Byte At Out_str Overlay

Dim Buchstabe As Byte
Dim Offset As Byte
Dim Temp As Byte

Dim Block1_w As Word
Dim Block2_w As Word
Dim Block3_w As Word
Dim Block4_w As Word

Dim Block1_l_b As Byte At Block1_w Overlay
Dim Block1_h_b As Byte At Block1_w + 1 Overlay

Dim Block2_l_b As Byte At Block2_w Overlay
Dim Block2_h_b As Byte At Block2_w + 1 Overlay

Dim Block3_l_b As Byte At Block3_w Overlay
Dim Block3_h_b As Byte At Block3_w + 1 Overlay

Dim Block1_2_long As Long At Block1_w Overlay
Dim Block2_3_long As Long At Block2_w Overlay
'(
     - - - -block1 - - - - -block2 - - - - - -block3 - - - - - -block4 - - - - -block5 - - - - - -block6 - -
7. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
6. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
5. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
4. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
3. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
2. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
1. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
0. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210

   11111122_22223333 33444444_55555566 66667777_77888888 1111112222223333 3344444455555566 6666777777888888
   Blck_3_l_blck_3_h Blck_2_l_blck_2_h Blck_1_l_blck_1_h
   76543210_76543210 76543210_76543210 76543210_76543210
                                                011100
                                         011100
                                  0111 00100001
')

' Werte ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Out_str = "ABCDEFGH"

'*******************************************************************************
' Hauptschleife
'*******************************************************************************

'Config Base = 0

For Zeile = 6 To 0 Step -1

         For Buchstabe = 0 To 7

            If Buchstabe = 5 Then
               Shift Block3_w , Left , 6
            Elseif Buchstabe = 6 Then
               Shift Block3_w , Left , 4
            End If
            Shift Block1_2_long , Left , 6
            Offset = Out_ovly(buchstabe) - 65               'A ist der erste Buchstabe, also 0
            Offset = Offset * 7
            Offset = Offset + Zeile
            Temp = Lookup(offset , My_data)
            Block1_l_b = Block1_l_b + Temp                  'dies überschreibt nur die unteren 6 Bit
            If Buchstabe = 7 Then Exit For
            Temp = Block2_h_b
            If Buchstabe = 6 Then
               Shift Temp , Right , 2
               Temp = Temp And &B00001111
               Block3_l_b = Block3_l_b + Temp
            Else
               Block3_l_b = Temp
            End If

         Next Buchstabe

   Incr Offset
   Block1(zeile ) = Block3_w
   Block2(zeile ) = Block2_w
   Block3(zeile ) = Block1_w

   Print Bin(block1(zeile )) ; " " ; Bin(block2(zeile )) ; " " ; Bin(block3(zeile ))
Next Zeile

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

Enable Interrupts

Do
   nop
Loop
End


'*******************************************************************************
' Timer0 --> Anzeige Prozess
'*******************************************************************************

Timer_0:

Porta.zeile = 1                                             'schaltet die vorherige Zeile aus

Incr Zeile

If Zeile = 8 Then Zeile = 0

Strobeout = 0
Shiftout Dataout , Clockout , Block1(zeile ) , 0 , 16
Shiftout Dataout , Clockout , Block2(zeile) , 0 , 16
Shiftout Dataout , Clockout , Block3(zeile ) , 0 , 16
Strobeout = 1

Porta.zeile = 0                                             'schaltet die neue Zeile ein

Return
'*******************************************************************************
' Zeichen Tabelle
'*******************************************************************************

$data
My_data:
Data &B001000 , &B010100 , &B100010 , &B100010 , &B111110 , &B100010 , &B100010       'A
Data &B111100 , &B100010 , &B100010 , &B111100 , &B100010 , &B100010 , &B111100       'B
Data &B011100 , &B100010 , &B100000 , &B100000 , &B100000 , &B100010 , &B011100       'C
Data &B111100 , &B100010 , &B100010 , &B100010 , &B100010 , &B100010 , &B111100       'D
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B111110       'E
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B100000       'F
Data &B011110 , &B100000 , &B100000 , &B101110 , &B100010 , &B100010 , &B011100       'G
Data &B100010 , &B100010 , &B100010 , &B111110 , &B100010 , &B100010 , &B100010       'H
Data &B011100 , &B001000 , &B001000 , &B001000 , &B001000 , &B001000 , &B011100       'I
Data &B000010 , &B000010 , &B000010 , &B000010 , &B100010 , &B100010 , &B011100       'J
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B100010 , &B110010 , &B101010 , &B100110 , &B100010 , &B100010 , &B100010       'N

lg mnsp2
 
Das Zeichen am Anfang muss noch weg. Aber im Moment interessiert mich erst mal dies mit scrollen:
Code:
'*******************************************************************************
'                              LED Matix Uhr
'*******************************************************************************

' µC Deklarationen +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 30
$framesize = 40

' Ein-/Ausgänge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Config Porta = Output
Config Portb = Output
Config Portd.5 = Output                                     '<-- für PWM

Dataout Alias Portb.2
Strobeout Alias Portb.1
Clockout Alias Portb.0
Enableout Alias Portd.5                                     '<-- für PWM

'Zeile Alias Porta

' Timer und Config +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

' Variablen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Dim Helligkeitswert As Long

Dim Block1(8) As Word
Dim Block2(8) As Word
Dim Block3(8) As Word
Dim Block4(8) As Word
Dim Block5(8) As Word
Dim Block6(8) As Word

Dim Zeile As Byte

Dim Out_str As String * 16
Dim Out_ovly(16) As Byte At Out_str Overlay

Dim Buchstabe As Byte
Dim Offset As Byte
Dim Temp As Byte

Dim Block1_w As Word
Dim Block2_w As Word
Dim Block3_w As Word
Dim Block4_w As Word

Dim Block1_l_b As Byte At Block1_w Overlay
Dim Block1_h_b As Byte At Block1_w + 1 Overlay

Dim Block2_l_b As Byte At Block2_w Overlay
Dim Block2_h_b As Byte At Block2_w + 1 Overlay

Dim Block3_l_b As Byte At Block3_w Overlay
Dim Block3_h_b As Byte At Block3_w + 1 Overlay

Dim Block1_2_long As Long At Block1_w Overlay
Dim Block2_3_long As Long At Block2_w Overlay

Dim Scroll_counter As Word
Dim Scroll_position As Byte

'(
     - - - -block1 - - - - -block2 - - - - - -block3 - - - - - -block4 - - - - -block5 - - - - - -block6 - -
7. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
6. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
5. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
4. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
3. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
2. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
1. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210
0. 54321098_76543210 54321098_76543210 54321098_76543210 5432109876543210 5432109876543210 5432109876543210

   11111122_22223333 33444444_55555566 66667777_77888888 1111112222223333 3344444455555566 6666777777888888
   Blck_3_l_blck_3_h Blck_2_l_blck_2_h Blck_1_l_blck_1_h
   76543210_76543210 76543210_76543210 76543210_76543210
                                                011100
                                         011100
                                  0111 00100001
')

' Werte ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Out_str = "ABCDEFGH"

'*******************************************************************************
' Hauptschleife
'*******************************************************************************

'Config Base = 0

For Zeile = 6 To 0 Step -1

         For Buchstabe = 0 To 7

            If Buchstabe = 5 Then
               Shift Block3_w , Left , 6
            Elseif Buchstabe = 6 Then
               Shift Block3_w , Left , 4
            End If
            Shift Block1_2_long , Left , 6
            Offset = Out_ovly(buchstabe) - 65               'A ist der erste Buchstabe, also 0
            Offset = Offset * 7
            Offset = Offset + Zeile
            Temp = Lookup(offset , My_data)
            Block1_l_b = Block1_l_b + Temp                  'dies überschreibt nur die unteren 6 Bit
            If Buchstabe = 7 Then Exit For
            Temp = Block2_h_b
            If Buchstabe = 6 Then
               Shift Temp , Right , 2
               Temp = Temp And &B00001111
               Block3_l_b = Block3_l_b + Temp
            Else
               Block3_l_b = Temp
            End If

         Next Buchstabe

   Incr Offset
   Block1(zeile ) = Block3_w
   Block2(zeile ) = Block2_w
   Block3(zeile ) = Block1_w
   Block4(zeile ) = Block3_w                                'eingescrollter Text ist der gleiche wieder
   Block5(zeile ) = Block2_w
   Block6(zeile ) = Block1_w

   Print Bin(block1(zeile )) ; " " ; Bin(block2(zeile )) ; " " ; Bin(block3(zeile ))
Next Zeile

Config Timer0 = Timer , Prescale = 64
On Timer0 Timer_0
Enable Timer0
Start Timer0

Enable Interrupts

Do
   nop
Loop
End


'*******************************************************************************
' Timer0 --> Anzeige Prozess
'*******************************************************************************

Timer_0:
Incr Scroll_counter
If Scroll_counter = 200 Then                                'alle 0,2sec rückt der Text weiter
   Scroll_counter = 0
   Incr Scroll_position
   If Scroll_position = 17 Then
      Scroll_position = 0
      Scroll_counter = 60000                                'sorgt für etwa 5 sec Pause
   End If
End If
Porta.zeile = 1                                             'schaltet die vorherige Zeile aus

Incr Zeile

If Zeile = 8 Then Zeile = 0

Strobeout = 0
Shiftout Dataout , Clockout , Block1(zeile ) , 0 , 16
Shiftout Dataout , Clockout , Block4(zeile ) , 0 , Scroll_position
Shiftout Dataout , Clockout , Block2(zeile) , 0 , 16
Shiftout Dataout , Clockout , Block5(zeile ) , 0 , Scroll_position
Shiftout Dataout , Clockout , Block3(zeile ) , 0 , 16
Shiftout Dataout , Clockout , Block6(zeile ) , 0 , Scroll_position
Strobeout = 1

Porta.zeile = 0                                             'schaltet die neue Zeile ein

Return
'*******************************************************************************
' Zeichen Tabelle
'*******************************************************************************

$data
My_data:
Data &B001000 , &B010100 , &B100010 , &B100010 , &B111110 , &B100010 , &B100010       'A
Data &B111100 , &B100010 , &B100010 , &B111100 , &B100010 , &B100010 , &B111100       'B
Data &B011100 , &B100010 , &B100000 , &B100000 , &B100000 , &B100010 , &B011100       'C
Data &B111100 , &B100010 , &B100010 , &B100010 , &B100010 , &B100010 , &B111100       'D
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B111110       'E
Data &B111110 , &B100000 , &B100000 , &B111110 , &B100000 , &B100000 , &B100000       'F
Data &B011110 , &B100000 , &B100000 , &B101110 , &B100010 , &B100010 , &B011100       'G
Data &B100010 , &B100010 , &B100010 , &B111110 , &B100010 , &B100010 , &B100010       'H
Data &B011100 , &B001000 , &B001000 , &B001000 , &B001000 , &B001000 , &B011100       'I
Data &B000010 , &B000010 , &B000010 , &B000010 , &B100010 , &B100010 , &B011100       'J
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B001000 , &B010100 , &B100010 , &B000010 , &B111110 , &B100010 , &B100010       '
Data &B100010 , &B110010 , &B101010 , &B100110 , &B100010 , &B100010 , &B100010       'N

HBA
 
Hallo zusammen
sorry das ich jetzt erst schreibe

ich habe das Programm mit dem scrollen getestet
so sieht das aus


leider ist keine scrollen zu erkennen
ich muss aber sage das mir
Code:
Timer_0:
Incr Scroll_counter
If Scroll_counter = 200 Then                                  'alle 0,2sec rückt der Text weiter
   Scroll_counter = 0
   Incr Scroll_position
   If Scroll_position = 17 Then
      Scroll_position = 0
      Scroll_counter = 60000                                'sorgt für etwa 5 sec Pause
   End If
End If

Porta.zeile = 1                                             'schaltet die vorherige Zeile aus

Incr Zeile

If Zeile = 8 Then Zeile = 0

Strobeout = 0
Shiftout Dataout , Clockout , Block1(zeile ) , 0 , 16
Shiftout Dataout , Clockout , Block4(zeile ) , 0 , Scroll_position
Shiftout Dataout , Clockout , Block2(zeile ) , 0 , 16
Shiftout Dataout , Clockout , Block5(zeile ) , 0 , Scroll_position
Shiftout Dataout , Clockout , Block3(zeile ) , 0 , 16
Shiftout Dataout , Clockout , Block6(zeile ) , 0 , Scroll_position
Strobeout = 1

Porta.zeile = 0                                             'schaltet die neue Zeile ein
Return
schon logisch erscheint
vielleicht ist da ein Denkfehler drin den ich nicht sehe :stupido2:

lg mnsp2
 

Über uns

  • Makerconnect ist ein Forum, welches wir ausschließlich für einen Gedankenaustausch und als Diskussionsplattform für Interessierte bereitstellen, welche sich privat, durch das Studium oder beruflich mit Mikrocontroller- und Kleinstrechnersystemen beschäftigen wollen oder müssen ;-)
  • Dirk
  • Du bist noch kein Mitglied in unserer freundlichen Community? Werde Teil von uns und registriere dich in unserem Forum.
  •  Registriere dich

User Menu

 Kaffeezeit

  • Wir arbeiten hart daran sicherzustellen, dass unser Forum permanent online und schnell erreichbar ist, unsere Forensoftware auf dem aktuellsten Stand ist und der Server regelmäßig gewartet wird. Auch die Themen Datensicherheit und Datenschutz sind uns wichtig und hier sind wir auch ständig aktiv. Alles in allem, sorgen wir uns darum, dass alles Drumherum stimmt :-)

    Dir gefällt das Forum und unsere Arbeit und du möchtest uns unterstützen? Unterstütze uns durch deine Premium-Mitgliedschaft!
    Wir freuen uns auch über eine Spende für unsere Kaffeekasse :-)
    Vielen Dank! :ciao:


     Spende uns! (Paypal)