04-07-2009 12:29 PM
I am interested in two things: 1.Linear Position of motor using counter channel ( refering to counter example: AngularPosition-buff-count.C)
2. Digital pulse train output for each pulse of motor output using counter channel ( refering to counter example digpulse.c)
I am using PCI 6602 and not interested in two DAQmx since we have to use them for other purpose in similar system.
If I would run each program individually, it runs fine, but I want them to use synchronously. I followed sample code for synchronization. I am confused with following things:
1. how does GetTerminalDeviceNamewith Prefix help in synchronization?
2. Program 1 above needs external clock, but program 2 doesnt, then how can I achieve one same system clock?
3. What are the key things to do for synchronization?
4. Is it at all possible to synchronize two counters on 6602 board?
Please advise as early as possible
04-08-2009 01:30 PM
Hi sonyProj,
To answer your questions...
1. The purpose of the Get Terminal Name with Device Prefix is to take a task and a terminal and create a properly formatted device + terminal name to use as the source of the trigger for the synchronized task.
2. Program 2 does not require a system clock, but you can include one. Specify the same source as that used for program 1.
3. Check out this Developer Zone Tutorial.
4. If you mean is it possible to synchronize the counter tasks, then the answer is yes.
04-08-2009 02:02 PM
Thank you David for your reply.
In responce to your answer 2.
I understand that I can route system clock through the software, and I did that. But on the line of "start task" for digital pulse channel, it gives me error of "resources reserved"!
Btw, I am using digital pulse with retriggerable property and trigger source as channel A from the motor which is same channel A input to Linear position counter 0. I am using counter 0 for Position and counter 1 for pulse output. But both have same inputs.
Do counters on 6602 have any such specifications which I am not understanding here?
04-09-2009 02:20 PM
Hi sonyProj,
The resources reserved error is an indication that two separate tasks are attempting to access the same resource (eg a counter input channel).
04-12-2009 07:20 PM - edited 04-12-2009 07:23 PM
04-13-2009 12:31 PM
Hi sonyProj,
Please attach a screenshot of the error message as well as the code around your DAQmx start task.
04-13-2009 01:39 PM - edited 04-13-2009 01:41 PM
04-13-2009 02:33 PM
Hello David,
Thank you for your suggestion. I have attached code herewith.
1. startcallback() function creats and starts the Linear position task
2. Timer2 is enabled always. Once the linearposition task is generated, Timercallback() function reads channel and popoulates motor position data in text box .
3. populatemeasurement() function creates new task for digital pulse and supposed to generate 'n' finite pulses for each pulse in the motor output and display as couter1 output.
I was also trying to create pulse task in timercallback(), but it still gives me following error.
"NON-FATAL RUN-TIME ERROR: "commcallback.c", line 1104, col 9, thread id 0x00000D2C: Function DAQmxStartTask: (return value == -50103 [0xffff3c49]). The specified resource is reserved. The operation could not be completed as specified. Task Name: _unnamedTask<1> Status Code: -50103"
Regards,
04-14-2009 06:20 PM
SP,
Do you change the default values on your FP? I noticed that in the example program you probably got the code from:
DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev1/PFI9",DAQmx_Val_Rising));
But in yours:
DAQmxCfgDigEdgeStartTrig(taskHandle,triggerSource,edge) where triggerSource appears to be = /Dev1/PFI35
Did you mean to have this as PFI35? I noticed you had the clock source going to PFI9 is this what you intended to do?
04-14-2009 07:14 PM
Hello Jason,
Thank you for your reply. Yes, PFI9 is system clock. I am using this as a system clock for ctr0
But I am interested in getting ctr1 to be triggered by motor's output, hence I have mentioned as ctr0/PFI35 i.e source input to both ctr0 and ctr1 and not to get triggered by system clock.
I hope it helps you to understand.