Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to share NI-PCI between labview and VB

HI, I wrote two applications (one with labview and one with VB6 using nidaq drivers) to control PCi-6601 card. With the Labview I'm controlling the counter and the acquisition start is triggered by a ttl signal on the DIO port. With the VB6 application I should send on another port DIO this trigger signal. I cannot share the control of the card between this two programs. Is it possible in such a way?
Regards
0 Kudos
Message 1 of 3
(3,434 Views)
Andrea,

Two applications can simultaneously access the same hardware device only if they are not accessing the same functionality. I cannot tell, for certain, from your problem description if this is the restriction you are facing. Could you describe your application in a little more detail? Furthermore, are you receiving an error?

Spencer S.
0 Kudos
Message 2 of 3
(3,434 Views)
Ok, the two program uses the same IO channel but not the same IO port (I write to DIO0 and I read on DIO4).
The labview program seems to get the control of the entire Digital port channel also if I use the singlebit digital write block.
The program below is the one used for Vb control of NI board.

This program set in the 6601 board the digital line 4 as output and force line 4 to high level for same seconds set by Txtduration.


Private t As Long
Option Explicit

Private Sub BtnQuit_Click()
Unload DigitalOut
End Sub

Private Sub Form_Load()

Dim Result

Dim iStatus As Integer
Dim iRetVal As Integer
Dim iDevice As Integer
Dim iPort As Integer
Dim iLine As Integer
Dim iDir As Integer
Dim iStateON As Integer
Dim iStateOFF As Integer
Dim iIgnoreWarning As Integer

iDevice% = 1
iDir% = 1
iStateON% = 1
iLine% = 4



iStatus% = DIG_Line_Config(iDevice%, iPort%, iLine%, iDir%)

If (iStatus% < 0) Then
MsgBox "Whoops ! There is a problem with DIG_Line_Config." + Str(iStatus%), vbOKOnly + vbCritical, "Ciao"
Unload DigitalOut
End If


End Sub
Private Sub Frame2_DragDrop(Source As Control, X As Single, Y As Single)

End Sub

Private Sub Impulse_Click()
Dim Result As Boolean

Dim iStatus As Integer
Dim iRetVal As Integer
Dim iDevice As Integer
Dim iPort As Integer
Dim iLine As Integer
Dim iDir As Integer
Dim iStateON As Integer
Dim iStateOFF As Integer
Dim iIgnoreWarning As Integer

iDevice% = 1
iDir% = 1
iStateON% = 1
iLine% = 4



t = 0
Timer1.Enabled = True

iStatus% = DIG_Out_Line(iDevice%, iPort%, iLine%, 1)
Do

If t >= Val(TxtDuration) Then Exit Do
DoEvents

Loop
Timer1.Enabled = False
t = 0

iStatus% = DIG_Out_Line(iDevice%, iPort%, iLine%, 0)

If (iStatus% < 0) Then
MsgBox "Whoops ! There is a problem with DIG_Line_Config." + Str(iStatus%), vbOKOnly + vbCritical, "Ciao"
Unload DigitalOut
End If

End Sub

Private Sub Timer1_Timer()
t = t + 1
End Sub

If I use the MAX testpanel during the labview program i have this error
-10612 badLineDirError The specified line does not support the specified
transfer direction.

Instead if I use the VB program during the execution of the labview VI i have the following one:
-10602 noWriteError No output data has been written into the transfer buffer.

Do you have any idea to solve the problem?
0 Kudos
Message 3 of 3
(3,434 Views)