Einzelnen Beitrag anzeigen

Benutzerbild von Muellermilchtrinker
Muellermilchtrinker

Registriert seit: 1. Aug 2009
447 Beiträge
 
Delphi 2009 Professional
 
#1

Unerklärbarer Error bei Matrix befüllung

  Alt 24. Sep 2010, 18:00
Delphi-Version: 2009
Hallo DP,

ich soll für einen Kumpel fragen, da er hier nicht angemeldet ist. Er programmiert gerade, einen kleinen LED Cube Simulator.
Also er hat die Ports des Microcontrollers und möchte die Ebene so ansteurn:
Ports2Matrix('&B00110011','&B00110011','&B00110011','&B00110011',2); Und das ist seine Funktion:
Delphi-Quellcode:
procedure TForm1.Ports2Matrix(Porta:String;Portb:String;Portc:String;Portd:String;Ebene:Integer);
  var Pa,Pb,Pc,Pd:String;
begin
  Pa := Copy(Porta,3,8);
  Pb := Copy(Portb,3,8);
  Pc := Copy(Portc,3,8);
  Pd := Copy(Portd,3,8);
  cube[1,1,Ebene+1] := StrToInt(Pa[8]); //Porta (Säule 1-8)
  cube[2,1,Ebene+1] := StrToInt(Pa[7]);
  cube[3,1,Ebene+1] := StrToInt(Pa[6]);
  cube[4,1,Ebene+1] := StrToInt(Pa[5]);
  cube[5,1,Ebene+1] := StrToInt(Pa[4]);
  cube[1,2,Ebene+1] := StrToInt(Pa[3]);
  cube[2,2,Ebene+1] := StrToInt(Pa[2]);
  cube[3,2,Ebene+1] := StrToInt(Pa[1]);
  cube[4,2,Ebene+1] := StrToInt(Pc[1]); //Portc (Säule 9-16)
  cube[5,2,Ebene+1] := StrToInt(Pc[2]);
  cube[1,3,Ebene+1] := StrToInt(Pc[3]);
  cube[2,3,Ebene+1] := StrToInt(Pc[4]);
  cube[3,3,Ebene+1] := StrToInt(Pc[5]);
  cube[4,3,Ebene+1] := StrToInt(Pc[6]);
  cube[5,3,Ebene+1] := StrToInt(Pc[7]);
  cube[1,4,Ebene+1] := StrToInt(Pc[8]); // Hier kommt der Error siehe unten
  cube[2,4,Ebene+1] := StrToInt(Pd[1]); //Portd (Säule 17)
  cube[3,4,Ebene+1] := StrToInt(Pb[8]); //Portb (Säule 18-25)
  cube[4,4,Ebene+1] := StrToInt(Pb[7]);
  cube[5,4,Ebene+1] := StrToInt(Pb[6]);
  cube[1,5,Ebene+1] := StrToInt(Pb[5]);
  cube[2,5,Ebene+1] := StrToInt(Pb[4]);
  cube[3,5,Ebene+1] := StrToInt(Pb[3]);
  cube[4,5,Ebene+1] := StrToInt(Pb[2]);
  cube[5,5,Ebene+1] := StrToInt(Pb[1]);
end;
Nach durchsteppen, hat er rausbekommen, dass der Error in der oben markierte Zeile auftritt.
Folgender Error tritt auf:
Code:
Erste Gelegenheit für Exception bei $761DFBAE. Exception-Klasse EConvertError mit Meldung '''
array ist ein array of integer.
Soll mich von ihm schon mal bedanken.
Chuck Norris doesn't need backups. He just uploads his files and lets the world mirror them.
  Mit Zitat antworten Zitat