Using External Clock to write counter value to buffer
Using CTR mode config which input controls at what frequency the counter value gets written to the buffer? How do I set it up so the counter value is written to the buffer at the same time Anologue inputs are written to a buffer, without using the other counter.
Hello,
Could you please explain what type of counter operation are you interested in doing? That would help me in suggesting something.
But if I roughly understand what you are saying here, you can use a same clock to provide as scan clock for analog input and then use that clock for the counter. But depending on what counter operation you are trying to do will decide whether that clock be provided as source or Gate.
You may take a look at examples provided at the following location too :
Measurement Hardware
Sincerely
Sastry V
Applications Engineer
National Instruments
Similar Messages
-
How can I use external clock to implement a delay?
Hi all,
I am testing to use external clock to drive dev/PFI0 (on device 6711) which is used as the clock for the analog ouput. I have thinking two applications by using the external clock but I don't have much idea on the implementation yet.
First of all, I have a sequence of data (array) with each sample being sent at the interval of 1us. I use an external clock (10MHz) driving the PFI0 so it is pretty easy to achieve that goal. I am thinking what happen if I want each sampel being sent at different time. For example, if I have 5 samples, I want the first one sent 1us after the task start and wait 2us to send the 2nd sample, wait 5us to send the 3rd sample and wait 11 us to send the 4th sample, and wait 1us to send the last sample. Is it possible to achieve that based on the external clock?
Second question is about the delay. My code require ciritcal timing and the builtin delay doesn't behave very well because I am running in windows. I can increase the priority of the vi to highest, it helps a bit but still not perfect. I am thinking if it is possible to implement hardward delay based on the external clock. Any idea?Hello dragondriver,
To answer your first question, yes you could send data in that fashion. You would have to programmatically build a pulse train and use that to trigger the sending of data. The answer to the second question is essentially the same. You should be able to programmatically build a pulse train with a delay and use it as trigger to begin whatever operation you have.
Jonathan L.
Applications Engineer
National Instruments -
Using external clock on a 6062E DAQ card
In my application I need to use an external clock (2 MHZ) to sample 10 channels at 40 KHz each. I connected the external clock to PFI_7/Startscan, enabled the ND_IN_CHANNEL_CLOCK_TIMEBASE and ND_IN_SCAN_CLOCK_TIMEBASE using The Select_signal function. If I use only two channels (instead of 10) everything works fine. If I try to increase the number of channels to more than 2 I get a digitized waveform with points missing (one every 2). I tried to decrease the sampling rate to 4 KHz per channel, but the problem persisted. For 2 channels everything is always fine, but for more than 2 I get the same error in the digitization pattern.
The relevant lines of my codes are attached
Thank you for your help
Enrico Gratt
on
Attachments:
Sample_code.pas 3 KBEnrico,
I have a couple of questions. Do you see the same amount of missing data regardless of how many channels (more than 2) you are acquiring? If you use the internal 20 MHz timebase, can you successfully acquire all 10 channels at 40 kHz?
Spencer S. -
Can I acquire waveform at faster sampling rate using external clock?
I am trying to acquire waveform at a sampling rate of 1MHz. My 6036E card is maxed out at 200KHz. Is there a way to achieve a sampling rate of 1MHz using an external sample clock? Your PFI pin can take external clock as an AI sample clock, right?
Hi,
I remember I asked the similar question before in the NI forum, they reply me:
the max sample rate (scan/s/channel) cannot be greater than your board max sample rate, even you use external scan clcok. So the answer is no for your case. -
Want to use external clock for SCTL on myRIO
Hi people,
I'm trying to find a way to get a 2.5 MSPS 16-bit ADC, TI ADS1602, to send data to the myRIO device. Ideally, I want to record bits at 40 MHz in order to get the benefit of the full 2.5 MSPS. I know that I can create an 80 MHz SCTL on the FPGA to create a 40 MHz clock, but when I checked this clock signal on an oscilloscope it was obviously significantly degraded by slew rate limitations, so it looked more like a sine wave than a square wave. I doubt that it would work to use this signal as a clock to drive the ADC, since the ADC's specifications say the allowable jitter is around 100ps.
I can use an external oscillator to drive the ADC, but then I have to find a way to sync that clock with the 40MHz FPGA clock. Is there any kind of PLL structure that would allow me to sync the myRIO FPGA clock to an external clock? Is there a way to make a single cycle timed loop be driven by an external clock? Or if I was able to customize the FPGA personality to accept an SPI signal of up to 40 MHz (ten times the officially supported limit...), would it be ok to use an FPGA loop running at ~160 MHz and tell it to sample the SPI line each loop and proceed from there?
Thanks!
Solved!
Go to Solution.Hi 3.14159... ,
The myRIO does not have the ability to import a clock to use on the FPGA Block Diagram to clock single-cycle timed loops (SCTLs). The new sbRIO-9651 that just released at NI Week (not shipping yet) is the only sbRIO that has the ability to import an external clock into LabVIEW. Several of our FlexRIO products also have this ability.
As you alluded to, you can sample the signal at twice the frequency (or possibly more) to and wait until an edge trigger to execute a certain piece of logic. If you open the Example Finder and navigate to Hardware Input and Output » R Series » FPGA Fundamentals » Triggers and Watchdog » Trigger Detection this gives a simple example of doing that. Again, since you are wanting to sample at 10x the supported frequency, all bets are off but it may be worth a try.
Tannerite
National Instruments -
Use external clock (PFI2) with Traditional DAQ
Can figure out how to specify the external clock line (PFI2) while using Traditional DAQ (7.4.2f3).
Can anyone help? TIA.
George
George Zou
http://webspace.webring.com/people/og/gtoolboxI never used such a configuration but I found an example that will probably be helpful for your problem: it's named SCANsingleBufExtScan and you will find it in samples\daq\ai folder on your hard disk.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Need info on using external tables load/write data
Hi All,
We are planning to load conversion/interface data using external tables feature available in the Oracle database.
Also for outbound interfaces, we are planning to use the same feature to write data in the file system.
If you have done similar exercise in any of your projects, please share sample code units. Also, let me know if there
are any cons/limitations in this approach.
Thanks,
BalajiPlease see old threads for similar discussion -- http://forums.oracle.com/forums/search.jspa?threadID=&q=external+AND+tables&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein -
Using external clock on sbRIO 9606
I'm trying to use LTC2170 ADC with sbRIO 9606. The ADC chip has serial data outputs, a frame start output and a data clock output. How can I use the frame start and data clock outputs of the ADC in LabVIEW to read serial data bits from the ADC? The shifting in of the serial data should start with the frame start output of the ADC and each bit should be shifted in with the data clock output of the ADC.
Attachments:
21721014fb.pdf 1520 KBhttp://zone.ni.com/reference/en-XX/help/371599D-01/lvfpgaconcepts/external_clocks/
-
Single Pulse Width with External Clock
I am trying to setup a 6602 counter for a single (non-buffered) pulse width measurement with an external clock. Under normal testing, the unit under test will provide the pulses, I need to measure the number of pulses during different time periods (1, 60, and 300 seconds). I want to do a pulse width measurement and I'll supply the gate signal pulse to the counter for the specific time needed.
Under normal operation, the unit under test is wired into the counter's source and the pulse is wired into the gate. For testing purposes I am using a BNC-2121. I have the counter's source wired to the Adjustable Square Wave Output and the gate wired to the Trigger output.
Here is my C++ code. I am getting a timeout error on the read and I don't know why. Any help would be appreciated.
//Create Task
DAQmxCreateTask( "task1", taskHandle );
//Create Pulse Width Channel
DAQmxCreateCIPulseWidthChan( taskHandle, // TaskHandle
szCtrName.c_str(), // Counter Name
"", // Channel Name
dMin, // Min Value
dMax, // Max Value
DAQmx_Val_Ticks, // Units
DAQmx_Val_Rising, // Gate Edge
"" ); // Scale Name
//Set the Pulse Width Terminal to the gate signal
DAQmxSetCIPulseWidthTerm( taskHandle, // TaskHandle
"", // Channel
"/CTR2/PFI38" ); // Terminal
//Set the Timebase Src to the counter's source
DAQmxSetCICtrTimebaseSrc( taskHandle, // TaskHandle
"", // Channel
"/CTR2/PFI39" ); // Terminal
//Start Task
DAQmxStartTask( taskHandle );
//***Send pulse to gate counter***
//Read Counter
DAQmxReadCounterU32( taskHandle, // Task Handle
DAQmx_Val_Auto, // Num Samps to Read
10, // Timeout
ulBuffer, // Read Buffer
1000, // Buffer Size
&lSampsRead, // Num Samps Read
NULL ); // ReservedI've setup a pulse width task in NI-MAX using the onboard clock and everything worked fine, so I know the hardware is working.
My unit under test is providing the pulses (from gyros) I need to measure. The pulses indicate the position of the unit so there are X, Y and Z axis gyros. I need to measure these pulses for specific periods of time (1, 60, and 300 seconds). For example during the 1 second measurement, the X and Y gyros should measure zero pulses and the Z axis should measure 515 gyros. During a 300 second measurement the X and Y gyros should measure < 60 and the Z axis should measure 30800.
So the gyro pulses are wired to the counter input and I am using a DIO channel from NI-6508 to provide the gate pulse. The gate signal will be high for either 1, 60, or 300 seconds depending on the test. The gyro pulses are essentially the external clock to the counter. I want to count the gyro pulses during the pulse of the gate (DIO).
To simplify the setup, I connected to BNC-2121 directly to the card. I have the adjustable clock output going to the counter input of ctr0 and the trigger signal going to the gate of ctr0. Once the task has been started and before the read ( I had a breakpoint set in the code), I would press the trigger button on the BNC-2121 and hold for approx. 1 second. I then execute the Read statement, and I always get a timeout. From my experience working with NI, I'm guessing I don't have a channel property set correctly, but its not obvious to me and I can't find an example to do exactly what I'm trying to do.
The CTR2 designation in the code was the object name of the card. I have two 6602 cards in my chassis. I was using ctr0 of the second counter card, so PFI38/39 was correct.
Again, any help would be appreciated. -
External clocking on 6711 card
Hi all,
I just read the manual of the card PCI6711, it supports the external clock. So does it mean we can change the update rate by using different external clock rate?chris88 wrote:
HI dragondriver
They are both correct, the PCI 6711 supports external clocking for the analog output tasks, but for Digital I/O tasks the timing can only be set to software timed, meaning that you cannot use external clock for digital tasks.
The main difference between RTSI and PFI is the physical connection, PFI lines conects through the connector block you are using and the RTSI is connected through a RTSI bus cable used to synchronize several DAQ cards.
You can choose any PFI <0 to 9> and this article show how to select which PFI line is the source of sampling.
Regards
Thanks for the clarification . I only one doubt. Someone told me that 6711 only supports software-based digital pulse input/output but it supports external-clock-driving counter output. So when you said softwarebased digital I/O task, do you mean all digitals output including counter output? Thanks. -
How I can measure frequency of TTL signal without external clock?
Hello,
I want to measure frequency of TTL signal using PXI-6254 or PXI-6713, without using external clock.
Frequency will be up to 100kHz. How I can use internal counter of 20MHz or 80MHz?Hi Yuta K,
You have not stated what software you want to use for this measurement, but in case you're using LabVIEW, please go to the Example Finder (in LabVIEW go to "Help >> Find Examples").
In the Example Finder, you make sure the "Browse" tab is stil selected, and than you go to:
Hardware Input and Output >> DAQmx >> Counter Measurements >> Digital Frequency
Here you will find some good examples of measuring a digital frequency with 1 or 2 onboard counters.
If you need additional information, please let us know!
Best regards,
Peter S -
Internal clock for the counter
Hello everyone,
I am new to NIDAQmx and I am doing angular position measurement. I found provided sample for the counter,
it says that I need to use external sample clock. Could someone provide me sample, that uses external clock that was generated by one task
and another task which uses that generated clock and reads encoder input! I am doing it in C++.
Thank you!!!Hello Khassan,
Here is a link to a Developer Zone article that describes how to implement two tasks that share a clock, The example covers how to implement this with Analog input and output. You can work with it to fit it to your application: http://zone.ni.com/devzone/cda/epd/p/id/2352
Reagards,
-Travis E
National Instruments
Applications Engineer -
Recently we have met with an issue when using external sampling clock on 5641R. When we use 5641R Internal,everything is O.K. Signal we get is stable. But when we use External Clock (The “Clock In “ is connected to the Sine signal generated by Pxie5652,10dBm). Abnormal phenomena: The amplitude is not stable within the acquisition time. Settings: Ni 5640R configure Timebase.vi: CDC Clock Source=SMB External Ni 5640R ADC Configue NCO.vi: Previously Configured Clock Frequency= Sine signal generated by Pxie5652.
Would you please tell me how to solve it?Hello,
I would like to ask you a few questions and suggestions about your setup.
1) You have mentioned that you are using NI 5640R Configure Timebase.VI, Using this the clock that you bring in can only be used to PLL (Reference Clock). In order to use the CLK IN as an external sample clock, you will have to program in LabVIEW FPGA, based on the help documentation below:
2) If you are programming in LabVIEW FPGA, would you mind uploading your code, so I can take a look at it?
3) What is the clock frequency, you are importing?
Best Regards,
Jignesh P
Applications Engineer -
USB 6210 Using counter as an external clock
I was referencing an old post for how to read and write data from a quadrature encoder. I am using a USB 6210 card along with Labview 8.2.1. In the previous post it describes needing to:
"You will have to create an external clock using the other counter on
the board then route the signal either externally or internally"
I do not know what this means and I do not understand what is required to do such (Changes to wires, change the Vi...etc). If someone could please shed some light on this I would really appreciate it.
I am basing my approach on the following NI example:
Meas Angular Position-Buffered-Cont-Ext Clk.viHi rose8,
The example you are referencing requires an external clock to basically take samples of the angular position based on time. For instance, you can rotate your angular encoder all you want, but it will not save which position you are at until a sample clock rising edge is seen. When the sample clock rising edge is seen, then it places that position into a buffer, and continues to wait for the next sample clock rising edge to happen. Every time the rising edge happens, the position of your angular measurement is recorded one point at a time, stored in a 1D or 2D array.
The sample clock cannot be an on board clock that is already created. So now, we look at what sources we can use for our external clock to sample the position of our encoder and save it in our memory buffer. We can use an external source and bring it into the board, or we can create a clock using another counter on the board. Since you are looking to do this, I'll assume you want to create a clock from there.
In software, you specify two counter tasks; one to measure your angular position and one to generate a pulse train. The pulse train you generate will be the sample clock for the buffered angular position measurements you are taking. Now, you can route this externally or internally, based on your application. The easiest way is internally, because it doesn't require any additional wires to accomplish.
To route internally, all you have to do is for your DAQmx Timing VI, specify CtrXInternalOutput from your USB 6210 as the source, where X is the counter you generate your pulse train on. To see this source as an available selection, right click your Resource Name and select I/O Name Filtering from the shortcut menu, and then be sure that Include Advanced Terminals is checked.
In programming, you would want to start your angular position task first, and then start your clock generation from your second counter. They will run in parallel and just be sure to clear both threads at the end of your program. Hopefully this clears up some confusion for you.
Kyle A.
National Instruments
High Speed Digital I/O Product Support Engineer - R&D -
Is it possible to read digital data using an external clock (PCI-6259 M)?
I’m using a NI PCI-6259 M Series card and trying to write my program in VC++6.0 using the functions in the DAQmx driver.
Question1: Not all functions listed in the NI-DAQmx C Reference Help seems to be supported by my NI-card, where can I find information about which of the functions that are supported?
Question2: I want to read data from a device that clock out data on the falling edge of a clock signal. The clock signal and the data signal are routed to two DIO terminals on the NI-card. The question is if it is possible to read data using the clock as a sample clock? See two code examples below that doesn’t work. In both cases 10 samples are read at once, even if the external clock is not present.
Example 1
// Create tasks
Status = DAQmxCreateTask("", &m_ReadTrimTask);
// Set up read task
status = DAQmxCreateDIChan(m_ReadTrimTask, "Dev1/port2/line0", "", DAQmx_Val_ChanPerLine);
status = DAQmxCfgChangeDetectionTiming(m_ReadTrimTask,"Dev1/port2/line6","Dev1/port2/line6",DAQmx_Val_FiniteSamps, 10);
// Read data
int32 sampsPerChanRead, numBytesPerSamp;
status = DAQmxReadDigitalLines(m_ReadTrimTask, 10, 10.0, DAQmx_Val_GroupByChannel, result, 10, &sampsPerChanRead, &numBytesPerSamp ,NULL);
Example 2
// Create tasks
Status = DAQmxCreateTask("", &m_ReadTrimTask);
// Set up read task
status = DAQmxCreateDIChan(m_ReadTrimTask, "Dev1/port2/line0", "", DAQmx_Val_ChanPerLine);
status = DAQmxSetSampTimingType(m_ReadTrimTask, DAQmx_Val_SampClk);
status = DAQmxSetSampClkRate(m_ReadTrimTask, 1000.0);
status = DAQmxSetSampClkActiveEdge(m_ReadTrimTask, DAQmx_Val_Falling);
status = DAQmxSetSampClkSrc(m_ReadTrimTask, " Dev1/port2/line6");
// Read data
int32 sampsPerChanRead, numBytesPerSamp;
status = DAQmxReadDigitalLines(m_ReadTrimTask, 10, 10.0, DAQmx_Val_GroupByChannel, result, 10, &sampsPerChanRead, &numBytesPerSamp ,NULL);Hello Magnus,
Thank you for contacting National Instruments.
"Question1: Not all functions listed in the NI-DAQmx C Reference Help seems to be supported by my NI-card, where can I find information about which of the functions that are supported?"
The best place to look for this information would be the M Series Help Manual. There you can find the features of your PCI-6259 and what operations it supports.
"Question2: I want to read data from a device that clock out data on the falling edge of a clock signal. The clock signal and the data signal are routed to two DIO terminals on the NI-card. The question is if it is possible to read data using the clock as a sample clock? See two code examples below that doesn’t work. In both cases 10 samples are read at once, even if the external clock is not present."
Look at the "ContReadDigChan-ExtClk_Fn.c" example project which ships with the NI-DAQ driver. This is located at: C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Read Values\Cont Read Dig Chan-Ext Clk.
You will have to make some minor modifications to convert this to a finite acquisition, but that is simply a matter of changing the "sampleMode" parameter of the DAQmxCfgSampClkTiming() function. You will also have to route your clock signal to a PFI line and specify which line in your code.
I hope this helps.
Sean C.
Applications Engineering
National Instruments
Maybe you are looking for
-
Installing windows 7 Home premium 64-bit, cannot complete installation
Hello, I am currently trying to install a genuine windows 7 home premium copy on my iMac 27" using boot camp assistant 3.0.1 on a new partition. Partition is correctly made, installation proccess was smooth but when windows restarted to complete inst
-
Hi everyone (and sorry for my english language....). I've this problem: I've a Frame with a JtextField and a button. When I click on this button, I want to show a list of data from a database and then I must choose a value that must go to the JtextFi
-
How do I get my custom linux software to display at 1280x1024 on my iMac under Parallels? and stay that way when I reboot?
-
Having problem opening iMovie 7... with Panasonic PV-GS500.
Hi there, I just bought iMac 4Gb. I am tried to conect my Panasonic Digital comcoder PV-GS500 into iMAC. Camcoder inserts using Firewire and USD port for Mac. When I inserting, it does read my SD card on the camcoder, but iMovie should opeb automatic
-
Ipad wont sync with itunes, go into recover mode or continue updating
I was updating iPad mini yo ios8 last night until it was stuck with apple logo I left it over night but was still stuck with apple logo, every time I take it put of the charge it keeps asking for charge bearing in mind that I left it over night for 1