Hallo PCVirus,
wenn es nur an einem komplette Port scheitern sollte, man kann sich auch einen komplette Port durch verschiedene I/O-Pins zusammen programmieren. "Splitting"
Gruß Silvio
Hier mal ein Beispiel von C.Kühnel´s BascomAVR
Code:' Splitting von Variablen auf I/O-Pins $regfile = "m8def.dat" ' ATmega8 $crystal = 3690000 ' für STK500 $baud = 19200 Dim A As Byte ' verfügbare I/O Pins beim ATmega8 ' PD2-PD7, PB0-PB5, PC0-PC5 ' Ausgabebyte soll durch PC0, PC1, PD2-PD7 gebildet werden ' Eingabebyte soll durch PB0-PB5, PC2, PC3 gebildet werden. Config Portd = Output Config Portb = Input Portb = 255 Ddrc = &B11000000 Portc = &B0011111 Declare Sub Write_port(x As Byte) Declare Function Read_port() As Byte Do Input "Eingabe [0-255]: " , A Write_port A A = Read_port() Print A Loop Sub Write_port(x As Byte) Portc.0 = X.0 Portc.1 = X.1 Portd.2 = X.2 Portd.3 = X.3 Portd.4 = X.4 Portd.5 = X.5 Portd.6 = X.6 Portd.7 = X.7 End Sub Function Read_port() As Byte Local X As Byte X.0 = Pinb.0 X.1 = Pinb.1 X.2 = Pinb.2 X.3 = Pinb.3 X.4 = Pinb.4 X.5 = Pinb.5 X.6 = Pinc.2 X.7 = Pinb.3 Read_port = X End Function






Zitieren

Lesezeichen