Hallo,
es geht eigentlich noch um die Stellpultsteuerung aus dem Thema "Zähler". Ich habe folgendes Problem:
Die Ausgänge (PortC.4; PortC.5; PortC.6; PortC.7) vom "ATMEGA162 16PU 0908H" funktionieren nicht. An den Ausgängen hängen Transistoren, die die Weichen schalten. Wenn ich den µC aus der Schaltung nehme und eine Drahtbrücke von +5V auf die jewailigen Pins tippe schalten die Weiche. Dann habe ich den µC in das STK500 geschteckt und ein kleines Testprogramm geschrieben wobei die LEDs blinken sollten. PortC.0 bis PortC.3 haben auch wie gedacht funktioniert, nur die LEDs von PortC.4 bis PortC.7 haben weder geleuchtet noch geblinkt.
Alle anderen Pins des µC arbeiten wie gewünscht.
Ein zweiter µC hat das selber Ergebnis gerbracht.
Wo liegt der der Fehler?
LG Felix
Ich kenne diesen Kontroller nicht, aber vielleicht haben diese Pins eine Sonderfunktion und müssen erst über spezielle Register zu Ausgangspins umgeschaltet werden?
Kannst du mal den Quellcode posten?
Also, das aktuelle Programm sieht folgendermaßen aus:
Code: |
$regfile = "M162def.dat"
$crystal = 1000000 $hwstack = 500 $swstack = 500 $framesize = 500 Led_a Alias Porta.0 Config Led_a = Output Porta.0 = 1 Led_b Alias Porta.1 Config Led_b = Output Porta.1 = 1 Led_c Alias Porta.2 Config Led_c = Output Porta.2 = 1 Led_d Alias Porta.3 Config Led_d = Output Porta.3 = 1 Led_e Alias Porta.4 Config Led_e = Output Porta.4 = 1 Led_f Alias Porta.5 Config Led_f = Output Porta.5 = 1 Led_g Alias Porta.6 Config Led_g = Output Porta.6 = 1 Led_h Alias Porta.7 Config Led_h = Output Porta.7 = 1 Led_i Alias Porte.0 Config Led_i = Output Porte.0 = 1 Led_j Alias Porte.1 Config Led_j = Output Porte.1 = 1 Led_k Alias Porte.2 Config Led_k = Output Porte.2 = 1 Wa_10_1 Alias Portc.7 Config Wa_10_1 = Output Wa_10_2 Alias Portc.6 Config Wa_10_2 = Output Wa_11_1 Alias Portc.5 Config Wa_11_1 = Output Wa_11_2 Alias Portc.4 Config Wa_11_2 = Output Wa_12_1 Alias Portc.3 Config Wa_12_1 = Output Wa_12_2 Alias Portc.2 Config Wa_12_2 = Output Wa_13_1 Alias Portc.1 Config Wa_13_1 = Output Wa_13_2 Alias Portc.0 Config Wa_13_2 = Output Wa_14_1 Alias Portb.7 Config Wa_14_1 = Output Wa_14_2 Alias Portb.6 Config Wa_14_2 = Output Wa_15_1 Alias Portb.5 Config Wa_15_1 = Output Wa_15_2 Alias Portb.4 Config Wa_15_2 = Output Wa_16_1 Alias Portb.3 Config Wa_16_1 = Output Wa_16_2 Alias Portb.2 Config Wa_16_2 = Output Wa_17_1 Alias Portb.1 Config Wa_17_1 = Output Wa_17_2 Alias Portb.0 Config Wa_17_2 = Output Taster_1 Alias Pind.0 Config Taster_1 = Input Portd.0 = 1 Taster_2 Alias Pind.1 Config Taster_2 = Input Portd.1 = 1 Taster_3 Alias Pind.2 Config Taster_3 = Input Portd.2 = 1 Taster_4 Alias Pind.3 Config Taster_4 = Input Portd.3 = 1 Taster_5 Alias Pind.4 Config Taster_5 = Input Portd.4 = 1 Taster_6 Alias Pind.5 Config Taster_6 = Input Portd.5 = 1 Taster_7 Alias Pind.6 Config Taster_7 = Input Portd.6 = 1 Do If Taster_1 = 0 Then Led_a = 1 Led_b = 1 Led_c = 1 Led_d = 1 Led_e = 1 Led_f = 1 Led_g = 1 Led_h = 1 Led_i = 1 Led_j = 1 Led_k = 1 Wait 1 Led_a = 0 Led_b = 0 Led_c = 0 Led_d = 0 Led_e = 0 Led_f = 0 Led_g = 0 Led_h = 0 Led_i = 0 Led_j = 0 Led_k = 0 Wa_17_1 = 1 Waitms 250 Wa_17_1 = 0 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_14_1 = 1 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_14_1 = 0 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_15_1 = 1 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_15_1 = 0 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_13_1 = 1 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_13_1 = 0 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_12_2 = 1 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_12_2 = 0 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_a = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_a = 1 Led_d = 1 Led_f = 1 End If If Taster_2 = 0 Then Led_a = 1 Led_b = 1 Led_c = 1 Led_d = 1 Led_e = 1 Led_f = 1 Led_g = 1 Led_h = 1 Led_i = 1 Led_j = 1 Led_k = 1 Wait 1 Led_a = 0 Led_b = 0 Led_c = 0 Led_d = 0 Led_e = 0 Led_f = 0 Led_g = 0 Led_h = 0 Led_i = 0 Led_j = 0 Led_k = 0 Wa_17_1 = 1 Waitms 250 Wa_17_1 = 0 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_14_1 = 1 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_14_1 = 0 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_15_1 = 1 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_15_1 = 0 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_13_1 = 1 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_13_1 = 0 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Wa_12_1 = 1 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Wa_12_1 = 0 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 Waitms 250 Led_b = 0 Led_d = 0 Led_f = 0 Waitms 250 Led_b = 1 Led_d = 1 Led_f = 1 End If If Taster_3 = 0 Then Led_a = 1 Led_b = 1 Led_c = 1 Led_d = 1 Led_e = 1 Led_f = 1 Led_g = 1 Led_h = 1 Led_i = 1 Led_j = 1 Led_k = 1 Wait 1 Led_a = 0 Led_b = 0 Led_c = 0 Led_d = 0 Led_e = 0 Led_f = 0 Led_g = 0 Led_h = 0 Led_i = 0 Led_j = 0 Led_k = 0 Wa_10_1 = 1 Waitms 250 Wa_10_1 = 0 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Wa_11_1 = 1 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Wa_11_1 = 0 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Wa_13_2 = 1 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Wa_13_2 = 0 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Wa_14_1 = 1 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Wa_14_1 = 0 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Wa_15_1 = 1 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Wa_15_1 = 0 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Led_c = 1 Led_e = 1 Led_f = 1 Waitms 250 Wa_17_1 = 1 Led_c = 0 Led_e = 0 Led_f = 0 Waitms 250 Wa_17_1 = 0 Led_c = 1 Led_e = 1 Led_f = 1 End If If Taster_4 = 0 Then Led_a = 1 Led_b = 1 Led_c = 1 Led_d = 1 Led_e = 1 Led_f = 1 Led_g = 1 Led_h = 1 Led_i = 1 Led_j = 1 Led_k = 1 Wait 1 Led_a = 0 Led_b = 0 Led_c = 0 Led_d = 0 Led_e = 0 Led_f = 0 Led_g = 0 Led_h = 0 Led_i = 0 Led_j = 0 Led_k = 0 Wa_10_1 = 1 Waitms 250 Wa_10_1 = 0 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Wa_11_2 = 1 Led_c = 1 Led_g = 1 Waitms 250 Wa_11_2 = 0 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 Waitms 250 Wa_14_1 = 1 Led_c = 0 Led_g = 0 Waitms 250 Wa_14_1 = 0 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Wa_15_2 = 1 Led_c = 1 Led_g = 1 Waitms 250 Wa_15_2 = 0 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 Waitms 250 Wa_17_1 = 1 Led_c = 0 Led_g = 0 Waitms 250 Wa_17_1 = 0 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 Waitms 250 Led_c = 0 Led_g = 0 Waitms 250 Led_c = 1 Led_g = 1 End If If Taster_5 = 0 Then Led_a = 1 Led_b = 1 Led_c = 1 Led_d = 1 Led_e = 1 Led_f = 1 Led_g = 1 Led_h = 1 Led_i = 1 Led_j = 1 Led_k = 1 Wait 1 Led_a = 0 Led_b = 0 Led_c = 0 Led_d = 0 Led_e = 0 Led_f = 0 Led_g = 0 Led_h = 0 Led_i = 0 Led_j = 0 Led_k = 0 Wa_10_2 = 1 Waitms 250 Wa_10_2 = 0 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Wa_16_1 = 1 Led_h = 1 Led_j = 1 Waitms 250 Wa_16_1 = 0 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Wa_17_2 = 1 Led_h = 0 Led_j = 0 Waitms 250 Wa_17_2 = 0 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 Waitms 250 Led_h = 0 Led_j = 0 Waitms 250 Led_h = 1 Led_j = 1 End If If Taster_6 = 0 Then Led_a = 1 Led_b = 1 Led_c = 1 Led_d = 1 Led_e = 1 Led_f = 1 Led_g = 1 Led_h = 1 Led_i = 1 Led_j = 1 Led_k = 1 Wait 1 Led_a = 0 Led_b = 0 Led_c = 0 Led_d = 0 Led_e = 0 Led_f = 0 Led_g = 0 Led_h = 0 Led_i = 0 Led_j = 0 Led_k = 0 Wa_17_1 = 1 Waitms 250 Wa_17_1 = 0 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Wa_15_1 = 1 Led_i = 1 Waitms 250 Wa_15_1 = 0 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Wa_14_2 = 1 Led_i = 0 Waitms 250 Wa_14_2 = 0 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 Waitms 250 Led_i = 0 Waitms 250 Led_i = 1 End If If Taster_7 = 0 Then Led_a = 1 Led_b = 1 Led_c = 1 Led_d = 1 Led_e = 1 Led_f = 1 Led_g = 1 Led_h = 1 Led_i = 1 Led_j = 1 Led_k = 1 Wait 1 Led_a = 0 Led_b = 0 Led_c = 0 Led_d = 0 Led_e = 0 Led_f = 0 Led_g = 0 Led_h = 0 Led_i = 0 Led_j = 0 Led_k = 0 Wa_10_2 = 1 Waitms 250 Wa_10_2 = 0 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Wa_16_2 = 1 Led_h = 1 Led_k = 1 Waitms 250 Wa_16_2 = 0 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 Waitms 250 Led_h = 0 Led_k = 0 Waitms 250 Led_h = 1 Led_k = 1 End If Loop End |
modellfreund hat folgendes geschrieben: |
PortC.4; PortC.5; PortC.6; PortC.7 |
modellfreund hat folgendes geschrieben: | ||
|
gerold hat folgendes geschrieben: |
Diese Pins sind mit dem JTAG-Interface vorbelegt. JTAG musst du über die Fuse-Bits deaktivieren. |
modellfreund hat folgendes geschrieben: |
- Was ist ein JTAG-Interface? |
modellfreund hat folgendes geschrieben: |
- Wie und wo kann ich (der/die/das) JTAG über die Fuse-Bits deaktivieren |
Zu der Frage was ein JTAG-Interface ist (ich wusste es ehrlich gesagt auch nicht so genau): http://de.wikipedia.org/wiki/JTAG
Das umstellen der Fuse Bits sollte mit dem Programm geschehen, mit dem du deinen Code auf den µC bringst. Ich habe nur in C programmiert und mit PonyProg2000 gab es da jedenfalls ein extra Menü.
edit:
Ups, da war gerold schneller^^
Zitat: |
- Wie und wo kann ich (der/die/das) JTAG über die Fuse-Bits deaktivieren |