02-02-2017 10:34 AM
I am trying to generate an abitrary 2 Ms square wave signal at a 2 Hz frequency but I am getting an extra pulse . i.e. Instead of two pulses a second I am getting 3. I do not have any time delays in the programme so does anyone know why this could be?
02-02-2017 10:49 AM
Please post a snippet of a VI how you are generating it and what hardware. And a few notes how you are measuring it. Delays in program will lead to reduced rate (more than 500 ms between pulses), not increased. So the problem is with configuration.
02-02-2017 11:18 AM
I am generating the signal using a USB-6001 (14bit , 5 kS/s) in a continous generation mode at a rate of 1 K Hz.
I am reading the signal at a rate of 2 K (Hz) .
02-02-2017 02:01 PM
Would it be so difficult to attach your vi, instead of a picture of your VI? It would help us to help you.
Bob Schor
02-03-2017 04:07 AM
Hi Bob,
I have attached the actual vi. I am measuring a lot of other things in this programme . But the only concern is the time delay that I am getting. Secondly, the recorded data seems to be off by a 5 . i.e When I define a signal to repaet every 0.1s (10 Hz) , a 2 Hz signal is recorded in the written file.
02-03-2017
04:46 AM
- last edited on
11-27-2024
10:58 AM
by
Content Cleaner
Hi Nina,
But the only concern is the time delay that I am getting.
Which delay do you get?
Your DAQAssistent is set to read 2000 samples at 2kS/s samplerate, so it will take a second to read all values. Then you do some excessive handling of DDT wires to finally write the results to a file…
The other reading DAQAssistent is set to read 100 samples at 100S/s samplerate, it also should take a second to execute. (Does your hardware even support this samplerate?)
Secondly, the recorded data seems to be off by a 5 . i.e When I define a signal to repaet every 0.1s (10 Hz) , a 2 Hz signal is recorded in the written file.
Where do you define this 10Hz signal?
Your DAQAssistent in the "smaller" loop is set to output 501 samples at 1kS/s sample rate, so it takes 501ms to output the data…
General advice:
- When you want your DAQmx functions to execute the way you want them you should not use the DAQAssistent. Use plain functions!
- When you want a consistent timing in your application you should consider some programming schemes like producer-consumer oder QMH…
- Both FP and BD of your VI are too big!
02-06-2017
03:28 AM
- last edited on
11-27-2024
10:58 AM
by
Content Cleaner
Hi GerdW,
I understand that my FP and BD is extremmely large, however with the time constraints, my main focus is that the programme works rather than teh efficiency of the code.
Your DAQAssistent is set to read 2000 samples at 2kS/s samplerate, so it will take a second to read all values. Then you do some excessive handling of DDT wires to finally write the results to a file…
The other reading DAQAssistent is set to read 100 samples at 100S/s samplerate, it also should take a second to execute. (Does your hardware even support this samplerate?) Yes my hardware can support this sample rate.
Where do you define this 10Hz signal?
The first delay is in the signal generation. The signal is defined in the "Simulate Arbitrary Signal 4" in the smaller while loop. The square signal is manual defined and set to different frequecnies . So taking 10 Hz as an example, the delay is a factor of 5. The signal is written (in the larger loop) as a 2 Hz signal instead. The square signal is set to hold for 2 ms however, the recorded data shows a signal holiding for 10 ms (hence this factor of 5 ) .
Is there a way to get ride of this ?
Your DAQAssistent in the "smaller" loop is set to output 501 samples at 1kS/s sample rate, so it takes 501ms to output the data…
I changed the DAQ Assistent in the samller loop to output 1000 samples at 1 kS/s but this doesnt resolve the delay.
Can you elobrate on what you mean by : When you want your DAQmx functions to execute the way you want them you should not use the DAQAssistent. Use plain functions.
02-06-2017 04:13 AM - edited 02-06-2017 04:15 AM
Hi Nina,
my main focus is that the programme works rather than teh efficiency of the code.
Having a BD/FP where you don't get lost immediatly greatly helps to prevent errors and make your program "work"…
Don't think about "efficiency of code", but think about "efficiency of programming work"!
The square signal is manual defined and set to different frequecnies … I changed the DAQ Assistent in the samller loop to output 1000 samples at 1 kS/s but this doesnt resolve the delay.
So you generate a waveform with variable samplerates, but you still use an output with a fixed samplerate (1kS/s). And you still wonder why your output doesn't match with expected/simulated signal? Really?
Can you elobrate on what you mean by
Yes, I can: Get rid of ExpressVIs!