hallo
Ich habe hier versucht den ds1621 auslesen über das Rn-Board V.1.4 über die Twileitung, dabei bin ich aber recht erfolgreich gescheitert.leider
hier zeige ich euch erstmal das Programm:
Ich habe auch nicht gerade viel über das Thema Twi gefunden.Code:$regfile = "m8def.dat" $crystal = 7372800 $baud = 9600 $lib "i2c_twi.lbx" Config Int0 = Low Level Config Scl = Portc.5 Config Sda = Portc.4 Declare Function Twistart() As Byte Declare Function Twisend(byval Databyte As Byte) As Byte Declare Function Twireceive(byref Databyte As Byte) As Byte Declare Sub Twistop() Dim Status As Byte Dim Datenbyte1 As Byte Dim Datenbyte2 As Byte Dim Command As Byte Dim I As Byte Dim B As Byte I2cinit Twbr = 0 Twsr = &B00000000 '----------------------------------------------Hauptprogramm------------------------------------------------------------ Do Twsr.2 = 1 Twcr = &H08 Status = Twistart() Status = Twisend(&B00000001 And &B7665321X90) Status = Twireceive(datenbyte1) Status = Twireceive(datenbyte2) Print Datenbyte1 Print Datenbyte2 Twistop Loop End Function Twistart() As Byte Twcr = &B10100100 Do : Loop Until Twcr.twint = 1 Twistart = Twsr And &B11111000 End Function 'twi anweisungen Function Twisend(byval Databyte As Byte) As Byte Twdr = Databyte Twcr = &B10000100 Do : Loop Until Twcr.twint = 1 End Function Function Twireceive(byref Databyte As Byte) As Byte Twcr = &B10000100 Do : Loop Until Twcr.twint = 1 Twireceive = Twsr And &B11111000 End Function Sub Twistop() Twcr = &B10010100 End Sub
Habt ihr vielleicht ein paar Tipps oder könnt ihr mir auf eine andere Art helfen.
gruß
patrick







Zitieren
Lesezeichen