um vier analoge Spannungen mit dem IOW24 zu messen habe ich einen PCF8591 eingesetzt. Das funktioniert recht gut, bis auf die Tatsache, das der 3. Kanal immer 0 ausgibt. Die Analoge Spannung liegt an dem 3 Eingang an, also eine Verbindung zu einem anderen Kanal kann ich ausschließen.
Hier mal der Quellcode:
Code: Select all
Dim i As Integer
Dim Ret As Integer
Dim Report(8) As Byte
For i = 0 To 8
Report(i) = &H0S
Next
' if found activate IIC
If iowHandles(iowHandel_ID) <> 0 Then
'IIC activate
Report(0) = &H1S
Report(1) = &H1S
Ret = IowKitWrite(iowHandles(iowHandel_ID), IOW_PIPE_SPECIAL_MODE, Report(0), 8)
' start meassuring
Report(0) = &H2S ' ReportID IIC write request
Report(1) = &HC2S ' 2 bytes with IIC Start and Stop
Report(2) = &H90S ' PCF8591 address byte = ADR 0, write
Report(3) = &H4S ' setzt im PCF 8591 das Flag Autoincrement auf true
Ret = IowKitWrite(iowHandles(iowHandel_ID), IOW_PIPE_SPECIAL_MODE, Report(0), 8)
'start reading
For i = 0 To 3
Report(0) = &H3S ' ReportID IIC read request
Report(1) = &H1S ' 2 bytes with IIC Start and Stop
Report(2) = &H91S ' PCF8591 address byte = ADR 0, read
Report(3) = &H0S
Ret = IowKitWrite(iowHandles(iowHandel_ID), IOW_PIPE_SPECIAL_MODE, Report(0), 8)
Report(0) = &H3S ' ReportID IIC read request
Report(1) = &H1S ' 2 bytes with IIC Start and Stop
Report(2) = &H0S
Report(3) = &H0S
Ret = IowKitReadNonBlocking(iowHandles(iowHandel_ID), IOW_PIPE_SPECIAL_MODE, Report(0), 8)
retValue(i) = Report(2)
Next
End If
Dann folgt das Adressbyte und anschließend das Control Byte für den PCF8591, richtig?
Nur warum wird der 3 Kanal nicht angezeigt?
Gruß
Volker