02-12-2020 07:30 AM
Hey all,
I am developing a State Machine in which I need to run four different tasks
1. Generating a Analog Output Voltage
2. Generating a Digital Output
3. Generating a Continious Digital Train pulse (using DAQmx CO pulse freq) -Problem is with this part
4. Counter Read Operation (using DAQmx CI cnt Edges
First I have Designed seperate VI's for the Tasks and everything is working fine but when I Designed a State Machine the third Task(Generation of Digital Train Pulse) is not Working. I am not able to find the problem
My DAQ device is USB-6351, ANY help would be greatly appreciated.
I am attaching the Project File of my State Machine and separate VI which Includes code of Tasks 3 and 4
Please let me know if you need any sort of additional information from me to understand what I am doing.
02-12-2020 08:21 AM
I'm not using LV2019 and can't open your code. Can you backsave to LV2016 or earlier? Might you be trying to use the same counter for both the generation and counting tasks?
-Kevin P
02-12-2020 09:07 AM
I just checked I am using Different counters
Thanks
02-12-2020 12:26 PM
What exactly do you mean by "not working"? Do you get an error code & message? What are they? If no error message, what other troubleshooting have you tried?
I only looked at the code for Continuous_Train&Counter.vi. I don't really see anything wrong with your CO task. Your CI task ought to work too, though you'd probably be better served to use precise & repeatable hardware timing to sample your counts rather than your current scheme of software timing.
Your CO task is configured to output to PFI12. That pin can serve double duty as digital port 2 line 4. Are you configuring a digital task that uses that same pin?
-Kevin P
02-12-2020 01:56 PM
Sorry for not clearly explaining my problem
The Problem is with the State Machine code (which is named as Main inside the QKD_v4_2015.zip file
Continuous_Train&Counter.vi is the code which I designed for tasks 3 and 4 before designing State Machine...
I uploaded it just for your Reference..
The problem with the Sate Machine is The Digital Train pulse is not Generating, It is not showing any errors.
02-12-2020 02:53 PM
Is the CO task the *only* thing that isn't working? What's been your process for diagnosing and troubleshooting?
I'm asking these very basic questions because the code looks generally ok. I can't vouch for the physical wiring, your other equipment, or signal compatibility though.
The only thing that makes me hesitate at all is that you explicitly reserve the AO task during a state that occurs *before* you set the sample rate, set the buffer size, and write to the buffer. I'm not 100% sure what things you can change while in the "reserved" state, though I'd expect a DAQmx error (or at least a warning) if you were trying to do something that isn't allowed.
I make note of it partly because your CO and DO tasks get triggered by the start of the AO task, and if the AO task errors out rather than starting, I'd expect that neither CO nor DO would operate. But I'd also expect you to see the corresponding DAQmx error, which you aren't seeing.
I can't guess much more unless you can do enough further troubleshooting and description to narrow down the focus for where your problem is. Try things, take notes, report back.
-Kevin P
02-17-2020 08:48 AM
hey Kevin,
CO task is successfully working by disabling the DAQmx Property block Before DAQmx Timing in the Intitialize sub vi.
Thank you so much for your help 🙂
02-17-2020 02:14 PM
I'm a bit surprised that disabling that little chunk of config code fixed things. In the latest screencap, that's the *only* place you define the pulse train's freq and duty cycle.
However the best fix is what would have been a better approach in the first place: define these in the call to "DAQmx Create Virtual Channel" for the CO task.
-Kevin P