Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger PXI 6534

Hi,
 
I have a problem to trigger PXI 6534 to do digital output. The trigger is come from Counter PXI 6602.  the key part is list as follows:
 
err = DAQmxCreateTask("",&digtask);
 err = DAQmxCreateTask("",&counter1);
  err = DAQmxCreateDOChan(digtask,"dev1/port2_16","",DAQmx_Val_ChanForAllLines);
  err = DAQmxCfgSampClkTiming(digtask,NULL,1000000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,2);
  err = DAQmxWriteDigitalU16 (digtask, 2,0,10, DAQmx_Val_GroupByChannel,data,&Written, NULL);
  err = DAQmxGetErrorString (err,errbuff, 2048);
   err = DAQmxCfgDigEdgeStartTrig (digtask,"/dev1/PXI_Trig1", DAQmx_Val_Rising );
  err = DAQmxStartTask(digtask);
  err = DAQmxGetErrorString (err,errbuff, 2048);
   
  err = DAQmxCreateCOPulseChanTime(counter1,"dev2/ctr1","",
          DAQmx_Val_Seconds,DAQmx_Val_Low,0.001,0.005,0.01);
  err = DAQmxGetErrorString (err, errbuff, 400);
  err = DAQmxExportSignal(counter1, DAQmx_Val_CounterOutputEvent, "/DigitalIO/PXI_Trig1");
 // err = DAQmxConnectTerms ("/dev2/Ctr1InternalOutput", "/dev2/RTSI1",DAQmx_Val_DoNotInvertPolarity );
 // err = DAQmxConnectTerms ("/dev1/RTSI1", "/dev1/PFI3",DAQmx_Val_DoNotInvertPolarity );
  err = DAQmxGetErrorString (err,errbuff, 2048);
  err = DAQmxStartTask (counter1);
 
 
is there any problem? compile pass, run good, but the PXI 6534 completely ignore the trigger from RTSI bus(PXI_Trig), I am really confused.
Any help is appreciated.
 
TF
0 Kudos
Message 1 of 4
(3,858 Views)

Hi TF,

When I look at your code, it looks like you are configuring the start trigger to have the source "/dev1/PXI_Trig1" before you use DAQmxExportSignal.  It is important to export the signal from the counter (DAQmx_Val_CounterOutput Event) onto the PXI_Trig1 line before you use it as a trigger.  Also I am not sure about this:

DAQmxExportSignal(counter1, DAQmx_Val_CounterOutputEvent, "/DigitalIO/PXI_Trig1");

Did you rename your device DigitalIO because that is not consistent with dev1 where you are configuring the digital trigger before.  Hopefully this will help!

 

Regards,
Vanessa L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,840 Views)
Hi Vanessa,
 
Thank you. I am sorry for forgetting rewtitting the device name. in the code PXI 6534 is dev1, PXI 6602 is dev2( in my real code source there are different names). The trigger is exported to RTSI0 before 6534 use it because the counter task is turn on first.
 
My question is why the PXI 6534 digital output channel completely ignore triggers from RTSI, another interesting is the manual (PXI 653x ) shows the trigger line has to be the pin 8(PFI7, STARTTRIG), I hard link  a pulse to PFI7, the digital channel still completely ignore the trigger. Is there any device setting I missed? or The DAQmx C API does not support digital output triggering? However, the document tells clearly it support PXI6534. Is there a clear answer? if it is yes, how to configure the digital output channel? I use same procedure in working PXI 6723, PXI5412, and another board, all works, why it does not work on PXI 6534.
 
Thanks. Any advices is appreciated.
 
TF
0 Kudos
Message 3 of 4
(3,834 Views)


@export signal wrote:
Hi,
 
I have a problem to trigger PXI 6534 to do digital output. The trigger is come from Counter PXI 6602.  the key part is list as follows:
 
