From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

USB6501 switching a resistor (using a digital output) with visual studio (vb.net or C#)

I am an absolute beginner and trying to work with USB 6501 and vb.net

 

I want to use a digital output to switch a resistor to an existing one in parallel. Please see the attachment.

 

 

MyVB code:


 

   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

 

        Dim OUT() As Boolean = {True}

 

        myUSB6501Task = New Task

 

        'Create a virtual channel

        myUSB6501Task.DOChannels.CreateChannel("Dev3/port0/line0", "", ChannelLineGrouping.OneChannelForAllLines)

 

        myUSB6501Task.Control(TaskAction.Verify)

        Dim SYS1OUT As New DigitalSingleChannelWriter(myUSB6501Task.Stream)

 

        SYS1OUT.WriteSingleSampleMultiLine(True, OUT)

 

   END Sub


It does not work and I do not know why.

I am grateful for every hint.

 

Thanks

Lois

0 Kudos
Message 1 of 10
(2,151 Views)

I would suggest looking at the example:

C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.0\Digital\Generate Values\WriteDigPort\VB

0 Kudos
Message 2 of 10
(2,078 Views)

thanks for the example, I did it like this. I see no difference.

 

Regarding hardware, could anybody have a look at my attached pic?

 

How to wire this? Does the USB6501 work like a switch (without voltage) or is a voltage output directly?

 

0 Kudos
Message 3 of 10
(2,030 Views)

Did you read the manual for the USB6501?

 

It is a DIO device .

0 Kudos
Message 4 of 10
(2,024 Views)

yes, sure. I just wanna use it as apure DO.

0 Kudos
Message 5 of 10
(1,976 Views)

As I wrote in the earlier post, you should look at the example program NI installs.

0 Kudos
Message 6 of 10
(1,969 Views)

i don't think that it is a software problem than more a hardware issue. What do you say to my pic posted earlier? Is this ok? I am not a hardware guy 😉

0 Kudos
Message 7 of 10
(1,966 Views)

when I measure resistance between P0.0 and GND, do I measure "endless Ohm" in case of not swithcing and "zero Ohm" in case of switching the output of NI device?

0 Kudos
Message 8 of 10
(1,964 Views)

or does a voltage come out (e.g. 5V when switched and 0V when not switched)?

0 Kudos
Message 9 of 10
(1,963 Views)

Can't help you any further.

Find someone at your employer to help.

0 Kudos
Message 10 of 10
(1,961 Views)