LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering a counter with another counter internally with 9401 (Labview 2009)

Hi,

 

I am working on National Semiconductor Differential Sensor board(SP102S01RB) and I try to get data from the sensor using 9401 on a cDAQ 9178 chassis using Labview 2009. I try to trigger clock signal by catching chip select high to low transition. To do that, I am generating a counter for chip select and try to to catch falling edge of it with Start Trigger.vi. However, I couldn't succeed much.  I have looked the example "National Semiconductor Differential Sensor Board SP102S01RB Control with LabVIEW' (I don't have FPGA module by the way so, that example is not useful for me as I guess). Also, for synchronization I have read the "Timing and Synchronization Features of NI-DAQmx" in

http://zone.ni.com/devzone/cda/tut/p/id/4322. In that tutorial, /Dev1/Ctr0Out in Figure 4 is used for triggering source but I couldn't see my counter outputs in Labview. Do you know how I can internally trigger one of my counter with an another counter output? Also, in Timing and Synchronization Features of NI-DAQmx, it explains how to synchorinze two analog signals (in Figure 2) assigning both to ao Sample clock. I don't know whether I can do the same for two counter since I am using Implicit option for counter Timing.vi. Can I use Sample Clock option for counters?

 

Thanks for your responses in advance.

 

Regards,

 

Ouz.

p.s. I have attached the Triggering Sources.

 

0 Kudos
Message 1 of 14
(5,231 Views)

Hi Ouz,

 

to use the counter internally you have to include the advanced terminals in your control or constant. To do this go to the shortcut menu and select I/O Name Filtering. There is a checkbox to include these terminals. After that you are able to select the Counter Internal Output.

 

Stefan

Message 2 of 14
(5,215 Views)

Also you can use the DAQ-mx property node & find the counter output under COUNTER OUTPUT->MORE  option.

U can use this node to find current count & state of counter output as well & hence can be used to plot the counter output.Smiley Very Happy

Message 3 of 14
(5,213 Views)

Hi,

 

Thanks for the reply, Stefan and Kekin. I can see the CtrInternalOut right now. 

 

I have an another question. My sensor communicates with SPI (except MOSI line) so  I need two Counter output(one for chip select and one for clock) and 1 digital input(for MISO). I think I need to create channels using by Reserving  one of them using Control Task.vi. My question: How can I create two different counter output channels? I know how to create it when I use both as in the same function like data acquiring (ex: cDAQ1Mod2/port0/line0:3) as in the example "Configuring an NI 9401 for Bidirectional DI/O By Nibble with DAQmx" http://decibel.ni.com/content/docs/DOC-11632 but I need to reach each counter channel separately since one of the Counter output(clock) is triggered by chip select counter output. I think I need to use more than one Create Channel.vi for each counter output. Can I use like that or is there any other way to do that?

 

Thanks,

 

Ouz

NSC Intern

0 Kudos
Message 4 of 14
(5,183 Views)

Hi,

 

I am working the same problem (triggering counter output with another one) but I think I got stucked. I tried to trigger the clock counter using the suggestions of Stefan and Kekin, but I have noticed that CtrInternalOut is the chassis channel(9178). There are only PFIs channels of 9401 (Dev1) in trigger source control. However, there are no PFIs pins on 9401 module. I have attached a pdf showing my MAX Config(after renaming each device in my setup), Trigger sources and 9401 pin diagram. I also attached the LV.vi that I am working on although it is simple. In that vi, I have used Dev1/ctr0 as chip select and Dev1/ctr2  for clock signal for SPI. I have used the Dev1/PFI3 for trigger source since it is the channel corresponding Dev1/ctr0 in my system(I looked that pin and could observe the chip select pulse). Although I can generate chip select pulse as I want, I couldn't do anything about triggering clock signal using that chip select counter output. I am open to any suggestions and help.

 

Thanks,

Ouz

National Semiconductor (Intern)

Download All
0 Kudos
Message 5 of 14
(5,159 Views)

Hi ouz-

 

      If you want to trigger only one counter task but have another counter task that does not use that trigger, it would be best to have two lines of code, like you said (use two DAQmx Create Virtual Channel VIs and go from there).

 

     Additionally, if you are trying to set up a trigger source for your counter output task, but are only seeing PFI lines, you can right-click on the input constant box and select I/O Name Filtering.  Then make sure all options are selected.  You should now be able to choose CTR0InternalOutput as the source of your trigger.

 

     I hope this helps.  Best of luck to you!

Gary P.
Applications Engineer
National Instruments
Message 6 of 14
(5,142 Views)

Hi,

 

Thanks for the reply, GarPar. I think I have solved the triggerring a counter with another with your and Stefan&Kekin's help. Now, I can generate two counter outputs (chip select and clock) as I wanted but I couldn't read the National Semiconductor differential sensor board output at the same time. I have attached the Labview I have written and scope screenshot which shows the chip select(signal 1), clock(sig 2) and output(sig 3). As I told previously, first I generate Chip select signal(1), then at falling edge I generate clock signal(it keeps going on). Finally, I try to read starting the output at falling edge of Chip select counter using clock counter output as the clock source for my read Timing.vi. BTW, Labview  gives an -200560 error after the Read.vi which is an timeout error although I don't need any external connection since I am taking both trigger and clock output internally. And I checked that I connect the output pin to the line 6 of Ni 9401 (many times 🙂 )

 

Error -200560 occurred at an unidentified location

Possible reason(s):

Wait Until Done did not indicate that the task was done within the specified timeout.

Increase the timeout, check the program, and make sure connections for external timing and triggering are in place.

 

Can you see any apparent problems in my labview program? Finally, I am using

 

o ctr2 as Chip Select counter,

 

o ctr0 as Clock 

ctr2InternalOutput as clock trigger

 

o line 6 as digital input

ctr0InternalOutput as read clock

ctr2InternalOuput as read trigger 

 

which are shown in my Labview program. Thanks for your help in advance.

 

Regards,

Ouz

National Semiconductor (Intern)

Download All
0 Kudos
Message 7 of 14
(5,111 Views)

Hi ouz-

 

     I don't see any reason to have the DAQmx Wait Until Done.vi.  Try deleting it and see what happens.  The DAQmx Read.vi already has a default timeout of 10 seconds.

Gary P.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 14
(5,062 Views)

Hi GarPar,

 

Thanks for the reply. You are right that there is no need to use Wait task there. My final question hopefully: I have changed my design. Now, I am using a continuous chip select counter output and a retriggerable finite clock counter output triggered every falling edge of chip select. I want to read the finite sensor output digital data at the starting edge of chip select using clock counter output as clock source. Hence, I am using again retriggerable option in Trigger Property node and change detection for my digital input in Timing.vi(clock counter output is connected to the rising edge). However, I got an -200077 after my trigger property node: 

 

Error -200077 occurred at Property Node DAQmx Trigger (arg 1) in retriggerable_ni9401.vi

Possible reason(s):

Requested value is not a supported value for this property.

Property: Start.Retriggerable
You Have Requested: True
You Can Select: False

Task Name: _unnamedTask<F>

 

Is it an limitation in Labview or am I missing something? If it is a limitation, is there any other way to read finite digital data at starting every falling edge of chip select using clock counter output as clcok source?

 

Regards,

Ouz

0 Kudos
Message 9 of 14
(5,037 Views)

I think we cannot use Retriggerable option in Triggering Property Node with Digital Input in timing Node. Am I right?

0 Kudos
Message 10 of 14
(5,030 Views)