Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

CWAIPoint, CWDIO VB6 on windows 10

 

I have a project using vb6 running on win7 using the CWAIPoint and CWDIO 

 

using the code example:

 

Option Explicit

Private Sub Form_Load()
    CWAIPoint1.Device = 1
    CWAIPoint1.channels(1).ChannelString = 0
End Sub
Public Function GetVoltageRead(Ch As Integer, Current As Double, Connected As Integer, Optional AvgN As Integer = 1) As Variant
Dim Measurement As Variant, I As Integer, MeanV As Single, Reading As Single
If Not No_NIDMM Then
    If AvgN <= 0 Then AvgN = 1
    Delay 0.15
    OutToPort Ch, Current, Connected
    Delay ReadDelay ' 0.35 '0.25 '0.2
    For I = 1 To AvgN
        CWAIPoint1.SingleRead Measurement
        Reading = Measurement
        MeanV = MeanV + Reading
    Next I
    V(Ch) = Val(Format(MeanV / AvgN, "###0.0###"))
    GetVoltageRead = V(Ch)
    ResetAddress
Else
    V(Ch) = Rnd * 1.5 + 1.8
    GetVoltageRead = Val(Format(V(Ch), "###0.0###"))
    Exit Function
End If

End Function

 

 

 

I have to rewrite the part of the code that using 

CWAIPoint and CWDIO that use Read the Measurement on win10 

 

That is possible? There is an example of that?

Thanks

0 Kudos
Message 1 of 4
(488 Views)

Hello

 

What NI hardware you are using?

__________________________________________
The best way to thank, is to give KUDOS
0 Kudos
Message 2 of 4
(379 Views)

I have using https://documentation.help/NI-DMM-C.CVI.VB/ this method

and I have to replace  CWAIPoint, CWDIO components from 

https://www.ni.com/en-il/support/documentation/supplemental/06/transition-from-traditional-ni-daq--l...

 

for example I have the next code : 

 

Public Sub OutToPort(iCellNumber As Integer, sCurrentVal As Double, iA8 As Integer, Optional iA10 As Integer = -1)
    Dim iCurrentVal As Long, Apa_, Apb_, Bpa_, Bpb_, ICellNumber_ As Integer, C As Integer
    Dim Cab1 As Integer, On_%, Off_%
    If Lt = True Then
        On_% = iStateON%
        Off_% = iStateOFF%
    Else
        On_% = iStateOFF%
        Off_% = iStateON%
    End If
    If Not (Lt = True) Then iCurrentVal = mA2Bit(sCurrentVal, iCellNumber)
    If Lt = True Then iA8 = iA8 Xor 1
    If Not No_NIDMM Then
        If iCellNumber <= FirstCell + NFC / 2 - 1 Then
            Apa_ = APA '0
            Apb_ = APB '1
            Bpa_ = BPA '3
            Bpb_ = BPB '4
            ICellNumber_ = iCellNumber - FirstCell
        Else
            Apa_ = CPA '6
            Apb_ = CPB '7
            Bpa_ = DPA '9
            Bpb_ = DPB '10
            ICellNumber_ = iCellNumber - NFC / 2 - FirstCell
        End If
        If Lt = False Then
            Dmm.OutputBits.Ports.Item(Bpa_).SingleWrite iLowPart(iCurrentVal)
            Dmm.OutputBits.Ports.Item(Bpb_).SingleWrite iHighPart(iCurrentVal)
        End If
        Dmm.OutputBits.Ports.Item(Apa_).SingleWrite ICellNumber_                'aDDRESS=0
        Dmm.OutputBits.Ports.Item(Apb_).Lines(CellConnect).SingleWrite iA8
        Delay 0.05
        Dmm.OutputBits.Ports.Item(Apb_).Lines(cSync).SingleWrite Off_%
        If iA10 <> -1 Then
            Dmm.OutputBits.Ports.Item(Apb_).Lines(PowerRelay).SingleWrite iA10
        End If
    End If
End Sub

 

 

I have to replace by this methods  https://documentation.help/NI-DMM-C.CVI.VB/

the parts of  Dmm.OutputBits.Ports.Item(X) ..... 

 

 Dmm is a form that look like 

https://prnt.sc/wc8cg3

 

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 3 of 4
(252 Views)

someone?

0 Kudos
Message 4 of 4
(195 Views)