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.
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.
06-22-2017 09:49 AM
I send two on/off waveforms as an output to port0/line0 and port0/line1 using a PCIe-6363/BNC-2110 to modulate two lasers.
Please see the attached .vi.
Before you run the LabVIEW program one can choose the alternating frequency.
That works pretty fine, you can easily connect an Oscilloscope to the outputs and see the alternating digital waves.
My problem here is, that as soon as I hit the stop button the program stops (obviously) but keeps one of the last modulation outputs on.
I want to alter the program that when I hit the stop-button both outputs switch to 0 (off - basically switching the laser modulation off).
Whatever I do here, e.g. adding some if-condition, adding an additional DAQmx write behind the loop, etc.... gives me 1) an error (like: 200557, 200587) and 2) never sets the modulation to 0 (off).
Maybe someone here has an idea how to solve that?
Solved! Go to Solution.
06-22-2017 12:56 PM
What I'd probably do here is that after exiting the loop due to the stop button, I'd clear the existing task and redefine a new one with the same DO channels. Only this time, don't call DAQmx Timing thus leaving the task in immediate, on-demand mode. All you need is DAQmx Create Channel followed by DAQmx Write (with auto start set True) to drive the outputs OFF.
-Kevin P
06-23-2017 02:50 AM
Thanks for the reply.
Yeah, I know, it sounds like an obvious solution but it doesn't work.
Gives error 200287:
"Possible reason(s):
Attempted to write to an invalid combination of position and offset. The position and offset specified a sample prior to the first sample generated (sample 0). Make sure any negative write offset specified will select a valid sample when combined with the write position.
Property: RelativeTo
Requested Value: Current Write Position
Property: Offset
Requested Value: 0
Task Name: _unnamedTask<4>"
See attached. I tried already several other solutions but I mostly get the 200287 error. And if I manage to somehow avoid any error the program does not set the modulation to OFF.
06-23-2017 03:29 AM
Just want to add:
Only adding the "clear task" or "end task" gives already the error 200287.
06-23-2017 08:54 AM
The -200287 error is happening while you iterate in the loop. Put debug probes on the error cluster and different points and you'll see that error *before* you exit the loop and attempt to do the immediate, on-demand Write.
You should clear the original task outside the loop before making a new one for the on-demand Write.
There are other problems with the way you repeatedly loop & write that are probably responsible for the other errors you've been seeing. Why are you configuring a finite acquisition but then writing to it continuously?
Below is a snippet that ran without error on a very similar board (PCIe-6341). It does a finite generation of the samples you defined in your array then sets the digital outputs low. It won't be the last piece of code you need for your overall app, but it will illustrate a way to avoid the errors that have you hung up.
-Kevin P
06-26-2017 03:15 AM
Thanks again.
However, that is still not what I want to do.
Your solution works for me too: I run the program and after the 10 finite samples the modulation stops and as soon as I hit the stop button the both values switch to OFF. That's nice.
But that only works for a finite amount of samples. If I switch to continuous sample mode I get immediately an error 200292, saying my buffer size is not correct. And I do not know before I run the program how often I need the modulation.
The problem is: I want a continuous digital ON/OFF modulation on two port lines where I can adjust the frequency(before I start the program) as long as until I hit the stop button. And as soon as I hit stop the modulation should switch both values to OFF.
06-26-2017 04:24 PM - edited 06-26-2017 04:38 PM
Make any progress with mods? Below is another snippet that works more like what you're looking for, if I understood correctly. (I switched from using a digital waveform to regular arrays b/c I'm more used to that simpler form).
-Kevin P
06-27-2017 03:37 AM
Thanks for the snippet. That seems to work for me too.
One minor change I had to do: I had to change the digital write to U32. With U8 I've got an error. Anyway: Awesome! Thanks again.
Please find attached a snippet and the program. It might help others.