Gast
#118797
Hallo! Ich habe ein Problem mit dem I2C beim Mega16 und Bascom. SDA und SCL sind über je 5,6kOhm nach VCC gePullUpt. Ich habe testweise ein LCD, das über 2 PCF8574 angesteuert wird dranhängen. Das Problem: Den Avr verlässt kein einziges Signal. Er zieht die Leitungen nicht runter, also keine Startbedingungen usw. Ich hab's mit dem Oszi nachgemessen. Mein Code: '===CONFIGURATIONS=== $baud = 9600 $crystal = 16000000 $regfile = "m16def.dat" Config Pinc.6 = Output '595 Load-Leitung Config Pinc.7 = Output '595 Takt Config Pina.1 = Output '595 Daten Config Pina.0 = Input '165 Daten Config Pinb.1 = Output '165 Takt Config Pinb.0 = Output '165 Load Config Scl = Portc.0 'I²C SDA Config Sda = Portc.1 'I²C SCL '===ALIASE Beep Alias Portd.2 '===VARIABLEN=== Dim A As Byte Dim B As Byte Dim D As Byte Dim E As Byte Dim F As Byte Dim S As Byte '===PROGRAMMBEGINN=== Begin: I2cinit Sound Beep , 250 , 1000 'Ein bisschen gepiepse zum Anfang... Sound Beep , 250 , 900 Sound Beep , 250 , 800 Sound Beep , 500 , 500 Start: Waitms 500 'Watren '====Eigentlicher PROGRAMMSTART==== Source: 'TESTPROGRAMM B = &B01110001 'Addresse des PCF8574 mit DB0-DB7 am Ausgang... D = &B01110011 'Addresse des PCF8574 mit RS, E und R/W am Ausgang... I2cstart I2cwbyte D I2cwbyte &B00000000 I2cstop Waitms 25 I2cstart I2cwbyte B I2cwbyte &B00001100 I2cstop Waitms 25 I2cstart I2cwbyte D I2cwbyte &B10000000 I2cstop Waitms 25 I2cstart I2cwbyte D I2cwbyte &B00000000 I2cstop Waitms 25 I2cstart I2cwbyte B I2cwbyte 97 I2cstop Waitms 25 I2cstart I2cwbyte D I2cwbyte &B10000000 I2cstop Waitms 25 I2cstart I2cwbyte D I2cwbyte &B00000000 I2cstop End Was ich auch schon gestestet habe: B = &B01110000 'Addresse des PCF8574 mit DB0-DB7 am Ausgang... D = &B01110010 'Addresse des PCF8574 mit RS, E und R/W am Ausgang... I2csend D , &B00000000 Waitms 25 I2csend B , &B00001100 Waitms 25 I2csend D , &B10000000 Waitms 25 I2csend D , &B00000000 Waitms 25 I2csend B , 97 Waitms 25 I2csend D , &B10000000 Waitms 25 I2csend D , &B00000000 End Alles ohne Erfolg. Braucht man irgendwelche Libraries oder so? Was mache ich falsch? Ich bedanke mich schonmal... Liebe Grüße, Tobi