Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to take data between two rising edge

I would like to take waveform between two rising/falling edeg, I am using NI5102 VB6.0 with two input one is analog signal and the other is trigger input, start to read input signal when first trigger(rising/falling edge) and stop it by second trigger(rising/falling edge). 
 
I have try to using counter CWcounter1.MeasurementType=... but the measurement tyep is not support my hardware.
 
How to count two trigger to read signal??
 
0 Kudos
Message 1 of 8
(4,469 Views)
How long you would be acquiring data between first pulse and second pulse approximately.
Can you give some information about the application
 
Kalyan
Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 2 of 8
(4,446 Views)

Hi Kalyan,

Around 8.33 ms between two trigger, my setup is trigger continuous and data will be take at first trigger after 8.33ms stop it, wait 8.33ms or 16.99 ms read data again.

Thanks

0 Kudos
Message 3 of 8
(4,436 Views)

Hi,

I looked more into your issue. Couple of questions. What are you using the counter for? Are generating sample clock for digitizer using counter?

I am not sure why you need start trigger your application. But here is a solution I propose.

Use reference trigger as triggering option and then set reference position as 0% (this will set pre-trigger samples to zero).

Then perform multiple record acquisition. The advantage of using multi-record acquisition is that for every trigger, digitizer will acquire a record. Then you can fetch this data.

So, whenever there is a trigger ... you acquire a record which can hold data for 8.3ms.

If you have number of records greater than memory size of the digitizer, then there is an attribute NISCOPE_ATTR_ALLOW_MORE_RECORDS_THAN_MEMORY, setting this to true will allow you to have number of records greater than the memory size of the digitizer.

You can specify number of number of records using NISCOPE_ATTR_HORZ_NUM_RECORDS

Use NISCOPE_ATTR_FETCH_RECORD_NUMBER to acquire current record by linking it to index i of for loop.

Use NISCOPE_ATTR_FETCH_NUM_RECORDS  to acquire only one record when trigger occurs.

So,

1) Set the program for multi-record acquisition

2) Once trigger occurs, acquire current record using NISCOPE_ATTR_FETCH_RECORD_NUMBER and acquire only one record per trigger using NISCOPE_ATTR_FETCH_NUM_RECORDS.

If not, you are not sampling at higher rates and you can also use a DAQ card with counter to acquire data using retriggerable acquisition.

Let me know if this helps you.

Kalyan

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 4 of 8
(4,408 Views)

Hi Kalyan,

Sorry for my confuse.

I would like to take the waveform ampitude at each interval, like the attach file.

First rising edge start and raw data (sine wave ampitude) is saved then it continuous save raw data until second rising edge occure.

Now I am using CWiviScope to capture waveform, seem such function can't do that. Pulse and counter is not support for my device Ni5102.

 Thanks for you reply.

0 Kudos
Message 5 of 8
(4,404 Views)
Hello,
 
CWIVI ActiveX components are for simple application. Your application is more than a simple acquisition.
Use FetchForever example from
C:\Program Files\IVI\Drivers\niScope\Examples\VisualBasic\FetchForever
In this program, replace niScope_ConfigureTriggerSoftware with niScope_ConfigureTriggerDigital. This will enable you to use digital line as source for reference trigger rather than software. Then, set the start trigger source as digital line using NISCOPE_ATTR_ACQ_ARM_SOURCE attribute.
 
Kalyan
Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 6 of 8
(4,367 Views)
Hi Kalyan,
 
I am not sure the example FetchForever support my device NI5102??
When I using niscope_configure_triggerdigital as trigger source, error is come and the value of errorcode at triggersource < 0  so I using niscope_configure_triggerEdge and triggersource using "VAL_EXTERNAL".
 
Then the error is occure during Fetch data:
I try to monitor the error from niScope_Fetch the errorcode is < 0 and below error message is come at the example:
 
"Error BFFA0010 occurred at niScope_Fetch.

Possible Reasons:

Invalid value for parameter or property.

Illegal relativeTo parameter. Only pretrigger and trigger are supported by this device."

The error is from trigger source or from niScope_Fetch??

Thanks

0 Kudos
Message 7 of 8
(4,279 Views)
Actually, the example will not work for the 5102.

One easy way to implement what you need is to use the example found at:
Files\IVI\Drivers\niScope\Examples\VisualBasic\ConfiguredAcquisition

Choose
Trigger Type: Edge
Trigger Channel: 0
Reference Position: 0
Trigger Slope: Rising
Trigger Level: 0V

This will start acquiring data when your signal crosses the 0 mark and will continue for the specified record length.  To get exactly 1 period, configure the record length to be Fs/Fa, where Fs is your sample rate and Fa is the frequency of the signal that you are acquiring.

Hope this helps!  Thanks.

Travis


0 Kudos
Message 8 of 8
(4,260 Views)