Writing to digital port disrupting counter on PCI-6259? (nidaqmxbase)

Hello,
I've set up my PCI-6259 with an angular encoder counter, as per the C code example at http://zone.ni.com/devzone/cda/epd/p/id/5735
This appears to work great, but I would also like to use my PCI-6259's digital lines to control a TTL switch on the encoder it's measuring (among other things). If I set up a separate task in the same program and install a new DOChan to the task, it works great: I can control the TTL and measure the encoder position at the same time.
However, I would like to be able to control the digital lines, e.g., via a script, while leaving the encoder readout running continuously. I tried running the angular encoder counter example code, and while it was running, I ran the dio/writeDigPort example.
First of all, the writeDigPort took about 3 times longer than usual to run. It wrote to the digital line successfully, but as soon as it had, it corrupted the counter somehow. The angular encoder example began to spit out garbage, rather than the measured angle.
Is this just a limitation of nidaqmxbase, wherein I cannot use the PCI-6259 resource from multiple processes? I can imagine this being the case, since I think the counter setup is using a DMA.
Or is there a workaround? Any advice is much appreciated, thanks!
-Chase

I think what was meant is that DAQmx Base is not multi-thread safe.  From the readme:
NI-DAQmx Base is not multi-thread safe. In LabVIEW, use the error cluster to
force execution order. In C, use only one thread to make API calls; especially
for task/channel creation and deletion.
So, if using DAQmx Base, all of your functions should be in the same thread (i.e. don't make parallel calls to the driver).
Having said this, I notice you're using the PCI-6259 which is supported in DAQmx for Linux.  You didn't mention what OS you're using, but if you are able to use the full version of DAQmx I would recommend doing this.  DAQmx is multi-thread safe, and provides more functionality and better performance than DAQmx Base.
Best Regards,
John Passiak

Similar Messages

  • How to use counter using PCI 6259

    Hello, users,
    I have a PCI 6259 board and use Labview 7.1.
    I'd like to repetitively count the photon signals at 10ms integration time. I want cumulative counts in every 1 sec (1000ms) (or 1 min (60000ms)) And I want to save counts into txt.file which is open in excel program.
    I am a beginner to use counter using PCI 6259 board.
    1. Could you explain default NI-DAQmx counter terminals, i.e., CTR 0 SRC, CTR 0 GATE, CTR 0 AUX, and CTR 0 OUT?
    2. How do I use them or how can I connect to count TTL pulse using PCI 6259?
    3. As I mention my purpose above, which example is the first step to start working my purpose?
    4. If you know good example, could you tell me about that?
    5. If anyone has labview example which is similar to my aim, could you give me some tips or your examples?
    Any hint, comment or advice would be appreciated.
    Thank you so much for your response.
    Leek2

    I have never used the PCI 6259 but have used counters many times with labview, the coding should be the same independent of the board.  What you want to do is finite buffered edge counting using a internal clock.  The best way to do this is to look at the examples programs and use the express vi to get started, then you can use this code to customize your program exactly as you need.
    To address your questions:
    1. CTR0 means "counter 0" the name of the physical resource sometimes listed at GPCTR0.  Each counter has 4 connections to the outside world:
    source "src"(for counting input TTL signals),
    gate (for synchronizing to external clocks and edges),
    out (for pulse-train out operations)
    and aux (specialty operations such as up/down counting and encoding)
    2.For event counting with internal clocking you will only use the src this is the input from the signal you wish to count (ie PMT discriminator for photon counting).
    3,4,5. Look at the count edge examples, there isn't one that does exactly what you want but I have done this with a 6602 (it has e counters) where I use one set of counters to set up a finite pulse train in your case 1000Hz with 1000 pulses, and another counter to edge count on an external pulse, with the source of this pulse routed from the out of the other counter.  Then you can start the task and read when 1000 samples are in the buffer (about 1 second later).
    Hope this helps,
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • What is writing to digital port

    Hardware: NI PCI-MIO-16E "DEV1" connected to an SCB68.
    I have a Global Virtual Channel "KeyRun" assigned to Dev1/port0/line1
    Within some VI in the project, there is something writing to that port/line directly without using DAQmx.  I renamed the Global Virtual Channel to another name and the rogue VI still wrote to the port/line.  I renamed the device and the rogue VI still wrote to the port/ine.
    The code was originally created before 1996 and has been passed through multiple people. I'm guessing there is an old way of writing to I/O of which I'm not aware. I'm not even sure what to search for other than DAQmx VI's, DAQmx global channels and property nodes.  

    A program that old is probably using the traditional DAQ driver instead of DAQmx. I don't remember the exact names of the functions but viewing the hierarchy should help.

  • Internal counter/timer PCI 6259.

     I need to create a high digital pulse and them wait a certain time (I choose) that the device must wait(low level) until it creats a new high state level. This wait time must use the PCI's clock as base.

    Krsone, the example you sent didn't open here because I have only LabView 7.1 here in the Laboratory.
    Wayne, I've searched in the examples and I didn't find what I want or something related.
    What I did is create a boolean array and put it to send each position in a specific frequency. For example I chose a frequency
    of 10Mhz and create a boolean array of 20000 positions. In the first position and in the last I put a "High Level data" and in
    the others a "Low Level data", so I achieved  a sinal that sends a High level signal and after 2 sec send another one.
    To change the time between the high level states I must change the boolean array and for it I have to stop the vi.
    What I want is a vi with a configurable time between these 2 high states while the vi runs.

  • Measuring times of digital events on a NI PCIe 6259

    I am trying to figure out how to acquire time stamps every time a digital input (Boolean) changes values relative to the beginning of a AO output. Ideally, I would like to reset the time stamp to 0 each time the AO output occurs (different trials). Both counters on the 6259 are free, however I am already using the ao/SampleClock in my VI. Thank you for any help.

    Hello Joes,
    Since you have 0-30 events which you want to measure the time of, it would be easiest to calculate the time in post processing. You can use a start trigger to trigger both the analog output and the digital input.  Using the start trigger will synchronize the start time. The high to low transitions can be found in the recorded data and the time can be calculated using the position in the data array and the delta time between samples.
    Eric
    Eric Liauw
    AE Specialist - Automated Test | CLD | CTD
    National Instruments

  • Interrupt on NI-PCIe-6259 comes irregular

    Hi,
    I'm writing a card driver for the NI-PCIe-6259 card using SUSE 10.0 with kernel 2.6.19 and xenomai-patch 2.3.0 and DDK.
    I want to do data aquisition wit interrupts. The problem ist the interrupts come not equidistant.
    I initialized the board as shown in the DDK examples. I set the sample rate to 50 Hz.
    I additionally enabled the interrupt with the following instructions:
    board->Interrupt_A_Enable.setAI_STOP_Interrupt_Enable (1);
    board->Interrupt_A_Enable.flush ();
    board->Interrupt_Control.setInterrupt_Group_A_Enable(1);
    board->Interrupt_Control.setInterrupt_Group_B_Enable(0);
    board->Interrupt_Control.flush ();
    In the interrupt service routine are the following instructions:
    board->AI_FIFO_Data.readRegister();
    board->Interrupt_A_Ack.writeAI_STOP_Interrupt_Ack (1);
    board->Interrupt_A_Ack.flush ();
    board->Interrupt_Control.setInterrupt_Group_A_Enable(1);
    board->Interrupt_Control.flush ();
    This code works perfectly on the NI-PCI-6281 card. An interrupt comes every 20 ms.
    With the NI-PCIe-6259 card the time between two interrupts is dithering mostly between 2 ms and 40 ms and sometimes (about every 30th interrupt) the time is greather than 500 ms. The sampling works with 50 Hz because if the time is high the FIFO ist half-full or full.
    Does anyone know a reason for that? Are there any known problems with the NI-PCIe-6259 card?
    Thanks
    Christoph

    Hi ConfusedInCanada,
    It is possible for you if you can provide us screenshots of the code you are using? This will help us to find faster a workaround for your issue

  • How to avoid dependance between output digital port with a PCI 1200 daq card?

    Hello,
    I don't manage to fix the state of a line on one port (PA0 for ex) without change the state of another line of another digital port (PB0 for ex)
    I use a PCI 1200 Daq card with Labview 5.0.1 (under Windows 98)
    How to configure a robust state (high logic level) on a line of a port??
    Does anybody have an idea on this problem?
    Thanks a lot in advance and happy new year to the community
    JF LAVEZARD

    jflab a écrit:
    Hello,
    I don't manage to fix the state of a line on one port (PA0 for ex) without change the state of another line of another digital port (PB0 for ex)
    I use a PCI 1200 Daq card with Labview 5.0.1 (under Windows 98)
    How to configure a robust state (high logic level) on a line of a port??
    Does anybody have an idea on this problem?
    Thanks a lot in advance and happy new year to the community
    JF LAVEZARD
    Hello,
    I've found the problem
    The PCI1200 has a chip 8255 for Digital I/O
    If I use the bad VI, it reconfigures the port and all the lines go in a low logic state
    so I'd to write only on the port or the line without reconfigure the port
    So the good VI in the palett is: Port Write and not Digital Port write!
    See attached file..
    Thanks
    Best Regards
    Attachments:
    port_dio.jpg ‏771 KB

  • No digital trigger signal on a PFI x-port in a PCI-6259

    Hi,
    I am using a PCI 6259 DAQcard (with a SHC68-68-EPM cable and version:2.9.1f0) to get an analog signal and a digital signal. The analog signal is used in NI MAX or NI Signal Express (DAQmn 9.7.5) to trigger it with the digital signal. When the digital signal is mounted on a Px/x port I can detect it. If I want to use it as a trigger signal on a PFI x-  (better PFI x/Py.y-) .port I do not get any trigger quantitiy.
    With a NI USB 6008 everything works quite well. Remark: The digital post is just labled as: PTI 0 and not as in the case of the PCI 6259 on the NI CB-68LPR-board: PFI x/Py.y.
    Another remark is that I did not measure a voltage difference of 5 volt at the provided port.
    How can I fix the problem and use a PFI x/Py.y-port for a digital trigger?
    Solved!
    Go to Solution.

    Hey AndGar,
    by trying I found one chanel on the platine with give me an trigger signal. So I can measure something but not in every chanal.
    Maybe just the PFI x- ports are reserved for triggering and you need to close every other task which measures a digital signal.
    *actuall I have no access to the programm*
    Thanks and best regards,
    Marcus

  • Trouble writing to all three digital ports

    I am controlling three motors with 24 digital lines, 8 for each. The code is attached. Two of the motors will run but the third always crashes (vibrates and trips). When I swap the ports on the three port configurations I can get ANY two motors to run smoothly, but never the third. The problem seems to be isolated to the bottom (see attached code) port configuration and write. I have deleted and reinserted fresh vi's, but no luck.
    I am running a LabPC 1200 board and have tried this with the same error on a LabPC+.
    Is there a better way to write bytes of data to ports?
    Thanks a lot!!!
    -Kyle
    Attachments:
    3motor_test.vi ‏122 KB

    Thanks for contacting National Instruments. After taking a look at your code, I can see that there are a couple of issues here.
    The first is that you are configuring the ports during every iteration of the loop. You should move the port config VIs out of the loop. Having them inside is bad because you really only need to configure the ports once, before you start writing to them. Doing this every iteration adds a lot of overhead, and it also amplifies the effects of the second problem.
    The second problem is that your boards are resetting all the ports every time you configure any port. All National Instruments products that have an 8255 or 82C55 digital chip, including the Lab-PC, will exhibit this behavior. When you change the configuration
    of one digital port on an 8255, the digital lines on ALL of the ports are reset. This is the way the 8255 chip works. The 8255 consists of three ports, each containing 8 digital lines (24 total). To properly use the chip, all configuring needs to be done prior to setting the output states of the lines.
    For more information on this issue, see the linked KnowledgeBase:
    http://digital.ni.com/public.nsf/websearch/3E25A9780F2C48B986256120005AF098?OpenDocument
    So you can see that moving the config VIs outside of the loop should address both problems. This should do it, but if it doesn�t, please let me know.
    -Mike

  • How do I tell LabVIEW to send a logic high to a digital port when an ICTR Control Counter reaches a specific value?

    I am using a DAQ-1200 lab card (8253/54) to run a micro-stepping motor for a NASA research project. I need to tell LabVIEW to send a logic high (+5V) to one of the digital ports when my counter (ICTR Control) reaches a specific value. The logic high trips a relay which changes the direction of the motor, but I cannot figure out how to trigger it. Thanks!

    Wire your counter T/F condition to a Case statement, and when T, have the 'Write to Digital Line.VI' output the logic high or low as appropriate. That VI is in the Functions>Data Acquisition>Digital I/O palette. This should work. Good Luck - Doug

  • Writing to parallel port

    i need to be able to write to the parallel port on a desktop computer
    to control a stepper motor.  I need to be able to write logic high and
    low
    at certain pins that go to a stepper motor driver.  The writing to the
    port needs to be done so many times, or so many steps that are entered
    into the interface. Pins7 is the clock that that starts the stepper
    motor control in the stepper motor driver.  Also, pins 9 and 10 need
    to be driven low or high to tell driver wether half or full step and counter clockwise or clockwise.
    Basically i need to know how to set up my parallel port on my labtop in labView 7.1?
    I want to be able to use the write to digital I/O.vi to send the proper
    binary or hex value of an index array  to the parallel port
    to drive the motor driver.

    Hi exavier,
    Look here maybe someone else hase asked.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • I write digital port by 'DAQmx Configure Logging.vi​' and receive TDMS file with 8 boolean channels. How can I write to 1 integer channel?

    Hello!
    I want to write 1 digital port from PXI-6536 with streaming to TDMS file.
    I'm writing by 'DAQmx Configure Logging.vi' and become TDMS file with 8 boolean channels.
    How can I write to 1integer channel?
    Attachments:
    1.JPG ‏27 KB

    Hey Atrina,
    The actual data stored on disk is just the raw data (that is, a byte per sample in your case).  It's really just a matter of how that data is being represented in LabVIEW whenever you read back the TDMS file.
    I'm not sure if there is a better way to do this, but here is a way to accomplish what you're wanting:
    Read back the TDMS file as a digital waveform.  Then there's a conversion function in LabVIEW called DWDT Digital to Binary.  This function will convert that set of digital channels into the "port format" that you're wanting.  I've attached an example of what I mean.
    Note: When looking at this VI, there are a few things that the downgrade process did to the VI that I would not recommend for these TDMS files.  It added a 1.0 constant on the TDMS Open function, and it set "disable buffering" on the TDMS Open function to false; you can get rid of both of those constants.
    Message Edited by AndrewMc on 01-27-2010 11:21 AM
    Thanks,
    Andy McRorie
    NI R&D
    Attachments:
    digitalconvert.vi ‏13 KB

  • Incremental encoder: reset counter on pci 6014?

    I want to connect an incremental encoder with A, B and Z to a PCI 6014 card. I found some VI's for counting A and B (DAQmx->Counter->Count Digital Events; DAQmx->Counter->Measure Posititon) . However I can't figure out what to do with the Z. Is there a way to reset the counters by Z? (I am using labview 2009)
    Thank you very much!

    Sorry, my fault. I didn't see you have an E-Series device.
    Resetting your counter with a digital trigger is possible for Counter/Timer devices but not for your PCI 6014.
    You can reset the counter with DAQmx by stopping and starting the task again. You could read your Z index on a digital input, if the input goes high (or low) you could reset the counter.
    DAQmx: Count Digital Events with Option to Reset Counter
    http://decibel.ni.com/content/docs/DOC-6576 
    I think this is the only way for the PCI 6014. Since you have to go through several software layers, the performance goes down a bit. If it is possible, i would recommend to change to a M-Series device...
    Cheggers
    Sascha E.
    Group Leader Applications Engineering
    National Instruments Switzerland

  • Start Counter Output on a Analog Trigger in the PCI 6259 Mseries board

    Hi,
    My question is regarding how to use Analog Triggering to start a counter in the PCI 6259 M-series board.
    I have attatched a program here
    'Mult_Device_Digital_Analog_Out_on_Analog_Trigger.​vi'
    and I'll explain my problem regarding this program.
    I've tried to include all the details about the program in the documentation for the VI, but what the program
    does is essentially output a set of digital and analog patterns as specified by an end user, and at times
    specified in the front panel.
    Problem 1.
    I wish to start the whole operation on a analog trigger signal, in the program its the boolean "Line Trigger",
    but I get an error saying that trigger type is not supported, when the M Series board manual clearly says it can be done.
    Is there something wrong with my program ?
    Thanks.
    Shomu
    Attachments:
    Programs.zip ‏101 KB

    Shomu
    Admittedly, it might take a little time to find the documentation, but it is there. Also, the error you are getting indicates the proper trigger signals to use. In the help look at the analog Triggering Considerations for E Series, M Series, and S Series.
    With that being said the easiest thing to do is to setup an Analog Input task configured to start on an Analog Trigger. Then, setup a digital edge trigger for the Counter task. The signal you are going to want to look for is the Analog Comparison Event. This signal won't show up by default in the list. What you need to do is right click on the trigger source constant or control and select I/O Name Filtering. Then check Include Advanced Terminals. Once you have done this you can select the Analog Comparison Event
    StuartG

  • Connecting inductif approximation sensor to digital port

    Hi,
    As I have little experience in electronics I was wondering how I could
    connect a inductif approximation sensor to one of my digital ports of a
    PCI-MIO DAQ card. This card has 8 digital ports which can be configured as
    either digital in or out.
    The sensor is driven by 24 volts DC, three wires, and is of PNP type.
    Anyone?
    thanks
    I'd like to use this sensor to monitor the speed of a slow rotating machine.
    Ron@ld

    Ronald
    If the signal from the signal is withen TTL specs, you can use it with one of the digital ports on the E-Series boards. TTL specs are 0 - 0.8V for low and 2-5V for high. The rise and fall times will also have to be within TTL specs.
    Brian

Maybe you are looking for