Hallo. Ich habe in meinem Berufkollegs Unterricht ein Universalinterface Arduino gebaut(bild1). Dazu habe ich noch eine LED Matrix gebaut 2x MAX7219 -> 128 Led´s(bild2).
Bild1:
(Ist der vorgänger... später mach ich noch eine bild von mienem rein, aber an meinem gerät habe ich eine Digital platte wo ich die LED ansteuere)
Bild2:
Auf dieser Led Anzeige wolllte ich nun einen text ausgeben. Dazu hier mein quelltext....
Meine frage nun, wie so passiert nix auf meiner LED?
Ausschließen kann ich:
- syntax fehler (Neuste Aduino Version)
- Hardware fehler (Löt usw. fehler, erfolgreich im Unterricht & mit Sprite Animation getestet)
- Steck fehler (erfolgreich mit Sprite Animation getestet)
Quelltext:
//Pin Belegung
int dataIn = 2;
int load = 3;
int clock = 4;//Text Ausgabe
char message[] = "a_b_c"; // _ ist ein Leerzeichen!
int count= sizeof(message);//Daten von Temporeren var´s und arry´s
char* rowChar[5];
int letterWidth;
int letterHeight;
int payload;
int baseline=1;//Reinkommende Buchstaben Bytes
int ipswitch=0;
int spriteBit[8] = {1,2,4,8,16,32,64,128};
int iBuff[8][9] = {
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0}};//Wie viele MAX7219 hat der/die angeschlosse/en LED Matrix/en Insgesamt
int maxInUse = 2;//Nur eine variable
int e = 0;//Register definition vom MAX7219
byte max7219_reg_noop = 0x00;
byte max7219_reg_digit0 = 0x01;
byte max7219_reg_digit1 = 0x02;
byte max7219_reg_digit2 = 0x03;
byte max7219_reg_digit3 = 0x04;
byte max7219_reg_digit4 = 0x05;
byte max7219_reg_digit5 = 0x06;
byte max7219_reg_digit6 = 0x08;
byte max7219_reg_digit7 = 0x07;
byte max7219_reg_decodeMode = 0x09;
byte max7219_reg_intensity = 0x0a;
byte max7219_reg_scanLimit = 0x0b;
byte max7219_reg_shutdown = 0x0c;
byte max7219_reg_displayTest = 0x0f;void putByte(byte data) {
byte i = 8;
byte mask;
while(i > 0) {
mask = 0x01 << (i - 1); //Bekomme BitMaske
digitalWrite(clock, LOW); //Tick
if (data & mask){
digitalWrite(dataIn, HIGH); //Sendet 1
}else{
digitalWrite(dataIn, LOW); //Sendet 0
}
digitalWrite(clock, HIGH); //Tock
--i; //Bewegt zu BuchstabenBit
}
}
void maxSingle(byte reg, byte col) {
digitalWrite(load, LOW); //Start
putByte(reg); //Spezifizierungs Register
putByte(col); // Data Input
}void maxAll(byte reg, byte col){
int c=0;
digitalWrite(load, LOW);
for(c=1; c<= maxInUse; c++) {
putByte(reg);
putByte(col);
}
digitalWrite(load, LOW);
digitalWrite(load, HIGH);
}void setup() {
pinMode(dataIn, OUTPUT);
pinMode(clock, OUTPUT);
pinMode(load, OUTPUT);//Initialisierung von dem MAX7219
maxAll(max7219_reg_scanLimit, 0x07);
maxAll(max7219_reg_decodeMode, 0x00);
maxAll(max7219_reg_shutdown, 0x01);
maxAll(max7219_reg_displayTest, 0x00);
for (e=1; e<=8; e++) {
maxAll(e,0);
}
maxAll(max7219_reg_intensity, 0x0f & 0x0f); //Die erste variable ist zum umstellen der Reichweite da.
// Reichweite: 0x00 bis 0x0f
}void loop() {
//Loop pro Buchstabe in Nachricht
for(int m=0;m<count;m++){
bufferLetterMatrix(message[m]);
//Lade die Daten in den Buffer
for(int t=0; t<letterWidth; t++){
for(int b=0; b<letterWidth; b++){
iBuff[b+baseline][8]=byte(rowChar**[t]);**
** }**
** bufferStream();**
** renderDisplay();**
** }**
** }**
}
void bufferStream(){
** for(int d=0; d<8; d++) {**
** for(int f=0; f<8; f++) {**
** iBuff[d][f]= iBuff[d][f+1];**
** }**
** }**
}
void renderDisplay(){
** for(int t=0; t<8; t++){**
** payload=0;**
** for(int b=0; b<8; b++){**
__ if(iBuff[t] == '1') {__
__ payload=payload+spriteBit**;
}
}
maxSingle(t+1, payload);
}
delay(125);
}
//========================================================================================
void bufferLetterMatrix(char letter)
{**__** switch (letter) {**
** case 'a':**
** letterWidth=6; **
** letterHeight=5;**
** rowChar[0]="011100";**
** rowChar[1]="100010";**
** rowChar[2]="111110";**
** rowChar[3]="100010";**
** rowChar[4]="100010";**
** break;**
** case 'b':**
----->.... geht immer so weiter
** }}**
[/quote]