Accessing full 32 DIO lines on PCI-6602 in C++

Hi,
I have seen a couple of posts on this topic, but none seem to contain an answer to the question, and the documentation in the Register Level Programming Manual appears to be incomplete.
We need to access the full 32 DIO lines on the PCI-6602 card; however, only the first 8 lines (those driven by the STC) are documented.  Is there any example code or further info that would allow us to use this functionality? 
We are programming in C++, using the Driver Development Kit, in QNX.
Any help would be much appreciated.
Cheers,
Monte

The 32-bit digital port registers were not included in the chipobject (by mistake).  The digital intput register is at offset 0x414 and the digital output register is at 0x510.  To access them you can use the tAddressSpace object directly:
u32 value;
value = Bar1.readU32(0x414); // read digital 32-bit port
Bar1.writeU32 (0x510, value); // write digital 32-bit port
For configuration, use the IO_Pin_x_x_Configuration_Register registers to configure the line for input or output. 
For example,  to configure line 0 and 1 for input
tio->IO_Pin_0_1_Configuration_Register.setIO_Filter_0_Select (0); // no filter
tio->IO_Pin_0_1_Configuration_Register.setIO_Pin_0_Select (0); //input
tio->IO_Pin_0_1_Configuration_Register.setIO_Filter_1_Select (0); // no filter
tio->IO_Pin_0_1_Configuration_Register.setIO_Pin_1_Select (0); //input
tio->IO_Pin_0_1_Configuration_Register.flush (0);
or lines 29, 30 and 31 for output:
tio->IO_Pin_28_29_Configuration_Register.setIO_Filter_29_Select (0); //no filter
tio->IO_Pin_28_29_Configuration_Register.setIO_Pin_29_Select (2); // digital output
tio->IO_Pin_28_29_Configuration_Register.flush (0);
tio->IO_Pin_30_31_Configuration_Register.setIO_Filter_30_Select (0); //no filter
tio->IO_Pin_30_31_Configuration_Register.setIO_Pin_30_Select (2); // digital output
tio->IO_Pin_30_31_Configuration_Register.setIO_Filter_31_Select (0); //no filter
tio->IO_Pin_30_31_Configuration_Register.setIO_Pin_31_Select (2); // digital output
tio->IO_Pin_30_31_Configuration_Register.flush (0);
valid values for the select field are:
0 - input
1 - counter output
2 - digital output
I hope this helps.

