Help with the k8055

Hi, Just wondering how i could display a certain voltage and a scrollbar, I want a to be able to see the voltage change between 0v and 5v when i change the external power supply,

I would need the code for this and the setup… I tried pluging my voltage into analog inputs 1 and ground into ground. Then i created a scrollbar and gave it this

Private Sub VScrollBar2_Scroll(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar2.Scroll

    ReadAnalogChannel(1)

End Sub

but it didnt work, thanks

What do you expect that code to do? Did you forget to paste parts of the code?

You have put the code to the scrollbar Scroll event handler.
This way the scrollbar value is not updated automatically.

You can use timer or a button to activate the scrollbar position update according to the voltage connected to the K8055 analog input.

Here an example code that will do the job.
When the button is pressed the scrollbar value is updated:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click VScrollBar2.Value = ReadAnalogChannel(1) End Sub

Also remember to set the scrollbar property Maximum to 255.

I think i know what your saying VEL255 ,
But how would i do it without a button,
Just a scrollbar and a timer, as soon as the voltage supplied into A1 the slider will move?
Thanks for your comment

First you need to place a timer control on your form.
Double click the timer component and then enter the code to the event handler.
Below there is an example.

[code]Public Class Form1
Private Declare Function OpenDevice Lib “k8055d.dll” (ByVal CardAddress As Integer) As Integer
Private Declare Sub CloseDevice Lib “k8055d.dll” ()
Private Declare Function ReadAnalogChannel Lib “k8055d.dll” (ByVal Channel As Integer) As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim h As Integer
    h = OpenDevice(0)
    If h = 0 Then
        Label1.Text = "Card connected"
        Timer1.Enabled = True
    Else
        Label1.Text = "Card not connected"
    End If
End Sub

Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
    CloseDevice()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    VScrollBar1.Value = ReadAnalogChannel(1)
End Sub

End Class[/code]

i tried your code any still nothing, maybe i have the set up wrong, i have a power supply , the postive going into A1 and the negative going into the ground terminal just under it… any other help?

This is the code I used and works with displaying value in a label box.

Public Class FormRpsi
    Inherits System.Windows.Forms.Form
    Dim bDoNothing As Boolean
    Dim shtCount As Short
    Dim intCardNumber As Integer

    Private Declare Function OpenDevice Lib "k8061.dll" () As Integer
    Private Declare Sub CloseDevices Lib "k8061.dll" ()
    Private Declare Function ReadAnalogChannel Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Channel As Integer) As Integer
    Private Declare Function PowerGood Lib "k8061.dll" (ByVal intCardNumber As Integer) As Boolean
    Private Declare Function Connected Lib "k8061.dll" (ByVal intCardNumber As Integer) As Boolean
    Private Declare Sub ReadVersion Lib "k8061.dll" (ByVal intCardNumber As Integer, ByRef Buffer As Integer)
    Private Declare Sub ReadAllAnalog Lib "k8061.dll" (ByVal intCardNumber As Integer, ByRef Buffer As Integer)
    Private Declare Sub OutputAnalogChannel Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Channel As Integer, ByVal Data As Integer)
    Private Declare Sub OutputAllAnalog Lib "k8061.dll" (ByVal intCardNumber As Integer, ByRef Buffer As Integer)
    Private Declare Sub ClearAnalogChannel Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Channel As Integer)
    Private Declare Sub SetAllAnalog Lib "k8061.dll" (ByVal intCardNumber As Integer)
    Private Declare Sub ClearAllAnalog Lib "k8061.dll" (ByVal intCardNumber As Integer)
    Private Declare Sub SetAnalogChannel Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Channel As Integer)
    Private Declare Sub OutputAllDigital Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Data As Integer)
    Private Declare Sub ClearDigitalChannel Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Channel As Integer)
    Private Declare Sub ClearAllDigital Lib "k8061.dll" (ByVal intCardNumber As Integer)
    Private Declare Sub SetDigitalChannel Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Channel As Integer)
    Private Declare Sub SetAllDigital Lib "k8061.dll" (ByVal intCardNumber As Integer)
    Private Declare Function ReadDigitalChannel Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Channel As Integer) As Boolean
    Private Declare Function ReadAllDigital Lib "k8061.dll" (ByVal intCardNumber As Integer) As Integer
    Private Declare Sub OutputPWM Lib "k8061.dll" (ByVal intCardNumber As Integer, ByVal Data As Integer)
    Private Declare Sub Version Lib "k8061.dll" ()

    Private Sub ButtonRraise_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ButtonRraise.MouseDown
        SetDigitalChannel(0, 1)
    End Sub

    Private Sub ButtonRraise_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ButtonRraise.MouseUp
        ClearDigitalChannel(0, 1)
    End Sub

    Private Sub ButtonRlower_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ButtonRlower.MouseDown
        SetDigitalChannel(0, 2)
    End Sub

    Private Sub ButtonRlower_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ButtonRlower.MouseUp
        ClearDigitalChannel(0, 2)
    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim rpsi As Integer
        rpsi = ReadAnalogChannel(0, 1)
        lblrpsi.Text = rpsi
    End Sub
End Class

This post has had its content moderated, we apologize for the inconvenience.