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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scanning analog channel and reading a counter pin.

Hi,
I am using a hardware triggered scan to get data from my analog input channels using the AI Start, Config and Read VI's. I am simultaneously measuring the period of a square wave pulse on the counter 0 pin of my 6052E board. The VI i am using for this is adapted from the buffered period measurement sample VI. I trigger the scan of the counter pin by using the pulse generated on the SCNCLK pin everytime a scan is made of the analog channels. This way i get the two measurements synchronised. I have two problems with this:
1. I havent been able to find a way to control the number of scans/period measurements that the buffered period measurement VI makes on the counter pin.
2. The read buffer VI in the program outputs a 2-D binary array which comes out empty in my code.
I am not sure what exactly is going wrong. I am attaching the code i am using. Any help would be greatly appreciated.
Thanks,
Shyam.
0 Kudos
Message 1 of 5
(2,309 Views)
Hello Smenon,

I could not open your VI on my computer. Something might be wrong with it. You could post screen-shots of your block diagram with enough information for us to help you.
have you tried the same thing using the internal timebase of the device to source the counter? If so, did you still get an empty array? My guess is that the scanclk signal is not getting to the counter which is consequently not counting.
0 Kudos
Message 2 of 5
(2,296 Views)
Hi Serges,
Thanks so much for the reply. There was a problem in my code, but i think i fixed it and am reattaching the code with this post. Also i have tested out the code and it seems to work fine. That is the scanclock pin is gating the counter so that i make an acquisition. But the binary array is empty and that is what i dont understand. Also i am not sure about how to specify the number of data points that are stored in the buffer. Also one more thing, when the buffered period measurement VI executes, does it store a bunch of period values into the buffer or does it just store a count and then it has to be processed to find the period of the pulse?
Thanks again,
Shyam.
0 Kudos
Message 3 of 5
(2,289 Views)
Hello Smenon,

I looked at your source specification and it looks like you are using a PFI line. You might want to set the "Source Selection" of the source specification to Internal Timebase ans set the correct frequency.
When you set the buffer size, that determines how many periods measurement you will have in your array. The period measurements are then stored in your buffer as your program runs until it reaches the number of samples that you specified in the buffer size or just continue if you have it set to "Continuous".
So the answer to your last question is yes, it stores a bunch of period measurments to the buffer.
0 Kudos
Message 4 of 5
(2,261 Views)
Hi Serges,
Thanks a lot for that reply. It works and i am able to scan the counter and the analog channels.
Regards,
Shyam.
0 Kudos
Message 5 of 5
(2,252 Views)