Arming a counter polling a digital line

For arming a counter, a start trigger on the STC counter can be roughly emulated by polling a digital line and arming the counter once a high digital pulse is sensed. How can i do that?
I'm using a PCI-MIO-16E-4

Daniel,
You did not mention which programming environment you are using, so I will describe the structure in LabVIEW (no matter which language you are using, this should give you the general idea).
1. Configure your DIO port with DIO Port Config.vi.
2. Configure your counter operation (Counter Group Config.vi, etc.).
3. In a while loop, call DIO Port Read.vi.
4. Monitor the bit corresponding to your trigger line. When this bit goes high, stop the while loop.
5. Immediately after the while loop, call Counter Control.vi to arm your counter.
This should be the basic structure of your program. Good luck with your application.
Spencer S.

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;      

  • Time Controlled digital line PXI-6251

    Hi,
    I need to create a time controlled boolean.
    For example a digital line is set to False. I'd like to change to True status for a certain amount of time (e.g. 150ms).
    Is it possible with PXI 6251?
    Thanks

    Hi,
    yes you can. Set a buffered digital output task like "Digital - Finit Output.vi" example.
    You can use an external clock, generate it throught counter output or use ananog in/out sample clock.

  • Write to digital line and wait 20 mico sec and aquisition

    i have DIO-32HS and PCI-6036E. i want to select a port by writing to digital port or line and then wait for 20 micro sec after thar i have to aquire data from AI.my problem is waiting 20 microseconds how i can achieve this?E-mail id:[email protected]

    Here is what I suggest. I'm assuming you will use the DIO-32HS for writing to the digital line. You could use that digital line as a trigger for a counter on the PCI-6036E. When the counter is triggered, it could generate a single pulse with a delay of 20 microseconds and that pulse could be used as a trigger for analog input on the PCI-6036E.
    There are LabVIEW shipping examples that will illustrate how to setup triggered counter and analog input applications. I hope this helps.
    Regards,
    Todd D.
    Applications Engineer
    National Instruments

  • Replacing Digital Line with Network Communicat​ions

    Hi, 
    Does making the timeout for the 'EthernetIP Tag Read' VI zero, remove the ability for the VI to wait? When 'EthernetIP Tag Read' VI poll for the current value of the tag, does it add extra time if wait is zero ms?
    I have successful create a code that works using digital signal (see attachment 1). I want to replace some of the digital line with network communication.  Can I just replace digital line SV with 'EthernetIP Tag Read' VI?
    The replacement will happen in my non deterministic loop.
    Attachments:
    attachment 1.jpg ‏143 KB

    Thanks
    I benchmark the time it take to set a 'Digital line' SV and the time it take to use 'Ethernetip tag Read' VI. The ‘Digital line’ SV take less than an ms and the 'EthernetIP tag Read' VI take about 33 ms.   That mean every time the loop run it will take an extra ~33ms to run any of my states.  
     My initial question was asking how I can have the same level of smaller timing accuracy (similar to the digital line) using the networking communication.  From the benchmarking test I did, I do not think that is not possible. Am I right?
    What is a normal timeout time? What is a great way to handle EthernetIP timing out? Can you provide some exaples ?  or link to similar situations. 
    Attachments:
    Replacing DI line SV with Netwrok comm.png ‏23 KB

  • Reading digital line and local variable

    I am using digital lines in my program to start and stop "Flat Sequence Structures"
    like time measurement ( 4 sequence, start and stop time with "Tick Count" )
    Is it good behaviour if i use once "Read from Digital Line.vi" and other starts and stops etc. with Local variables?
    Or can i just use "Read from Digital Line.vi" many times in my VI? (same line)

    Most experienced LV programmers try to avoid both sequence structures and local (and global) variables. The state machine architecture is often preferred. Look at the examples with LV and search for "State machine" on this site.
    I would probably use one read line or read port VI in a loop and pass the data to other, independent loops for processing (the timing) via queues.
    Lynn

  • How to Count Number of completed line items in past 6 months / 12 months ?

    How to Count Number of completed line items in past 6 months / 12 months ?
    Hi,
    I am trying to count "Number of Completed Line Items in Purchase Order Document" for my Key Figure ZPO_CNT.
    Purchase Order document = ZEBELN
    Line Item = ZEBELP.
    I need to find and count if the Line Item has been received in the past 6 months from today and similarly in the past 12 months.
    I have "Delivery Completed" field, ELIKZ.
    So, based on this would I be able to calculate it in Query Designer?
    If so, Please let me know how

    Hello Deva
    If youe want to calculate the completed line item for last 6 or 12 month then i think u will be displaying the query data for these montrhs...create a customer exit to give you date range and restric it in filter area....
    Now Choose any of the below option
    1. I would suggest to implement an additional key figure "counter" in cube and fill values with one for which delivery is completed.
    Now use calculated key figure in Query Designer based on logic
    IF counter = 1 THEN counter ELSE 0
    OR
    2. create a formula variable based on ELIKZ and use replacement path variable, it will display you no. of docs for which delivery is completed....
    Award points if it solves your problem
    Revert back in case of further assistance...
    Thanks
    Tripple k

  • Multiple VI's using different digital lines in one VI.

    I have created multiple vi's, each of which require either reading or wroting to a different digital line on the CB-68LP board. I need to put them all in one individual vi so that I can see everything on the front panel. When I have tried this the vi seems to send a confused signal and operate things which it shouldn't.
    Is it even possible to try and do what I am doing? If not, any ideas what I can do? Thanks.

    Multiple VIs are usually the better approach. What I would suggest is parallel loops. These are loops which do not have any data dependency on each other. One handles the User Interface - the front panel where you "see everything." Another which reads and writes from/to the digital lines. Maybe even a third which processes the data. Exchange data among the loops with queues or functional globals.
    Keep a record of the state of all the digital lines. When something is to be written to certain lines, use either a Write Line.VI ( I don't recall the exact name) or use AND and OR functions with masks to protect the states of line you do not want to change.
    BTW, the CB-68LP is merely a connection interface, not the digital I/O baord itself.
    Lynn

  • How does one write to individual digital lines accross many DIO-96 ports?

    I want to be able to write to any individual DIO-96 line without having to repeatedly init. The available vi's can set up only 24 lines at a time. If it is desired to write to a line outside of those 24, another 24 lines must be initialized, then to return to the first 24 lines, those must be initialized once again. Very clumsy! Does anyone know how to init all lines one time and then allow random access to all 96 lines without further initialization?
    Thanks,
    CBD

    Hi Tom,
    try to use (or at least to insert) that control in another environment (like a Visual Basic form) in order to check if it's working properly. Also, check if you have the DLL with the same name in your system folder - this control it's just a simpler way to use that dll.
    You can use Write to Digital Line.VI, but pay attention to ITERATION terminal - if it is 0(default) LV will call DIO Port Config (find details in help).
    Hope I understood the problem...

  • How to count the number of lines dynamically,

    In the below code am trying to read the lines which are selected using a check box, also am categorizing the contents depending on the follow up material.
    after displaying one category contents am displaying a line
    which also counts to a line in the internal table.
    My question is how to count the number of lines(ULINE) displayed dynamically.
    FORM GET_LINES .
      DATA: LV_LINES TYPE I,
            LV_TIMES TYPE I,
            LV_TABIX TYPE SY-TABIX.
      DESCRIBE TABLE IT_REC LINES LV_LINES.
      DO LV_LINES TIMES.
        LV_TIMES = SY-INDEX .
        READ LINE LV_TIMES FIELD VALUE IT_REC-CHECK INTO GV_CHECK.
        IF SY-SUBRC EQ 0 AND GV_CHECK IS NOT INITIAL.
          LV_TABIX =  LV_TIMES.
          READ TABLE IT_REC INDEX LV_TABIX INTO GWA_UPDATE.
          IF SY-SUBRC EQ 0.
            APPEND GWA_UPDATE TO GT_UPDATE.
          ENDIF.
        ENDIF.
      ENDDO.
    ENDFORM.                    " GET_LINES

    In the below code am trying to read the lines which are selected using a check box, also am categorizing the contents depending on the follow up material.
    after displaying one category contents am displaying a line
    which also counts to a line in the internal table.
    My question is how to count the number of lines(ULINE) displayed dynamically.
    FORM GET_LINES .
      DATA: LV_LINES TYPE I,
            LV_TIMES TYPE I,
            LV_TABIX TYPE SY-TABIX.
      DESCRIBE TABLE IT_REC LINES LV_LINES.
      DO LV_LINES TIMES.
        LV_TIMES = SY-INDEX .
        READ LINE LV_TIMES FIELD VALUE IT_REC-CHECK INTO GV_CHECK.
        IF SY-SUBRC EQ 0 AND GV_CHECK IS NOT INITIAL.
          LV_TABIX =  LV_TIMES.
          READ TABLE IT_REC INDEX LV_TABIX INTO GWA_UPDATE.
          IF SY-SUBRC EQ 0.
            APPEND GWA_UPDATE TO GT_UPDATE.
          ENDIF.
        ENDIF.
      ENDDO.
    ENDFORM.                    " GET_LINES
    The display function is:
    FORM DISPLAY_DATA .
      ULINE.
      WRITE :  /1 SY-VLINE, 'check',
                10 SY-VLINE, 'Plant',
               20 SY-VLINE, 'Material number',
               50 SY-VLINE, 'Follow up material',
               70 SY-VLINE, 'Safety stock',
              100 SY-VLINE, 'Partc'.
      ULINE.
      LOOP AT IT_MARC.
        MOVE: IT_MARC-WERKS TO IT_REC-WERKS,
              IT_MARC-MATNR TO IT_REC-MATNR,
              IT_MARC-NFMAT TO IT_REC-NFMAT,
              IT_MARC-EISBE TO IT_REC-EISBE,
              IT_MARC-PARTC TO IT_REC-PARTC .
        APPEND IT_REC.
        CLEAR IT_MARC.
      ENDLOOP.
      DATA: GV_TABIX TYPE SY-TABIX.
      LOOP AT IT_REC.
        GV_TABIX = SY-TABIX.
        READ TABLE GT_TOTAL WITH KEY WERKS = IT_REC-WERKS
                                     NFMAT = IT_REC-NFMAT.
        IF SY-SUBRC EQ 0.
          IT_REC-PARTC = GT_TOTAL-PARTC.
          MODIFY IT_REC INDEX GV_TABIX TRANSPORTING PARTC.
        ENDIF.
      ENDLOOP.
      LOOP AT IT_REC.
        WRITE : /1 SY-VLINE, IT_REC-CHECK AS CHECKBOX,
                10 SY-VLINE, IT_REC-WERKS,
                20 SY-VLINE, IT_REC-MATNR,
                50 SY-VLINE, IT_REC-NFMAT,
                70 SY-VLINE, IT_REC-EISBE,
               100 SY-VLINE, IT_REC-PARTC.
        AT END OF NFMAT.
          ULINE.
        ENDAT.
      ENDLOOP.
      ULINE.
    ENDFORM.                    " DISPLAY_DATA
    Solved

  • Count the number of lines in a txt file

    I need to count the number of lines in a txt file, but I can't do it using readLine(). This is because the txt file is double spaced. readLine() returns null even if it is not the end of the file. thanks for the help

    I need to count the number of lines in a txt file,
    but I can't do it using readLine(). Then just compare each single byte or char to the newline (code 10).
    This is because the txt file is double spaced. readLine() returns
    null even if it is not the end of the file.Errm what? What do you mean by "double spaced"? Method readLine() should only return null if there's nothing more to read.

  • Count the number of lines in  each file in a directory

    Hello,
    I would like to count the number of lines for each file in my directory and subdirectories.
    I wonder how can I count the lines of the specified files?
    Here is the program which is listed the files in the specified directory:
                        String path = "C:/User/Studies/Pracices/src/Pract1";
           String files;
           File folder = new File(path);
           File[] listOfFiles = folder.listFiles();
           for (int i = 0; i < listOfFiles.length; i++)
            if (listOfFiles.isFile())
         files = listOfFiles[i].getName();
         System.out.println(files);

    Ok so one more question.
    Actually my path is pointing to one Directory and like here I can just read from one file that the name of the file should be specified in the path is it possible to help me in that part?
    File f = new File("C:/User/Studies/Practices/src/Pract1/");
    FileReader fr = new FileReader(f);
          BufferedReader br = new BufferedReader(fr);
          String str = br.readLine();
              LineNumberReader ln = new LineNumberReader(br);
              int count = 0;
              while (ln.readLine()!=null)
                  count++;
              System.out.println("no. of lines in the file = " + count);

  • Pxie-6556 - How to control the rise time in the digital lines (hsdio)

    Hi,
    Is there any way to control the rise time in the PXIe-6556 digital lines?
    Even in a low frequency signal 10kHz the rise time is about 2ns.  
    Tks,
    Solved!
    Go to Solution.

    Hello engfpe,
    The PXIe-6556 is a 50 Ohm system, meaning the output is source series terminated to be 50 Ohms and all our cables and accessories are 50 Ohms.  With this setup regardless of the data rate you should have a clean rising or falling edge regardless of the data rate. The quality of the output (rising or falling edge) at your device will be related to the impedance matching of your cables. 
    The PXIe-6556 cannot adjust the slew rate by itself.  However you can insert some simple passive components to do this for you.  I've attached below to images.  The first is a schematic showing one way of slowing down the edge.  The second is the a simulated waveform showing the original edge rate before slowing it down, and the slowed down edge.   This simulation is not of the PXIe-6556 but instead a generic digital output for concept.  In the schematic R1 is set to 34 Ohms because U1.8 has the additional 16 Ohms inside it.  TL1 is the 50 Ohm output simulating the cable on the PXIe-6556.  R2, R3 and C1 are components you could insert after the PXIe-6556 cable before it goes to your device/cables.  In this setup the cable going to your device is TL2 which is also 50 Ohms but it could be another impedance in which case you would change R3 to match.
    You can see in the attached images you can significantly slow down the edge with this setup by altering C1.  I hope this helps,
    Jesse O. | National Instruments R&D
    Attachments:
    edge_compare_schematic.jpg ‏94 KB
    edge_compare_waveform.jpg ‏44 KB

  • Digital lines showing in full quality quicktime export

    Hello - just an addition to a previous matter - I exported an 11 min. movie in H.264, w/the default settings, NTSC 4:3; 720 x 480. It's 572.1 MB and I burned to a CD, so that the client can download it into their own laptop, then project it onto a screen. When I viewed it on my computer, there were all kinds of 'digital lines' that showed up, particularly through the transitions (though on most everything else as well), that don't show up on the burned DVD copy. I'm wondering what, if any, particular settings can I use when exporting, so that these pesky 'lines' won't show up, as it looks perfect on the DVD, but won't be viewing from that on the day of the event - ok, thank you!

    I have the same problem... Im using DV pal. Looks loke this is a big problem for many users, bus nobudy knows how to fiks it..my lines are still there on the dvds to by the way..)

  • Problem  to access my count in adobe Digital Editions

    Dear,
    I`ve problem to access my count in Adobe Digital Edition, I bought an eBook in pdf format and when try read it, ask me to get in for  my ID and password ind Adobe Digital Editions,  report that there is another user use my licence.
    Thus, I know that I`ve got 6 licence  for Adobe Digital Editions.

    Adobe ID, sign-in, and account help