err = DAQmxCreateTask("",&digtask);
 err = DAQmxCreateTask("",&counter1);
  err = DAQmxCreateDOChan(digtask,"dev1/port2_16","",DAQmx_Val_ChanForAllLines);
  err = DAQmxCfgSampClkTiming(digtask,NULL,1000000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,2);
  err = DAQmxWriteDigitalU16 (digtask, 2,0,10, DAQmx_Val_GroupByChannel,data,&Written, NULL);
  err = DAQmxGetErrorString (err,errbuff, 2048);
   err = DAQmxCfgDigEdgeStartTrig (digtask,"/dev1/PXI_Trig1", DAQmx_Val_Rising );
  err = DAQmxStartTask(digtask);
  err = DAQmxGetErrorString (err,errbuff, 2048);
   
  err = DAQmxCreateCOPulseChanTime(counter1,"dev2/ctr1","",
          DAQmx_Val_Seconds,DAQmx_Val_Low,0.001,0.005,0.01);
  err = DAQmxGetErrorString (err, errbuff, 400);
  err = DAQmxExportSignal(counter1, DAQmx_Val_CounterOutputEvent, "/DigitalIO/PXI_Trig1");
 // err = DAQmxConnectTerms ("/dev2/Ctr1InternalOutput", "/dev2/RTSI1",DAQmx_Val_DoNotInvertPolarity );
 // err = DAQmxConnectTerms ("/dev1/RTSI1", "/dev1/PFI3",DAQmx_Val_DoNotInvertPolarity );
  err = DAQmxGetErrorString (err,errbuff, 2048);
  err = DAQmxStartTask (counter1);
 
 
is there any problem? compile pass, run good, but the PXI 6534 completely ignore the trigger from RTSI bus(PXI_Trig), I am really confused.
Any help is appreciated.
 
TF


Hi,

You might have a task ordering problem.  Try this out:

err = DAQmxCreateTask("",&digtask);
 err = DAQmxCreateTask("",&counter1);
  err = DAQmxCreateDOChan(digtask,"dev1/port2_16","",DAQmx_Val_ChanForAllLines);
  err = DAQmxCfgSampClkTiming(digtask,NULL,1000000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,2);
  err = DAQmxWriteDigitalU16 (digtask, 2,0,10, DAQmx_Val_GroupByChannel,data,&Written, NULL);
  err = DAQmxGetErrorString (err,errbuff, 2048);
   err = DAQmxCfgDigEdgeStartTrig (digtask,"/dev1/PXI_Trig1", DAQmx_Val_Rising );
 
  err = DAQmxCreateCOPulseChanTime(counter1,"dev2/ctr1","",
          DAQmx_Val_Seconds,DAQmx_Val_Low,0.001,0.005,0.01);
  err = DAQmxGetErrorString (err, errbuff, 400);
  err = DAQmxExportSignal(counter1, DAQmx_Val_CounterOutputEvent, "/DigitalIO/PXI_Trig1");
 // err = DAQmxConnectTerms ("/dev2/Ctr1InternalOutput", "/dev2/RTSI1",DAQmx_Val_DoNotInvertPolarity );
 // err = DAQmxConnectTerms ("/dev1/RTSI1", "/dev1/PFI3",DAQmx_Val_DoNotInvertPolarity );

  err = DAQmxTaskControl(counter1, DAQmx_Val_Task_Commit);
  err = DAQmxStartTask(digtask);
  err = DAQmxStartTask (counter1); 


What I did was to commit the counter task before starting the digital task.  This forces the exported counter event to go low.  This makes sure that the digital device is not sensitive to the start trigger.  Next, the digital task is started.  Since the counter isn't running, the digital device won't start.  Lastly, the counter task is started.

Other things to try (but use my sequence of task commits and task starts.  It'll predictably work from run to run: especially if you change the 6534 and 6602 to do something else)

1. If this doesn't work, try a different PXI_Trig line (PXI_Trig0 might be broken in the Chassis, 6534, or 6602). 

2. If you are in an 18-slot chassis, try putting the 6534 and the 6602 in the same segment. 

3. Assuming you've configured MAX to know about your PXI chassis and controller, you can try configuring the digital task to pull the 6602's counter output with:

DAQmxCfgDigEdgeStartTrig (digtask,"/dev2/Ctr1InternalOutput", DAQmx_Val_Rising );

Good Luck,

Jeff
0 Kudos
Message 4 of 4
(3,816 Views)