Danke für Deine Mühen.
Hier mal der Code-Ausschnitt:
Der "Ruhewert" lliegt bei ca 1900. Wenn ich die Variable ACCSumme als "long" deklariere, kommen nur noch 3-stellige Ergebnisse heraus.Code:Const Max127wr = 84 Const Max127rd = 85 Const Controlbytequer = &B11100000 'Ch6, 0 bis 5V, normal Operation Const Controlbytehoehe = &B11110000 'Ch7, 0 bis 5V, normal Operation Const Controlbytedruck = &B10110000 'Ch3, 0 bis 5V, normal Operation Const Controlbyteakku = &B11000000 'Ch4, 0 bis 5V, normal Operation Const Controlbytegyrox = &B10010000 'Ch1, 0 bis 5V, normal Operation Vielleicht falsch herum !!!!!!!!!!!!!!!! Const Controlbytegyroy = &B10100000 'Ch2, 0 bis 5V, normal Operation Dim I As Byte , Accsumme As Single Dim Wert As Word , Wert2 As Word Dim Highbyte As Byte , Lowbyte As Byte _lcd_e = 128 'Upper half of 4-line display is selected Declare Function Max127lesen(byval Chsetting As Byte) As Word Accsumme = 0 For I = 0 To 255 Wert = Max127lesen(controlbytequer) Accsumme = Accsumme + Wert Next Wert = Accsumme / 256 Locate 1 , 1 Lcd "Quer : " ; Wert ; " " end Function Max127lesen(byval Chsetting As Byte) As Word Local Adwert As Word I2cinit I2cstart I2cwbyte Max127wr I2cwbyte Chsetting I2cstop I2cstart I2cwbyte Max127rd I2crbyte Highbyte , Nack I2crbyte Lowbyte , Nack I2cstop Adwert = Highbyte * 16 Lowbyte = Lowbyte / 16 Adwert = Adwert + Lowbyte Max127lesen = Adwert End Function
Die Zahl 256 habe ich bewusst gewählt, weil ich dachte, der Controller/Bascom rechnet dann mittels Verschieben der bits.






Zitieren

Lesezeichen