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: 

Writing a sample beyond the final sample generated

Hi everyone,

I aimed to generated sinusoidal waves with NI 9264 and change the place where to give the sinusoidal wave with a case structure. But when I run the VI a got the following error:

 

Error: “Attempted to write a sample beyond the final sample generated. The generation has stopped, therefore the sample specified by the combination of position and offset will never be available.

Specify a position and offset which selects a sample up to, but not beyond, the final sample generated. The final sample generated can be determined by querying the total samples generated after a generation has stopped.”

 

I'm trying to take continuos samples and stop taking samples when I click the stop button of the loop. But when the case changes, it gives the error on 'earese the previous task' function. That am I doing wrong? I'm trying to fix it for almost a week.

 

In addition to that when I check the wave with the oscilloscope, I saw that I couldn't achieve to generate a continuos wave but an interrupted one. I am adding an image of the oscilloscope screen. When I increase the sample rate on NI MAX it gets closer to a sin wave but I want a frequency around 100 Hz not 10k Hz. If someone can also help with this problem, I would be glad.

 

Download All
0 Kudos
Message 1 of 2
(582 Views)

You seem to be using a global task and I'd guess that you set it up for Finite sampling.

 

Take a closer look at the shipping examples for continuous AO voltage.  Notice that data is written to the task before calling DAQmx Start to start it explicitly.   The example lets the task run in regeneration mode -- whatever was written originally keeps regenerating.  If you define your sine wave over an integer # of cycles, that might work for you too.

 

Note that you *can* write new data to the task inside the loop if you choose, but doing so exactly right takes more care than simply relying on regeneration -- assuming your app wants a repeating, unchanging sine wave.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 2
(539 Views)