-
-
Erfahrener Benutzer
Roboter Genie
HI Frank!
Ich habe das so gemacht, aber es kommt laut Speicheroszilloskop nix raus! Pullups usw...
Mein Quellcode:
Config Sda = Porta.0 'I²C SDA
Config Scl = Porta.1 'I²C SCL
Beep Alias Portd.2
595dat Alias Portc.6
595takt Alias Portc.1
595act Alias Portc.0
165dat Alias Pinc.7 '!!WICHTIG: Beim EINLESEN IMMER PinX.Y
165takt Alias Portb.1
165act Alias Portb.0
'===FUNKTIONEN===
Declare Function 595akt() As Byte
Declare Function Get165() As Byte
Declare Function Send_to_slave() As Byte
Declare Function Slv_input() As Byte
Declare Function Errorbeep(byval Number As Byte) As Byte
Declare Function Sirene(byval Oft As Byte) As Byte
Declare Function Rechts_vor() As Byte
Declare Function Rechts_rueck() As Byte
Declare Function Rechts_stop() As Byte
Declare Function Links_vor() As Byte
Declare Function Links_rueck() As Byte
Declare Function Links_stop() As Byte
Declare Function Beide_vor() As Byte
Declare Function Beide_rueck() As Byte
Declare Function Beide_stop() As Byte
Declare Function Beide_links() As Byte
Declare Function Beide_rechts() As Byte
Declare Function Mstop() As Byte
'===VARIABLEN===
Dim A As Byte
Dim B As Byte
Dim D As Byte
Dim E As Byte
Dim Tmpink As Byte
Dim 165pinstate(2) As Byte
Dim 595pinout(3) As Byte
Dim F As Byte
Dim S As Byte
Dim Actualslaveip As Byte
Dim Stscom As String * 4
Const 595online = 2 + 1
Const 165online = 1 + 1
'===PROGRAMMBEGINN===
Begin:
595act = 0 'activate '595 auf null
595takt = 0 'takt
595dat = 0 'data
165act = 1 'activate '595 auf null
165takt = 0 'takt
S = Asc( "s" ) 'S für success
F = Asc( "f" ) 'f für failure
595pinout(2) = 0 '595er auf null
595pinout(3) = 0
A = 595akt()
Sound Beep , 250 , 1000 'Ein bisschen gepiepse zum Anfang...
Sound Beep , 250 , 900
Sound Beep , 250 , 800
Sound Beep , 500 , 500
Starting:
A = Sirene(3) 'IICCCCCCCCCCHHHHHHHHHHH KKKOOOOOOMMMMMMMMMMMMMMMMMMMMMMMMMMEEEEEEEE!!
Waitms 500 'Watren
'====Eigentlicher PROGRAMMSTART====
Source: 'TESTPROGRAMM
B = &B01110001 'Addresse des Datenchip Daten
D = &B01110011 'steuer
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 'ENDE!!
Ich weis, es gibt dieses Codefenster, aber ich find's so übersichtlicher...
Zu den Pins kommt absolut nada raus. Meine Pullups sind 5,6kOhm.
Achso, ich steure damit 2 PCF8574P an. Das ist ein LCD wie auf
http://www.destroy-yourself.de/julia...amr/i2clcd.htm
Ich schätze, dass es irgendwie an der Programmierung liegt, aber...
Ihr kennt euch da besser aus. Bin I²C Noob.
Viele liebe Grüße,
Tobi
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
-
Foren-Regeln
Lesezeichen