Similar Messages

  • PCI 6602:How can I use the digital lines of the board and in the same time to generate pulse train using a counter?

    Hello!
    My problem appeared when I tried to update my code from Traditional NI-DAQ Legacy to DAQmx.
    I am using 2 counters (counter 5 and counter 7)  from PCI-6602, to generate pulse train, and also the Digital I/O lines of the port 0 (the lines form 0 to 7). What I do in my application is that I am starting to generate the pulse train on the output of the 2 counters, and after that I am playing with the state of the digital lines.
    In traditional there was no problem using the counters and the digital lines in the same time, everything was going perfectly, but in DAQmx this is not possible.
    What happens: I start to generate pulse train on the output of the counters,  no errors encountered, but when I try to modify the state of one line of the digital port the generation of the pulse train is stopped. This is happening when I start the task associated to the digital port.
    My question is: it is possible to create a channel on the digital lines without altered the channels created for the counters?
    Another thing what I manage to see using the  "Measurement & Automation Explorer" and Test panels for PCI-6602, basically is the same thing, I generate pulse train on the output of the counter 7 and try to start a task on the digital line, but I get one error :
    "Error -200022 occurred at Test Panel
    Possible Reason(s):
    Measurements: Resource requested by this task has already been reserved by a different task.
    Device: Dev4
    Terminal: PFI8"
    Instead if I use the counter 0 or counter 1 to generate pulse train I don't encounter the same problem.
    Which resources are used by the counters 2 to 7 from the PCI-6602 board and the counters 0 and 1 do not use?
    Thank in advance for any replies!
    Ciprian
    Solved!
    Go to Solution.

    Hello Jordan, thank you for your reply.
    I am sorry but I can not see or run your example, I don't use LabView, I use Visual C++ for developing.
    Here is the code for generating the pulse train:
    GeneratePulseTrain(unsigned long ulCount1, unsigned long ulCount2)
        short nStatus = 0;
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        nStatus = DAQmxCreateCOPulseChanTicks (m_taskHandle, "Dev4/count5", "", NULL, DAQmx_Val_Low, 0.0, ulCount1,ulCount2);
        if( bTriggerMode == true) // if hardware trigger is enabled
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_ArmStartTrig_Type, DAQmx_Val_DigEdge);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Edge, DAQmx_Val_Rising);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Src,"Dev4/PFI17" );
        //set the internal timebase
        nStatus = DAQmxSetCOCtrTimebaseSrc(m_taskHandle,"Dev4/count5","20MHzTimeBase" );
        nStatus = DAQmxStartTask(m_taskHandle);
        return nStatus;
    And the code where I try to set the digital line:
    SetChannelState(short nState)
        short nStatus = 0;
        uInt8 wrtBuf0[1]={0};
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        // Configure line as output 
        nStatus = DAQmxCreateDOChan (m_taskHandle, "Dev4/port0/line0", "", DAQmx_Val_ChanPerLine);
        nStatus = DAQmxStartTask(m_taskHandle);
        wrtBuf0[0] = nState;
        nStatus =DAQmxWriteDigitalLines (m_taskHandle, 1, 0, 0, DAQmx_Val_GroupByScanNumber , wrtBuf0, NULL, NULL);
        nStatus = DAQmxWaitUntilTaskDone(m_taskHandle,10);
        nStatus = DAQmxStopTask(m_taskHandle);
        nStatus = DAQmxClearTask(m_taskHandle);
        m_taskHandle = 0;
        return nStatus;      

  • Connect NI PCI-6602 with NI PCI-6503

    Hello,
    I want to connect a NI PCI-6602 Counter/Timer with the NI PCI-6503 DIO-Card. The problem is the varying number of pins. (6602->68 pins; 6503 -> 50 pins). Is there a possibility to connect both? Maybe a complete adapter?
    regards Thomas

    Thomas,
    You are correct both cards have male connectors. You could still use the 68M-50F connector if you use a 68-68 cable. Or if you had a 68F-50M then you would need a 50 pin cable. I have found another option, the R6850-D1 Cable(part number 777419-01) . This is a digital cable that was made to use our 68 pin digital devices with 50 pin breakout boxes. It ties the ground lines together and you also loose access to PFI 37,the up/down pin for counter 0, and you loose the +5V line. I think you may want to check the pin mappings to make sure that you really want to connect these 2 boards directly together. When using a 50 pin conversion with the 6602 you will get the following pin mapping:
    Pin Number (1-50) 6602 Signal Name
    1 PFI_25
    2 PFI_28
    3 PFI_27
    4 PFI_24
    5 PFI_30
    6 PFI_31
    7 PFI_26
    8 PFI_29
    9 PFI_21
    10 PFI_23
    11 PFI_19
    12 PFI_17
    13 PFI_18
    14 PFI_16
    15 PFI_22
    16 PFI_20
    17 GND
    18 PFI_34
    19 GND
    20 PFI_35
    21 GND
    22 PFI_33
    23 GND
    24 PFI_32
    25 GND
    26 GND
    27 PFI_38
    28 GND
    29 Reserved
    30 GND
    31 PFI_36
    32 GND
    33 PFI_39
    34 GND
    35 PFI_4
    36 PFI_6
    37 PFI_0
    38 PFI_2
    39 PFI_1
    40 PFI_3
    41 PFI_7
    42 PFI_5
    43 PFI_13
    44 PFI_10
    45 PFI_15
    46 PFI_14
    47 PFI_8
    48 PFI_11
    49 PFI_12
    50 PFI_9
    You will loose half of the cards functionality since half the pins (even numbered pins) will be connected to ground on the 6503. It would be easy for you to short lines to ground this way. It would probably be better if you get a breakout box for each card (SCB-50 and SCB-68) and then connect only the lines you want to share between the cards. So in answer to your question, yes you CAN connect then directly together, but do so with caution, and I do not feel this direct connection is the best solution for y
    ou.
    Hope this helps.
    Kevin R

  • Conceptual problem in using a PCI-6602?

    Hi, All You Wild and Crazy NI/LabVIEW Types --
    I have a problem that's been close to sending me off the deep end for more than a month now, and I think that I'm so enmeshed in it that I can't see the forest for the trees anymore. I'd like to apologize in advance for the length of this post, but there are some details that might or might not be important, and I'd rather make the mistake of giving you too much information than not enough.
    We do impact-cratering experiments, using a gun to launch (usually) spherical projectiles at a variety of targets. One of our big efforts is to measure the velocities at which material is ejected from growing craters. We do that with a line-generating laser, oriented so the "sheet" of laser light is perpendicular to the target's surface and through the impact point; we strobe the laser at a programmed rate (with our PCI-6259 board) and take a time exposure of the scene with a Nikon D100 DSLR. When target material -- usually grains of sand -- is ejected, the laser illuminates a "slice" through the curtain of ejecta, illuminating a small portion of the fragments numerous times in their trajectories. Since we know the scale of the photograph and its orientation relative to the laser's illumination, and we also know the rate at which the laser is flashing, we can easily calculate the velocities of the illuminated particles. I'm attaching a picture (file 4044, cropped.jpg) of an example taken with an older camera to give you an idea. In the picture, the laser's illuminating the scene from the right of the frame and the projectile flew into the picture from the top of the frame, traveling along the left-hand edge. The brightest portion is the flash from the impact, and the rest of the parabolic trajectories are the grains of sand in flight. The target bucket, full of coarse sand, is the elliptical looking cylinder at the bottom of the picture. It's roughly 28 cm in outside diameter, if you'd like a scale.
    As you might imagine, with our projectiles moving anywhere between 0.7 and 3 km/s, sequencing everything is pretty important. We're using (or trying to use) LabVIEW to do all of the sequencing, instrument control, and data storage. Things are going pretty well so far, except for what I'll describe in more detail below. A couple more things, though, first. It's important that we measure the projectile's speed in each shot, as that controls impact energy and momentum, which are critical to know in a given experiment. We do that with simple laser-photodetector pairs (which we normally call "velocity stations") arranged along the projectile's trajectory. As the projectile passes between a laser and its detector, its shadow is detected and a TTL pulse is sent to our PCI-6602 board. Depending on the experiment, we use three or four such laser-dector pairs. They use counters 0, 1, 2, and 3. We know the distances between the laser stations and, once we get the times between detections, it's s simple matter to calculate the projectile's velocity.
    We also use LabVIEW to fire the gun, and we do that because opening the camera's shutter has to be synchronized with the firing pulse, which currently is sent via P1.1 on the 6259. Here's the problem: when we test the laser-detector arrays in a "standalone" mode (that is, without any other tasks or operations being done with LabVIEW), they work infallibly. It's when we try to use LabVIEW to fire the gun that we get either very erratic results from the velocity stations/6602 or no results at all.
    I've tried a range of things, from starting the two-edge measurement task before the firing signal is sent, to trying to force things with a timed sequence, to doing things with brute force via a seuqence structure. When I try to start the two-edge measurement task first, though, the firing signal isn't sent until the counters time out. This of course, wrecks the experiment, because all of the timing is then messed up. The VI that I've attached (Version 1.vi) is a HIGHLY simplified version of the initial attempt I made at doing this, with all sorts of background stuff removed just so I can cut to the chase. (Only one two-edge measurement task is shown, for instance.)  I think that the VI is pretty self-explanatory (and embarrassingly primitive), so it probably doesn't need much in the way of explanation. Counter 7 and PFI 0 on the 6602 are used to accept the signal from the firing button and trigger the event structure, which contains the two-edge separation and gun-firing tasks. (In reality, I use a separate VI to have three to four concurrent two-edge separation tasks running concurrently, one for each velocity station.) I start the two-edge separation tasks first so the detectors and counters are ready for the projectile. It's not necessary here, but I kept the 500 ms wait frame in this example because that's why the sequence structure exists -- to allow the shutter of the Nikon to open completely before the gun fires. After those 500 ms, the firing signal is sent to the circuit that actually fires the gun.
    What happens in this configuration is that the second frame of the sequence structure doesn't execute until the 5-s timeout transpires in the two-edge separation task. I've also tried this using a line on the 6602 to fire the gun instead of P0.1 on the 6259, but that ends up with the same result. (Both counters are used on the 6259 to strobe the main illumination laser, so they're unavailable, if you're wondering. In any case, we need four counters for the four velocity stations.)
    FINALLY, my question: What am I doing wrong, here? If I put the two-edge separation tasks in the same frame of the sequence structure as the firing task, the gun fires when it's supposed to, but we get no velocity measurements. I've also tried to force the timing with another version of a sequence structure; I'm attaching another very simplified version below as Fire and speed example.vi.
    After you recover from your violent fits of laughter, I'd really appreciate hearing what you might recommend. (And no, surrender isn't an option.)
    Thanks for taking all of your valuable time to read this huge post -- I really appreciate it!
    Mark
    Attachments:
    4044, cropped.jpg ‏197 KB
    Version 1.vi ‏35 KB
    Fire and speed example.vi ‏30 KB

    I agree with all 3 of Kevin's points.  His first suggestion will probably fix your problem (see below).  The 2nd and 3rd suggestion would improve efficiency and responsiveness, but #2 might not be possible since independently triggering four outputs in hardware would require the use of 4 counters (on the 6602 anyway) which might be busy doing other tasks in your application (although if you don't need the stations to trigger independently then you could implement this with a single counter).
    I think I have an explanation of the problematic behavior you are seeing based off of the following bits of information from your post:
    1.  Running the small example code by itself works flawlessly, but adding other simultaneous functionality fails.  You mentioned you are doing this on 4 stations, so I'm assuming 4 counter input tasks running in parallel.
    2.  The behavior you are seeing is that the 2nd sequence does not execute until after the read times out (note that the sequence is supposed to be executing in parallel with the read).
    It sounds like the problem is coming from a combination of calling into DAQmx Read before data is available (this consumes one of the threads that LabVIEW has allocated to your application until DAQmx Read finishes executing) along with the fact that LabVIEW allocates 4 threads per execution system per priority by default.  Since all of your threads (from what I can tell) are executing on the same priority, the 4 reads you are calling will block anything else from executing until they have completed.  By then it's too late and the firing of your gun happens after the counter task has already timed out.
    You *may* increase the number of threads allocated to your application by using a VI that is included with LabVIEW (vi.lib\Utility\sysinfo.llb\threadconfig.vi) and this would also probably remedy the behavior you are seeing.  However, rather than throwing more threads at this application I think the better solution would be to change the sequencing of your tasks like Kevin suggested ("create and start the 2-edge task before entering the sequence structure, and defer the 2-edge *reading* until *after* firing the DO")--in doing this you would now expect to see data immediately upon calling DAQmx Read and you avoid the situation where Read is blocking indefinitely and consuming an application thread.  You could take this a step further by checking the Available Samples per Channel property (or using the DAQmx EveryNSamplesAcquiredIntoBuffer event) to ensure that data is actually available before calling Read.
    Best Regards,
    John Passiak

  • Connect PCI-6602 to relay

    Hello,
    I am absolutely new to Labview and the PCI-6602 card. What I would like to do is to use Labview to control a relay through the PCI-6602 DAQ card. I am of course using the CB-68LP connector block to make the hardware connection.
    Since I want to control a relay with a 0-5V TTL signal to open and close, I guess I am supposed to send a digital signal to the DIO lines on the PCI-6602. However, could someone explain to me if there is an example VI that can do this?
    Moreover, what are the pin numbers on the CB-68LP connector block where the actual digital signal will come from? This is not clear from the manual.  I would first like to measure it on a voltmeter before connecting an actual relay to it.
    Eventually, there will be three relays connected and each of them will in turn be controlling a solenoid valve. In some cases, two of the relays should open at the same time while the third one is closed. At other times, only one relay will open.
    I appreciate your feedback in advance.
    thank you.

    Hi,
    I have attached a modified version of the example which only outputs on one line. Notice the change at DAQmx Read.vi. The output will remain high if you stop the program.
    Please clarify if you have further questions.
    Pelle S
    District Sales Manager
    National Instruments Sweden
    Attachments:
    Write Dig Chan1line.vi ‏28 KB

  • How to generate a pulse on x number of events PCI-6602

    I am running LabVIEW 5.1 full development with a PCI-6602 counter board.
    I would like to generate an output pulse after counting x number of input pulses. I would also like to reset the counter with an external signal.
    My application is I am trying to generate a second index pulse for an encoder.
    I would like to count the pulses from encoder phase A and generate an output pulse on x number of counts. Then I would like to reset the counter using the encoder’s index pulse. This way I can change the phase of the “generated” index pulse with respect to the “real” index pulse by x number of counts (degrees) and maintain that regardless of encoder rpm.
    Thanks
    Brian

    Brian,
    There actually is a way to do what  you want, but it gets a little complicated.  I don't have LV on this machine so I'll have to just describe the idea.  First a summary: the counter will repeatedly countdown to 0.  Each time it reaches 0, it will generate a brief pulse which will in turn hw-reset the counter value to N.  Then it will countdown to 0 again, etc.  The same brief pulse could also be wired to a different encoder-measuring counter to create a "delayed" reset to 0 (or some other #).
    1. Configure your counter for "position measurement" instead of "simple event counting".  Set the encoder type to, um, I forget the name -- something like "two pulse encoder."  It's the setting that will increment with every SOURCE edge and decrement with every AUX edge.  Wire your encoder channel A to the counter's default AUX input (in position encoder mode, you must use the default input pins).  Hard wire from the default SOURCE input to GND.  Now every encoder edge will decrement the count, and nothing wlil ever increment it.
    2. Configure the counter to use z-indexing.  Set the z-index reload value to be N-1, where N is the # of encoder counts by which to delay the encoder's real z-index pulse.  Set the z-index reload phase appropriately, probably to A low B low.  Wire the real z-index pulse to the counter's GATE input.
    3.  Configure the counter to "pulse on terminal count" -- you do this using 'Counter Set Attribute.vi'.  So N encoder edges after the real z-index pulse, you'll generate a pseudo-z-index with this counter.
    4. You can wire this pseudo-z-index to the GATE input of the encoder-measuring counter.  Now the encoder's z-index pulse is delayed by an amount you can program.
    5. Note: this method requires the motion to be uni-directional.
    Good luck!
    -Kevin P.

  • Sharing an external sample clock between PCI-6722 and PCI-6602

        I need PCI-6602 work with PCI-6722。6602 shares 6722’s ao/SampleClock as external clock and triggered by 6722’s ao/StartTrigger。The master device is 6722, which refered as Dev1, and the slave device is 6602, which refered as Dev2. A RTSI line is used to connect the two devices correctly.
        I use C API to finish my program and my code is as follows:
    //config 6722 analog out task
    1、DAQmxCreateTask("NI6672", &hAOTask);
    2、DAQmxCreateAOVoltageChan(hAOTask, "Dev1/ao0", "", -10.0, 10.0, DAQmx_Val_Volts, "" );
    3、DAQmxCfgSampClkTiming(hAOTask, "", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000);
    4、DAQmxWriteAnalogF64(hAOTask, 1000, 0, 10.0, DAQmx_Val_GroupByChannel, data, NULL, NULL);
    //config 6602 counter task
    5、DAQmxCreateTask("NI6602", &hCounterTask);
    6、DAQmxCreateCICountEdgesChan(hCounterTask, "Dev2/ctr0", "", DAQmx_Val_Rising, 0, DAQmx_Val_CountUp);
    //use /Dev1/ao/SampleClock for external clock
    7、DAQmxCfgSampClkTiming(hCounterTask, "/Dev1/ao/SampleClock", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000);
    //use /Dev1/ao/StartTrigger
    8、DAQmxSetTrigAttribute (hCounterTask, DAQmx_ArmStartTrig_Type, DAQmx_Val_DigEdge);
    9、DAQmxSetTrigAttribute (hCounterTask, DAQmx_DigEdge_ArmStartTrig_Src, "/Dev1/ao/StartTrigger");
    10、DAQmxSetTrigAttribute (hCounterTask, DAQmx_DigEdge_ArmStartTrig_Edge, DAQmx_Val_Rising);
    //start counter task first
    11、DAQmxStartTask(hCounterTask);
    //start 6722 task
    12、DAQmxStartTask(hAOTask);
    I run it on the MAX virtual Device, and the Step 11always returned -89120。
    I try to slove this problem, so I change the Step 7, use /Dev2/PFI9 to instead of /Dev1/ao/SampleClock.
    7、DAQmxCfgSampClkTiming(hCounterTask, "/Dev2/PFI9", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000);
    The code runs well, but I don’t know which terminal is connected by /Dev2/PFI9. Does it connect to /Dev1/ao/SampleClock?
    I use another API DAQmxConnectTerms to ensure that, I add a Step before Step 11.
    DAQmxConnectTerms( "/Dev1/ao/SampleClock", "/Dev2/PFI9", DAQmx_Val_DoNotInvertPolarity );
    The program also run well. But I am still not sure that 6602 is sharing /Dev1/ao/SampleClock。If not, which terminal of Dev1 is connected by /Dev2/PFI9?
    Is my code right? If not, hwo to fix my code or supply some example for me? Thanks.

    Hello Shokey,
    From looking over your post, it looks like you want to program in C, using simulated instruments, a master/slave design with a PCI-6602 and PCI-6722. The PCI-6722 is the master device and the PCI-6602 is the slave device. In order to implement this with the real cards, you would need a RTSI cable between the 2 cards in order to pass the triggers and the sample clock. Unfortunately with simulated devices you can't implement this so parts of your code won't be able to work exactly like if you had the instrument.
    If you did have the instrument, you can implement this by performing the following steps:
    Master Device:
    1.) Export the ao/SampleClock and ao/StartTrigger to a RTSI Line. (See DAQmx C Reference help for DAQmxExportSignal to export these)
    Slave Device:
    1.) Set the Sample clock and the trigger to the RTSI.
    There is another forum that I think will help you out to implement this correctly. In this forum, the customer was trying to export a trigger through a RTSI and the problem he was experiencing was a broken RTSI cable. His code, he states, works. I hope this helps you with this and if you have any more questions, feel free to post.
    Jim St
    National Instruments
    RF Product Support Engineer

  • Is It possible to access checksum field of LIN frame?

    Hi All,
               I am using LabVIEW 8.2 and PCI 3072 LIN card (GÖPEL electronic GmbH) .
    Is it possible to access checksum field of LIN frame? I have to test one LIN driver - LIN conformance test. So I need to access timing of each byte, value of checksum, sync field etc. Anybody please reply
    Regards
    Preejesh M R

    Hi,
    You should have found some examples along with the Drivers provided in the CD which comes along with the card. If not, you can contact Goepel and they can provide them. Which driver APIs are you using for this device? Is there a function for checksum in the API, if not you can create a logic to read the string and convert it to a number and add all the bits together. My first suggestion,  however is to contact Goepel.
    Thanks, 
    National Instruments
    Applications Engineer

  • Pci 6602 external clock

    Hello I'm a little bit a newb concerning the PCI-6602, and I need somenones help. I have a APD which delivers signals I want to count while an external gate is high. My code so far (this is just pseudo code since I have a wrapper in python): I have connected the signal I want to count to the PFI39 and the Gate to Gate - ctr7
    DAQmxCreateTask('', task)
    DAQmxCreateCIPulseWidthChan( task, "/dev1/ctr7", '', 0, MaxCounts*DutyCycle/f, DAQmx_Val_Ticks, DAQmx_Val_Rising)
    DAQmxSetCIPulseWidthTerm( task, "/dev1/ctr7", "" ) 
    DAQmxSetCICtrTimebaseSrc( task, "/dev1/ctr7", "/Dev1/PFI39" ) )
    DAQmxSetCIDupCountPrevent(task, "/dev1/ctr7", True  )
    DAQmxSetReadRelativeTo(task DAQmx_Val_CurrReadPos) )
    DAQmxCfgImplicitTiming( task, DAQmx_Val_FiniteSamps, 1000)
    DAQmxSetReadOffset(task, 0)
    DAQmxSetReadOverWrite(task, DAQmx_Val_DoNotOverwriteUnreadSamps)
    DAQmxStartTask(task)
    DAQmxReadCounterU32(task
    , 1000
    , 0.008
    , 285099872
    , 1000
    , ctypes.byref(self._CINread), None) 
    DAQmxStopTask(task)
    this is not actual code, this is just copied from a python file - thus not C Synthax, but the functions should be ok.
    If I set the Gate to low however I still get counts, although the Gate is low. Can anyone help me? Did I connect the gate / src to the correct pins?

    The behavior you describe doesn't make sense to me.  Having configured implicit timing, you would only expect a single sample every time the gate signal goes from high to low.  Each buffered sample would indicate the number of source ticks that occurred between sequential rising and falling edges of the gate signal.  Is this the behavior that you intended?  If the gate is just staying low one would expect the read call to timeout since no new samples would be available.
    Does DAQmxSetCIPulseWidthTerm( task, "/dev1/ctr7", "" )  not return an error?  On my simulated 6602 as well as my real PCIe-6351 I get error -200254 indicating that an empty string is not a valid terminal (although I know for a fact that this does work for counter output terminals, I don't think it makes much sense for the input terminal on a pulse width task).  In any case, you should just specify the PFI line to which you have connected your gate signal.
    Best Regards,
    John Passiak

  • Alternative to PCI-6023E + PCI-6602

    Hello,
    I am already using a system to acquire 16 analog inputs data (at 50Hz) and 100Hz PWM signals (counters) and to send 100Hz PWM signals to external devices. Because it deals with 12 concurrent counters I bought 2 x PCI-6602 counter boards on top of a PCI-6023E for the 16 analog inputs (through a SC2345 box). This works all well.
    I now have to build a simplified and portable solution that has to run on a laptop. I was thinking about a DAQ-6036E or DAQ-6024E (or even DAQ-6062E) and keep a SC2345 but do not know if I will get the same functionalities particularly for the PWM counting (in and out). I have to be able to count the high edge of the square signal at 100Hz while acquiring my analog inputs; also be able to generate those 100Hz signals. Will I be able to connect my counter in and counter out (one of each) to the SC2345 to do that?
    Thanks for your comments,
    Christophe

    Hello Christ0phe,
    Looking at your current specifications and hardware, the best suitable solution for a portable appication with >2 counters would be the Compact RIO Platform.
    As this is an FPGA based platform, you can implement (theoretically) as much counters for PWM generation and reading as you want.
    As you are an existing DAQ user, you will not be able to reuse your existing code.  The cRIO platform uses the NI-RIO driver which is using some different program logic than the NI-DAQmx driver.
    Why is the Compact RIO platform the best solution?
    Well, the cRIO chassis can be powered by a simply DC power supply. Depending which chassis this is between 9 and 30 VDC.
    The cRIO platform also has a dedicated controller inside which will run your LabVIEW code.  The PWM logic itself can run on the FPGA integrated in the cRIO chassis.
    So, the laptop will not be use for any calculation, only for monitoring and control of your application.
    If you want to stay with the NI DAQ plaform I see two other portable solutions:
    The first one is to make the swtich to the PXI platform.
    There is a small chassis (PXI-1033) which has an integrated MXI-interface. Using MXI technology, you can control a PXI chassis from another PC, including a laptop (using ExpressCard, not PCMCIA).
    For the PXI platform you can use identical or similar DAQ boards as you have now, reusing your existing LabVIEW code.
    Drawback of the PXI-1033 is that it can only be powered by 230VAC, you will have to provide a DC-to 230VAC converter yourself to be able to use it in the field.
    For your information. It's becoming harder and harder to find laptops with PCMCIA slots, ExpressCard is the successor available on most new laptops.
    But please have a look at following article concerning laptop compatibility: http://zone.ni.com/devzone/cda/tut/p/id/5035
    A last solution is to use the cDAQ plaform.
    Again a fully portable DAQ solution, but as it uses the same technology as the 'normal' DAQ boards, it only has 2 counters on board.
    As your PWM speeds are quite slow, it may although be possible to use this platform for multiple PWM signal generation and reading.  All will depend on the desired PWM accuracy (resolution) and if they all share the same signal period.
    It is possible to use the 2 on-board counters as a known sample clock to generate and read the PWM pulses using correlated DIO.
    Correlated DIO means that your digital input and output signals are hardware clocked (synchronized with other available clock source). On the cDAQ platform, your I/O modules must be placed in slot 1-4 of the cDAQ chassis to be able to use correlated DIO.  Possible I/O modules are in the C-series 940x range.
    Drawback: all your calculations have to be done on the fly in LabVIEW.  You will need to write code to generate an array
    of digital waveform data, then output it using hardware timed DIO
    synchronized to generate counter clock.  For the readout of the PWM signal, you will have to count (within the LV application) the number of tick (of pulses) of the sample clock during which the PWM signal was 'high' and calculate based on the known timing information the PWM on-time, period (and if needed duty cycle). 
    More info about cDAQ and Correlated DIO:
    NI-DAQmx: Correlated Digital I/O with NI CompactDAQ and LabVIEW
    Can I Use Different Sample Clocks for Correlated DI and DO?
    Some examples exist:
    CompactDAQ - Generating More Than 2 Pulse Trains
    NI-DAQmx: Digital Channel Pulse Width Modulation (PWM)
    This info should already help you make a selection.
    But please contact you local National Instruments office if you need more information.
    Best regards,
    Best regards,
    Joeri
    National Instruments
    Applications Engineering
    http://www.ni.com/ask
    Make our forums great:
    If you like the answer, don't forget to "Kudos!".
    "Accept the Solution" if your question is answered!

  • PCI-6602: How do I ensure that it is functioning properly??

    Hi!
    I have installed a PCI-6602 into my system.
    I have ran a "Self-Test" on the board and it says it passed.
    We are trying to generate a pulse through PFI36 cntr0. For some reason, it is not generating the signal from the software we recieved from another company.
    Is it possible that a NI-DAQmx version difference could be driving this problem? We have a 8.8.0f2 and they have 8.7.1f3.
    Are there any other "Self-Tests" we can run on this board to ensure that the NI board is functioning properly?
    What other problems could we be looking at?
    Thanks for your time!

    Hello,
    You can do this:  Set up a slow pulse train for CTR0 (1Hz).  Set up a continuous digital channel read for Port 0 Line 0 on your card.  Hook up CTR0 output (pin 5) to P0.0 (pin 10).  Start your program to do the counter output pulse train and continuous read.  You should see your digital line transition from high to low over time.  The examples you can use to set this up are Gen Dig Pulse Train-Continuous.vi and Cont Read Dig Chan-Int Clk.vi.  For Cont Read Dig Chan-Int Clk.vi, remove the DAQmx Timing VI to make it software timed, and connect the task handle and error wires accordingly. They can be ran from separate VI's as they don't use the same resources. 
    To be exact on the verbage used, you can perform a self-test on the device by right clicking the device in Measurement and Automation Explorer (MAX) and select Self-Test.  As for testing the device manually, go with what I described above. 
    Kyle A.
    National Instruments
    High Speed Digital I/O Product Support Engineer - R&D

  • USB-6008 DIO Lines...

    I have a USB-6008 that I'm using to develop an application with. The development language used is C# (.NET 2003 with Measurement Studio 7.0). Right now, I have the device successfully reading from the counter input. Since this program reads rising edges from the counter input, I can get the frequency of the input signal and cause something to happen should the frequency rise above a certain threshold.
    I'm trying to use the Digital port (port0) to set line 0 high if a condition has been met. I can do this when I select 'Dev1/port0' - I get Port 0 line 0 to go high or low. The problem is that I want to have control over lines 1, 2, 3, 4, 5, 6 and 7 - I only have access to line 0 right now on either Port 0 or Port 1.
    Currently I'm using the following imported functions from the C samples included in the NI-DAQmxBase software:
    int result = DAQmxBaseCreateTask("", out dioTaskHandle); // create the DIO task...
    result = DAQmxBaseCreateDOChan(dioTaskHandle, "Dev1/port0", "", 1); // create DIO channel...
    result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0, out reserved); // write a 0 to the channel selected
    Just a note about the third line of code - the documentation states that parameter 2 of the 'DAQmxBaseWriteDigitalScalarU32()' function must be set to false. When I use false as the 2nd parameter, I end up getting a return value of -1073807346. I can't find what that error is in any documentation. So, I set this value to true - and it works (I get a return value of 0 meaning success).
    In my development cycle, I've tested for ways to get access to a single line (other than line 0), and found that when I create a DO channel with the value "Dev1/port0", port 0 line 0 is active. When I create a DO channel with the value "Dev1/port1", port 1 line 0 is active. If I try to create a DO channel with a value of "Dev1/port2" through "Dev1/port7", I get a return value of -200170 (Physical Channel Does Not Exist). The documentation isn't very clear on the ports and single lines for digital output.
    My question is - how can I gain access to ALL of the lines of a particular port?
    Thanks,
    tsc

    I just figured out the lines of the port - of course this will happen once I've posted a question. If others run into the same type of problem, here's how to access each individual line of a selected digital port:
    line 0 - 0x01 (binary: 0000 0001)
    line 1 - 0x02 (binary: 0000 0010)
    line 2 - 0x04 (binary: 0000 0100)
    line 3 - 0x08 (binary: 0000 1000)
    line 4 - 0x10 (binary: 0001 0000)
    line 5 - 0x20 (binary: 0010 0000)
    line 6 - 0x40 (binary: 0100 0000)
    line 7 - 0x80 (binary: 1000 0000)
    all lines off - 0x00 (binary: 0000 0000)
    all lines on - 0xff (binary: 1111 1111)
    // create a task...
    result = DAQmxBaseCreateTask("DigitalPort0 Task", out dioTaskHandle);
    // create a channel - I'm using Port 0 in this example)...
    result = DAQmxBaseCreateDOChan(dioTaskHandle, "Dev1/port0", "", 1);
    // turn off all digital lines to the port selected (I do this when starting up)...
    result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0x00, out reserved);
    // if I want to turn on the first line (P0.0) of port0, then I send 0x01 as the fourth parameter...
    result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0x01, out reserved);
    // if I want to turn on the fifth line (P0.5) of port0, then I send 0x20 as the fourth parameter...
    result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0x20, out reserved);
    I hope this will help someone else out using this device and Measurement Studio for .NET.

  • Triggering the reading of counter totals (PCI 6602)

    Hi,
    thanks for reading these lines,
    for a special application I need to read the totals of multiple counters
    simoltanouesly. The inputs of the counters are connected to quadrature encoders.
    Is there a way to reroute the gate to another input pin?
    Thanks for taking the time to support me.
    live long and prosper
    Michael

    Dear Jochen,
    (1) Principally, I'd like to use PCI-6602 to be a motion encoder also be a counter (Is it possible? Due to the manual, it is possible). I expect to have all information, such as position, time, velocity, etc. from that motion encoder (or at least the position and time). It is also expected of using PCI-6602 to do all measurements that I mentioned before . My meaning is, after having a signal from the counter, that 'count' will be converted to desire units under other programs. So, in this case, PCI-6602 is only used to get the 'count'.
    Simplified, the voltage command will send to the system (linear motor) through PCI-6052E (-10V to 10V). The actual position or other actual information will be catched (read) by using PCI-6602 (as a motion encoder, also as a counter). Then, this actual position will be used as a feedback, that will be compared to desired position.
    Is that also possible to use PCI-6602 be a motion controller + a counter + a frequency measurement in a same time parallely?
    I don't decide yet (I don't know) which acquisition rate will be needed/required, higher is better.
    (2) I'd like to apply an adaptive robust controller (yes, it is a closed loop system) under matlab with their feature called Real-Time-Workshop instead of using LV.
    (3) Power drive for the linear system will be driven by AC servo drive.
    Thanks for your help before,
    Warmly regards,
    hendro

  • Frequency output on a PCI-6602

    I was wondering if there is a frequency output port on the PCI-6602. If so, how can I use it?

    Hello,
    I am not positive of what you mean by a 'frequency output port,' so you will have to forgive me if this response is a little off target.
    The 6602 consists of 8 up/down 32-bit counters. Each of these counters has an output line that can be used to output pulse trains at frequencies that you specify. Furthermore, you can also configure your counters to perform frequency measurement.
    If you are referring to something similar to the FREQ_OUT pin that exists on our E Series boards, the 6602 does not possess this type of output pin. Instead, you would need to use the standard counters on the 6602.
    I hope this helps!
    Matthew C
    Applications Engineer
    National Instruments

  • General input PFI_33 on PCI-6602

    Hi,
    I don't know how can i setup digital line PFI_33 on PCI-6602 as general
    input and how can i read it. DIG_Line_Config and DIG_In_Line function work
    only for PFI_0 to PFI_7. Port 0 and Line 33 or Port 4 and Line 1 (PFI_33)
    don't work with this function and return status -10006 and -10007.
    Thank you for any answer
    Petr
    Odchozi zprava neobsahuje viry.
    Zkontrolovano antivirovym systemem AVG (http://www.grisoft.cz).
    Verze: 6.0.307 / Virova baze: 168 - datum vydani: 11.12.2001

    If you are doing digital input, you do not need to distinguish between counter lines and digital lines. You can read from any line by using the digital read functions. DIG_In_Line, DIG_In_Prt, DIG_Line_Config, DIG_Out_Line, DIG_Out_Prt, and DIG_Prt_Config all work with the 6602, the port parameter should be '0' and possible lines to use are 0 to 31, the directions of the lines are configurable on a per line basis.
    If you want to use the programmable function input (PFI) lines for digital output, then you can configure them for digital output on a line-by-line basis.
    In the C application programming interface (API), you can use the DIG_Line_Config function to configure the lines individually as output, and you can use the DIG_Out_Line function to perform the ou
    tput.
    Make sure you have the port set to 0. If this does not work, let me know.
    Brian

Maybe you are looking for

  • No Signal to External Monitor

    I use KDE and have a HP ProBook 6560b with a dock/port replicator.  My problem is that signal to my external monitor doesn't automatically work on login rather it be via VGA or DVI (currently hooked up over DVI).  I tinkered around with it and got it

  • Hp convert to pdf license interferes with adobe acrobat x pro

    Windows 7, Office 2010 with the HP Convert to PDF plugin.  Installed Adobe CS5.5 Jan 7, 2012, on this computer.  Everything worked fine.  Sometime later (last summer?) my CS5.5 Acrobat X Pro failed, symptom is that it hangs in a loop asking me to acc

  • DVD's play fine, but CD'splay for about 2 minutes then disk is rejected.

    I have tried various commercially created music CD's and each one pops out after about 2 minutes. DVD's seem to play fine. I have reinstalled the device driver, but no help. Any ideas? Alyn

  • Limit on calendar entries imported to 8130 from Palm OS?

    I got a BB8130 (Sprint) yesterday. After loading the software successfully onto my PC, I tried to run the automatic converter that imports my calendar, contacts, etc from my current Palm OS. The dialogue box popped up and indicated that it was copyin

  • Access Code for Long Distance

    I am unable to make long distance calls. Each time I try I get a recording stating the access code I entered isn't valid. What does this mean? I've never heard of using an access code for long distance. Thanks in advance for your help.