ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

VirtualBench

cancel
Showing results for 
Search instead for 
Did you mean: 

niVB_Dig_Initialize

I want to configure the DIO pins 0, 1, 3 & 7 as outputs, 6 as an input. How can this be accomplished using niVB_Dig_Initialize in the C API?

 

The colon syntax doesn't work.

 

I read in the forums[1] that I should be able to pass "vb/dig/0,dig/1,dig/2,dig/7" to niVB_Dig_Initialize. That however fails with an error code indicating that the syntax is wrong. I can in fact pass this syntax to niVB_Dig_Write but not niVB_Dig_Initialize.

 

What am I doing wrong?

 

[1] https://forums.ni.com/t5/VirtualBench/Can-VirtualBench-be-programmed-in-C-Or-anything-other-than-LV/...

0 Kudos
Message 1 of 5
(4,425 Views)

eamonndoe,

 

It looks like you're specifying 'vb/dig/0' for the first but then 'dig/1', etc for the other channels you want to initialize.  I believe you're allowed to use either, but not mix the two. (So I believe you should change to 'dig/0,dig/1,dig/2,dig/7' or 'vb/dig/0,vb/dig/1,vb/dig/2,vb/dig/7').

 

----------------------------------------------------

Daniel Larsen

Digital Hardware Engineer

National Instruments

0 Kudos
Message 2 of 5
(4,411 Views)

Thanks for the response Daniel.

 

Just to be clear, when I say "vb", the default is model-serial, so the actual string that I'm successfully passing to niVB_Dig_Write() is: "VB8012-1234567/dig/0,dig/1,dig/7". This seems to be in line with what I see elsewhere but I can certainly try "VB8012-1234567/dig/0,VB8012-1234567/dig/1,VB8012-1234567/dig/7" if that's what you're suggesting? Doesn't seem right but I'll try it when I get to my desk.

 

Thanks.

0 Kudos
Message 3 of 5
(4,407 Views)

Much to my great surprise, that worked! Many thanks for your timely response.

 

Alas I have already hit the next snag so I predict that I'll be back.

0 Kudos
Message 4 of 5
(4,398 Views)

So here's the other issue I see:

 

Having configured pin 6 as an output, we drive it high. We then need to use that same pin as an input. What we see is that the line is held high, even after we have called niVB_Dig_Close and then niVB_Dig_Initialize so that pin 6 is now configured an input.

 

What do I have to do to reconfigure a pin as an input after it has been used as an output?

 

0 Kudos
Message 5 of 5
(4,390 Views)