01-30-2018 08:50 AM
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?
01-30-2018 09:46 AM
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
01-30-2018 09:59 AM
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.
01-30-2018 12:37 PM
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.
01-30-2018 03:49 PM
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?