Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading in lines with counter ouput on 6602

I'm using a 6602 to operate an external motor using the counter output (frequency). At the same time, I'm using the first 8 DIO lines, <0...7>, to read in information on the motor, specifically it reads from a photo sensor that lets the program know when the motor is at the zero position. I set up the counter to move the motor, which it does correctly (I've checked with an oscilliscope), but then when it reads from the digital lines, imidiately the counter output goes to this sort of noisy function. Is there any way the card can read while it performs the continuous pulse function? Thanks.
0 Kudos
Message 1 of 5
(3,912 Views)
If your counter ouput is generated by Ctr 0 or Ctr 1 then I don't have a guess, but if you're using one of the other counters I may. 
 
I recall needing to be careful to avoid this sort of issue under traditional NI-DAQ.  The DIO port on the 6602 is 32 bits wide, and many of the easy config vi's for digital input will configure the entire 32-bit port as input bits.  Trouble is that most of those DIO bits have pins that are shared by the counters. 
It could be that the counter output task pin is being reconfigured as an input for the DIO task.
 
If you look at the posting here, you'll see that the Digital port should be configured first, then the counter task.  The reason stated is that later configs can/will override earlier ones.
 
If this doesn't help, post your code so we can have a look.
 
-Kevin P.
 
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 5
(3,901 Views)
The total setup is two 6602 boards and an old DIO 24 board.  The DIO board is strictly used for writing out values, in this case 3 8-bit outputs to determine the direction of each motor and whether the motor is enabled.  The 6602's control the motion of the motors, and also read in two 8 bit DIO lines.
I'm using DAQmx to configure the board (no GPCTR), and here's the gist of the program (since it's split into many subvi's):

DAQmx Create Channel (Dig In) with one channel for all lines on lines PFI <0-7>

DAQmx Create Channel (Count Out Freq) 500 Hz 0.5 duty

DAQmx Timing (Implicit) Continuous Samples

DAQmx Start (Dig In)

DAQmx Start (Counter)

DAQmx Read (Dig In) until a zero value is read for particular signal and write disable (DIO 24)

DAQmx Stop Counter

DIO Write (to change direction)

DAQmx Create Channel (Count Out Freq) 200 Hz 0.5 duty

DAQmx Timing (Implicit) Continuous samples

Same action then stop

What I've discovered is that if I configure one board first, then it will read and have the correct pulse generation, but then the other board will not output pulses when input is read.

I'm curious if this is a driver error. Since the following test program works for one board but not the other depending on which is configured first.

0 Kudos
Message 3 of 5
(3,896 Views)
Hello Roth,

This is a long shot, but you might be running into a limit in the number of threads LabVIEW allocates for DAQ tasks.  Take a look at the following Knowledgebases for more information:

KB 3AKFHI2G: How Many Threads Does NI-DAQmx Have?

KB 3S8R8M: How Many Threads Does LabVIEW Allocate?

There is a utility located under C:\Program Files\National Instruments\LabVIEW 8.0\vi.lib\Utility\sysinfo.llb called threadconfig.vi, which allows you to alter the default number of threads LabVIEW allocates.  Let us know if this solves the problem,

Travis G.
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 4 of 5
(3,873 Views)
Hmm, the program seems to be working now, I think the problem was not starting the Digital input before starting the counters.  Thanks for your input!
0 Kudos
Message 5 of 5
(3,870 Views)