08-20-2011 12:21 AM
I'm using .NET 4.0 here, writing in VB.
I'm trying to do continuous acquisition of digital inputs. I looked at the example ContReadDigChan_ExtClk, which is essentially what I want to do. I have to say I can't believe digital and counter inputs cannot use an internal clock as its "sampling" clock, but on to what matters most.
Each digital "sample" contains an array of "states".
Why is there an array of states? How could a digital channel have multiple states at once?
According to the documentation, there are 6 possible states; 3 for input and 3 for output. I'm defining a digital input channel (currently not connected to anything), and I'm getting a "ForceDown" state, which is clearly an output state. It seems to be no mistake since the aforementioned result sets the display to 1 if the state is "ForceUp" and 0 otherwise.
Why are input channels reporting output states?
I'm also disappointed that the sample wouldn't show more functionality than "if forceup then 1 else 0". It couldn't have taken the programmer 10 more minutes to add a bit more indicative functionality to the program.
08-20-2011 01:15 AM - edited 08-20-2011 01:16 AM
For what it's worth, there's a way to not "waste" a counter (on a multifunction board) just to generate a clock to sample digital inputs and counters (such as an encoder, as is in my case).
You can see in the digital/analog synchronization example SyncAI_ReadDigChan that you can set the clock on the digital (and counter) tasks to /<device name>/ai/SampleClock. It's probably worthit to some people to create a dummy analog task just to get access to the internal clocks; I know in my two-counter board this is a blessing (now I can have a second encoder).
08-23-2011 11:04 AM
Good morning,
Thanks for the questions. I have a few questions for you:
1. What hardware are you using?
2. Can you provide a screenshot of what your digital channel is reading as well as your settings?
3. You mentioned some documentation for 6 possible states.
a) Is this the user manual for your device?
b) Can you provide a link?
Thanks,
Lisa
08-23-2011 11:32 AM
It's in the DAQmx Help file under "Digital Logic States" and in the context sensitive help under "DigitalState Enumeration". If nonsensical values are hardware dependent then shouldn't the documentation say so?
08-24-2011 03:08 PM
Good afternoon,
I wanted to clarify that I am not questioning the documentation, it was just for my benefit so we are on the same page. The digital states should not be hardware dependent.
I wanted to know what your hardware information, read configuration, and detected signals looked like to have a better idea of what the issue is. Screenshots provide the most accurate information since there's little chance of me misunderstanding what you mean, or any other miscommunications that can happy.
Regards,
Lisa
08-24-2011 03:39 PM
Let me rephrase the questions:
1. Why does a sample on a given digital input channel contain an array of states?
2. Why is the state of a digital input channel being returned as a state the documentation says is for digital output channels?
08-25-2011 12:42 PM
What is the array you are getting?
Thanks,
Lisa
08-25-2011 01:08 PM
Have you ever looked at the documentation?
08-25-2011 05:47 PM - edited 08-25-2011 05:56 PM
Good afternoon,
I was originally asking for a screenshot of what your channel configurations are because it would help determine what's going on if you are reading unexpected data.
Assuming you are reading out of any of the ports, you'll likely see 8 different signals reading either 1 or 0 on the graphical display. This is because there are 8 digital lines on each digital port. Please let me know if your settings are configured any other way.
DigitalState is an enum in which ForceDown and ForceUp are two of the values. The VB program is checking the sample your card is reading against these states then assigning a value of 0 or 1 for the current sample. This means that when you're reading a high, the program shows 1, and if you're reading a low, the program shows 0. I can look up the default state of your card if you let me know which card you're using. You can also look it up in the manual for the card.
Please let me know if your results are contradictive to anything I've said, and also let me know if you have more questions.
Regards,
Lisa