Hi,
I have got various 1-Wire devices running quite happily on my MicroLan and can read/write to them from my VB6 program, BUT...
I just can't seem to work out how to read the counters on the DS2423 and it's driving me mad!
To give you an idea of what I've got this is a typical example of how I read a DS18S20
[codebox] ' Create a container for the water thermometer
If bIsItemInListBox(sWaterTherm, frmSettings.DeviceList) Then
Set owContainer = owAdapter.getDeviceContainer(sWaterTherm)
Set owContainer = owContainer.getMostSpecificComponent
' Set read status
Set sState = owContainer.readDevice
' read the temp
owContainer.doTemperatureConvert (sState)
Set sState = owContainer.readDevice
DataSet.Temperature(3) = Format(owContainer.getTemperature(sState), "#0.0")
End If
[/codebox]
This works fine so I tried something similar for the DS2324
[codebox]' Create a container for the water level counter
If bIsItemInListBox(sWaterLevelCounter, frmSettings.DeviceList) Then
Set owContainer = owAdapter.getDeviceContainer(sWaterLevelCounter)
'Set owContainer = owContainer.getMostSpecificComponent
' Set read status
' Set sState = owContainer.readDevice
' read the counters
' DataSet.WaterLevel = OneWireContainer1D(owContainer, sWaterLevelCounter)
DataSet.WaterLevel = CalcWaterLevel(owContainer.readCounter(14), DataSet.MeasurementInterval)
End If
[/codebox]
You can see some of the (commented out) ways I have tried but I always get the same sort of error;
method not supported by this device or something like that
The error is always thrown by the owContainer.readCounter(14) call.
The DS2423 is found and identified correctly but I just can't read from it!
Can anyone point me in the right direction?
Have you got the counter to work in VB6?
If so would you be willing to post a code snippet showing how I should be doing it?
Thanks
I have got various 1-Wire devices running quite happily on my MicroLan and can read/write to them from my VB6 program, BUT...
I just can't seem to work out how to read the counters on the DS2423 and it's driving me mad!
To give you an idea of what I've got this is a typical example of how I read a DS18S20
[codebox] ' Create a container for the water thermometer
If bIsItemInListBox(sWaterTherm, frmSettings.DeviceList) Then
Set owContainer = owAdapter.getDeviceContainer(sWaterTherm)
Set owContainer = owContainer.getMostSpecificComponent
' Set read status
Set sState = owContainer.readDevice
' read the temp
owContainer.doTemperatureConvert (sState)
Set sState = owContainer.readDevice
DataSet.Temperature(3) = Format(owContainer.getTemperature(sState), "#0.0")
End If
[/codebox]
This works fine so I tried something similar for the DS2324
[codebox]' Create a container for the water level counter
If bIsItemInListBox(sWaterLevelCounter, frmSettings.DeviceList) Then
Set owContainer = owAdapter.getDeviceContainer(sWaterLevelCounter)
'Set owContainer = owContainer.getMostSpecificComponent
' Set read status
' Set sState = owContainer.readDevice
' read the counters
' DataSet.WaterLevel = OneWireContainer1D(owContainer, sWaterLevelCounter)
DataSet.WaterLevel = CalcWaterLevel(owContainer.readCounter(14), DataSet.MeasurementInterval)
End If
[/codebox]
You can see some of the (commented out) ways I have tried but I always get the same sort of error;
method not supported by this device or something like that
The error is always thrown by the owContainer.readCounter(14) call.
The DS2423 is found and identified correctly but I just can't read from it!
Can anyone point me in the right direction?
Have you got the counter to work in VB6?
If so would you be willing to post a code snippet showing how I should be doing it?
Thanks