Maybe you are looking for

  • How to get meacure value for a sibling attribute in MDX

    Hi, I have a table with the following data Activity Id Last   Activity Id 1 NULL 2 NULL 3 NULL 4 NULL 5 3 6 2 7 3 8 1 9 4 I have created a dimension "Activity" with 2 attributes : ActivityId, LastActivityId I have a Fact table like this : Activity Id

  • Unable to create a user in Windows AD

    Hi All, Firstly, I tried creating a user("newUserName") with Windows AD authentication, Failed. Below is the Error Message Update Error: There was an error while writing data back to the server: Creation of the user newUserName cannot complete becaus

  • I updated compressor and now it will not open!

    When the automatic Updates available came up this morning I updated. Compressor was one of them and now it will not open. Compressor opens for a second and then goes away. Is there any way to UNDO UPDATES?? PLEASE HELP I have to make DVDs from my FCP

  • Need to copy files to path that contains a wildcard!??!

    Afternoon, I am attempting to copy a set of files to multiple computers on the network (files are at a dfs link, no issue there). The destination path on each computer is either: "\\$computer\c$\Program Files\AASHTOWare\Trns·port Client-Server PES-LA

  • Email push is very slow\

    My Email is working very slow, First i am getting it in my computer and then in my I Phone and that if i press the Mail App its freshshing if not its not refreshing the mail. Till Yesterday it was working properly and only today i am facing this Prob