Actually I used also the K8061_Demo, and I noticed that the data is not stable. It got this raw data of 546 the goes down to 236 and change the raw data in between on that, LM5 is connect.
This is the the connection I did for LM35 and K8061
https://plus.google.com/u/0/photos/110497944337599650934/albums/5691416631556116273/5691416632198673138
This is the macro code
Option Explicit
Private Declare Function OpenDevice Lib "k8061.dll" () As Long
Private Declare Sub CloseDevices Lib "k8061.dll" ()
Private Declare Sub CloseDevice Lib "k8061.dll" (ByVal CardAddress As Long)
Private Declare Function ReadAnalogChannel Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Channel As Long) As Long
Private Declare Function PowerGood Lib "k8061.dll" (ByVal CardAddress As Long) As Boolean
Private Declare Function Connected Lib "k8061.dll" (ByVal CardAddress As Long) As Boolean
Private Declare Sub ReadVersion Lib "k8061.dll" (ByVal CardAddress As Long, Buffer As Long)
Private Declare Sub ReadAllAnalog Lib "k8061.dll" (ByVal CardAddress As Long, Buffer As Long)
Private Declare Sub OutputAnalogChannel Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Channel As Long, ByVal Data As Long)
Private Declare Sub OutputAllAnalog Lib "k8061.dll" (ByVal CardAddress As Long, Buffer As Long)
Private Declare Sub ClearAnalogChannel Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Channel As Long)
Private Declare Sub SetAllAnalog Lib "k8061.dll" (ByVal CardAddress As Long)
Private Declare Sub ClearAllAnalog Lib "k8061.dll" (ByVal CardAddress As Long)
Private Declare Sub SetAnalogChannel Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Channel As Long)
Private Declare Sub OutputAllDigital Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Data As Long)
Private Declare Sub ClearDigitalChannel Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Channel As Long)
Private Declare Sub ClearAllDigital Lib "k8061.dll" (ByVal CardAddress As Long)
Private Declare Sub SetDigitalChannel Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Channel As Long)
Private Declare Sub SetAllDigital Lib "k8061.dll" (ByVal CardAddress As Long)
Private Declare Function ReadDigitalChannel Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Channel As Long) As Boolean
Private Declare Function ReadAllDigital Lib "k8061.dll" (ByVal CardAddress As Long) As Long
Private Declare Sub OutputPWM Lib "k8061.dll" (ByVal CardAddress As Long, ByVal Data As Long)
Private Declare Function ReadBackDigitalOut Lib "k8061.dll" (ByVal CardAddress As Long) As Long
Private Declare Sub ReadBackAnalogOut Lib "k8061.dll" (ByVal CardAddress As Long, Buffer As Long)
Private Declare Function ReadBackPWMOut Lib "k8061.dll" (ByVal CardAddress As Long) As Long
Private Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long) As Long
Dim TimerID As Long
Dim TimerSeconds As Single
Dim CardAddress As Long
Dim n As Long
Dim K As Long
Dim KM As Long
Dim dT As Long
Dim i As Long
Dim PWM As Long
Sub Button1_Click()
Dim h As Long
n = 0
K = Worksheets("Front").Cells(7, 1)
dT = Worksheets("Front").Cells(7, 4)
CardAddress = OpenDevice
If CardAddress >= 0 Then
Worksheets("Front").Cells(4, 1) = "Card connected"
TimerSeconds = dT ' the timer interval is now dT sec.
TimerID = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressOf TimerProc)
Else
Worksheets("Front").Cells(4, 1) = "Card not found"
End If
End Sub
Sub TimerProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal nIDEvent As Long, ByVal dwTimer As Long)
On Error Resume Next
Dim DataIn(0 To 8) As Long
Dim DataOut(0 To 8) As Long
ReadAllAnalog CardAddress, DataIn(0)
For i = 0 To 7
Worksheets("Front").Cells(11, 6 + i) = DataIn(i)
Next i
n = Worksheets("Front").Cells(15, 16)
OutputAllDigital CardAddress, n
'n = n + 1
Worksheets("Front").Cells(7, 1) = K
KM = Worksheets("Front").Cells(10, 1)
i = ReadAllDigital(CardAddress)
Worksheets("Front").Cells(8, 16) = i
For i = 0 To 7
DataOut(i) = Worksheets("Front").Cells(20, 6 + i)
Next i
OutputAllAnalog CardAddress, DataOut(0)
If K = 1 Then
' Transfer K, Date, Time,Delta Time to Start Buffer Line 5
Worksheets("Front").Cells(5, 1).Value = "Start"
Worksheets("Front").Cells(5, 2).Value = Worksheets("Front").Cells(7, 2).Value
Worksheets("Front").Cells(5, 3).Value = Worksheets("Front").Cells(7, 3).Value
Worksheets("Front").Cells(5, 4).Value = Worksheets("Front").Cells(7, 4).Value
End If
' Transfer K, Date, Time,Delta Time to Data Sheet
Worksheets("Data").Cells(2 + K, 2).Value = K
Worksheets("Data").Cells(2 + K, 3).Value = Worksheets("Front").Cells(7, 2).Value
Worksheets("Data").Cells(2 + K, 4).Value = Worksheets("Front").Cells(7, 3).Value
Worksheets("Data").Cells(2 + K, 5).Value = Worksheets("Front").Cells(7, 4).Value
For i = 1 To 8
'Analog Inputs
Worksheets("Data").Cells(2 + K, 5 + 0 + i).Value = Worksheets("Front").Cells(13, 5 + i).Value
'Analog Outputs
Worksheets("Data").Cells(2 + K, 5 + 8 + i).Value = Worksheets("Front").Cells(20, 5 + i).Value
'Digital Inputs
Worksheets("Data").Cells(2 + K, 5 + 16 + i).Value = Worksheets("Front").Cells(11, 16 + i).Value
'Digital Outputs
Worksheets("Data").Cells(2 + K, 5 + 24 + i).Value = Worksheets("Front").Cells(18, 16 + i).Value
'Digital Inputs Integration using dT Value
Worksheets("Front").Cells(12, 16 + i).Value = Worksheets("Front").Cells(12, 16 + i).Value _
+ Worksheets("Front").Cells(11, 16 + i).Value * Worksheets("Front").Cells(7, 4).Value
'Digital Outputs Integration using dT value
Worksheets("Front").Cells(19, 16 + i).Value = Worksheets("Front").Cells(19, 16 + i).Value _
+ Worksheets("Front").Cells(18, 16 + i).Value * Worksheets("Front").Cells(7, 4).Value
Next i
'OutputPWM CardAdress, 255
K = K + 1
If K > KM Then Call Button2_Click
End Sub
Sub Button2_Click()
KillTimer 0&, TimerID
CloseDevices
Worksheets("Front").Cells(4, 1) = "Card closed"
End Sub
Sub Clear_lines()
'
' Clear_lines Macro
Application.ScreenUpdating = False
Sheets("Data").Select
KM = Worksheets("Front").Cells(10, 1)
Range("B3", Range("B3").Offset(KM, 36)).Select
Selection.ClearContents
Rows(3).Select
Sheets("Front").Select
Range("A2").Select
K = 1
Worksheets("Front").Cells(7, 1) = 1
Worksheets("Front").Cells(5, 1).Value = ""
Worksheets("Front").Cells(5, 2).Value = ""
Worksheets("Front").Cells(5, 3).Value = ""
Worksheets("Front").Cells(5, 4).Value = ""
Application.ScreenUpdating = True
End Sub