CDAQ 9401: 2 x CO Pulse Freq?

Hello
I have got a very simple application that uses cDAQ 9172 and a 9401 module in slot 5. Labview 8.2+NiDaqmx 8.7.
The application uses two Counters out to generate PWM so there is no need to reserve the resources as for the bidirectionnal issue of the 9401 that is documented on the forum.
For certain reasons (to treat the PWM=0% and PWM=100% border values) I need to stop and restart one task or the other and sometimes recreate the task. I have tried every single possibility that I thought about and cannot get rid of this -201133 error.
Thanks so much for having a look at the (ugly) code attached.
Christophe
Attachments:
DEBUG1 sequentiel5bisessaidernier.zip ‏257 KB

Hello again,
I just would like to add that the problem disappears if I add a second 9401 module in slot 6 and define counter out #1 in the first 9401 module and counter out #2 in the second 9401 module.
What am I doing wrong in the case of both counters out sourced by the same 9401 module?
Thanks,
Christophe

Similar Messages

  • Encoder speed and orientation on NI 9401 in cDAQ-9172

    Hello, I've acquired a ni 9401 module for my cDAQ-9172 and it's now installed in slot five to connect a dual channel encoder. Channel A is connected to pin 14 and channel B to pin 17 and the encoder is powered by 5v dc.
    I want to mesure the speed and if possible the orientation of rotation.
    To do this I started with the VI in attach, that can count the total of pulses in the encoder.
    My question is, how can I change the DAQmx Create Channel to Frequency, and the DAQmx Read to Counter Pulse Freq 1 Chan 1 Samp, to calculate the actual encoder speed and orientation?
    Solved!
    Go to Solution.
    Attachments:
    encoder.vi ‏63 KB

    Hi Eric.
    Once again, thank you very much for the help.
    I think I finally did it. The Vi is reading the speed witch I think is right, but there's some oscilation.
    I've connected only the signal A from encoder to pin 14 on the NI-9401, and the pin 1 to ground. The signal B is not connected right now because I only have one NI-9401 on a cDAQ-9172, so only one counter.
    The VI you just send me, is calculating the speed (frequency), witch I divid by 200 because those are the pulses per revolution of the encoder, but I can see a little of oscillation on the speed measured (see picture in attachment).
    For now, my question is if is possible to improve the measurement, and how?
    Thank you.
    André Quintino.
    P.S. - Note that in the picture in attachment, the speed is the one measured by the VI you just send me. The encoder was running at 1524RPM witch are 25,4Hz. Since the speed in the graph is multiplied by 200 (the pulses per revolution of the encoder), this result in a measurement of 5080 witch is the average number by the graph.
    Attachments:
    Screen shot 2011-01-12 at 00.41.13.png ‏16 KB

  • Simple pulse generation toggle

    Below is an excerpt from the 6602 manual.  The figure may not show so I've attached a word document showing it.  I want to do exactly what this says but am not sure how to make it happen.  I need to generate a quadrature signal and I think this would work wonderfully.  I want to setup one counter as my source and have two others toggle appropriately (keeping 90 degree phase shift). 
    How do I get into "Toggle" mode???
    Thanks!
    In toggled mode, the counter output changes state on the SOURCE edge
    that follows the assertion of the TC pulse. Figure 3-6 illustrates the two
    output modes for a pulse generation with a delay of two and a pulse width
    of four.
    Figure 3-6. Output Modes
    Attachments:
    6602 manual excerpt.doc ‏28 KB

    Howdy,
    You can use any of three DAQmx Create Channel VI's (CO Pulse Freq, Time or Ticks) to accomplish this generation. For this particular application, CO Pulse Ticks would probably be easiest since it allows us to input an initial delay, number of high ticks, and number of low ticks. For example, looking at Figure 3-6, to generate the bottom waveform, we would have something like the following config:
    the top waveform (SOURCE) would be connected to the source of ticks input on the DAQmx Create Channel (CO Pulse Ticks).vi
    initial delay: 3
    high ticks: 4
    low ticks: 2
    The DAQmx help for DAQmx Create Virtual Channel goes into more detail about these three Create Channel VI's if needed.
    (Just in case anyone references this thread in the future, this discussion is referring to Figure 3-6 of the January 1999 version of the 6601/6602 User Manual available here.)
    Warm regards,
    pBerg

  • Display in a waveform graph

    Hello, I need a solution for the follow problem:
    How can I display a generated pulse train by 'DAQ CREATE VIRTUAL CHANNEL CO PULSE FREQ'. After that that mentioned I have a 'DAQ START TASK' and then 'DAQ CLEAR TASK'. I have no idea, because the DAQ READ is the only function I know which has a adapted output to connect with a waveform graph, but DAQ READ doesn't work . I hope for a fast answer, it's very urgent. THANK YOU VERY MUCH..
    Marco

    Tank you for the tip but I can't really solve the problem. Maybe you can look at the .vi in the attachement and give me a further advice how I can display the pulse in the diagramm.
    Thank you very much
    Marco Speicher
    Attachments:
    generate dig pulse -show in waveform.vi ‏63 KB

  • Convert.To​Byte and logical masks, from VB to LabVIEW

    Hi guys,
    I have to write a VI communicating via RS232 with a microcontroller for a PWM application. A colleague has given me the GUI he has developpd in VB and I would like to integrate it into my LabVIEW programme by converting the VB code into Labview code.  Here's the code:
    Private Sub LoadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loadButton.Click
            Dim bufLen As Integer = 12      // Buffer length
            Dim freq As Integer = 0      // frequency
            Dim pWidth As Integer = 0      // pulse width
            Dim dac As Integer = 0       // Value used in oscillator setting for generating pulse frequency
            Dim addr As Integer = 0      // Address of the pulse width in the pulse generator.
            Dim rTime As Integer = 0      // duration of machining/pulse train in ms.
            Dim returnValue As Byte = 0      // A variable for storing the value returned by the 
                                                           //microcontroller after it receives some data
            Dim buffer(bufLen) As Byte       // creates an array of bytes with 12 cells => buffer size = 8 x12 = 96 bits
    // can you explain a bit please I know you're converting the entered values into byte and put them one by one in a specific order. This order is how the 
    //microcontroller expects them
                addr = (Floor((pWidth - Tinh) / Tinc)) // Formula from hardware, calculates address setting for pulse generator to set pulse width.
                buffer(0) = Convert.ToByte(Floor(3.322 * (Log10(freq / 1039)))) // Caluclates OCT value for use in setting oscillator for pulse freq.
                dac = (Round(2048 - ((2078 * (2 ^ (10 + buffer(0)))) / freq)))  // Calculates DAC value for use in setting oscillator for pulse freq.
                buffer(1) = Convert.ToByte((dac And &HF00) >> 8)                         //
    // &H is the vb.net to tell it its hex code, F00 gives the top 4 bits from a 12 bit value.
                buffer(2) = Convert.ToByte(dac And &HFF) // For values that are larger than 256 (8bits) the value needs to be split across 2 bytes (16 bits) this gets the //bottom 8 bits.  &H is the vb.net to tell it its Hex.
                buffer(3) = Convert.ToByte((addr And &HFF0000) >> 16) // This value may be so large it requires 3 bytes (24bits). This gets the top 8 bits.
                buffer(4) = Convert.ToByte((addr And &HFF00) >> 8) // This gets the middle 8 bits.
                buffer(5) = Convert.ToByte(addr And &HFF)// This gets the bottom 8 bits.
                buffer(6) = Convert.ToByte((rTime And &HFF0000) >> 16) //This value may also be 3 bytes long.
                buffer(7) = Convert.ToByte((rTime And &HFF00) >> 8)
                buffer(8) = Convert.ToByte(rTime And &HFF)
                buffer(9) = Convert.ToByte(2.56 * ocpBox.Value)  // The ocp pulse period is formed of 256 steps or counts, so if a percentage is requested, this formula gives the number of steps/counts required to set the pulse width
                buffer(10) = Convert.ToByte(tempBox.Value)
                If (tempCheck.Checked = True) Then
                    buffer(11) = 1
                Else
                    buffer(11) = 0
                End If
                freq = ((2 ^ buffer(0)) * (2078 / (2 - (dac / 1024))))
                pWidth = Tinh + ((((Convert.ToInt32(buffer(3))) << 16) Or ((Convert.ToInt32(buffer(4))) << 8) Or (Convert.ToInt32(buffer(5)))) * Tinc)
                ' Connect to device
                serialPort1.Write(1) // Sends the number 1. This tells the microcontroller we are about to start sending data. It should respond with a zero if it is ready 
                                             //and the connection is good.
    The line "serialPort1.Write(buffer, 0, bufLen)" sends the buffered data where the variables are: buffer =  the buffered data; 0 = the position in the buffer to start from; bufLen = the position in the buffer to stop sending data.
    What's the best way to deal with the Convert.ToBytes and the logical masks And ??
    Thanks in advance for your time and consideration,
    regards
    Alex
    Solved!
    Go to Solution.

    Try this
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • Syncronizing based on CO, retriggerable

    I would like to synchronize AI, AO and DO finite tasks that are retriggerable based on a CO pulse train.  I have set up a CO Pulse Freq task to run off ctr3 of my 9178 chassis.  The rising edge triggers the AO to start, the falling edge triggers the AI and DO to start.  Provided these finite tasks are short enough they should be retriggerable, thus each time my CO sends a pulse they should restart. 
    Having trouble making this work, get an error that the AI task is not retriggerable (using 9222).  Can anyone provide guidelines on how to set such a scheme up?
    Gracias.
    Solved!
    Go to Solution.

    Hello Telleurium, 
    The error you are getting is expected because the 9222 does not support retriggerable tasks, but the onboard counters of the 9178 are retriggerable. I suggest you make the CO Pulse Freq Output a finite generation, set up a trigger for this task, set it to retrigger, and use it as the sample clock for the AI, AO, and DO. This will allow you to create a retriggerable  AI, AO, and DO based on the ct3 of your 9178 chassis. Examples of what I mentioned above can be found in the many locations. Here are a few to get you started.
    https://decibel.ni.com/content/docs/DOC-6801
    https://decibel.ni.com/content/docs/DOC-14581
    https://decibel.ni.com/content/docs/DOC-4131
    Best Regards,
    Izzy O.
    Applications Engineer
    National Instruments
    www.ni.com/support

  • When using counter 0 output, counter 1 goes to high state

    I'm using a PCI-6229 DAQ card with LabView 7.1.  Running the pulse generation example VI called "Gen Dig Pulse Train-Finite.vi" (located in the Counter\Generate Pulse library), I noticed the following anomaly. 
    If you select dev1/ctr0 as the specifed counter for the DAQmx Create Virtual Channel CO Pulse Freq VI, and also select a given frequency, idle state, duty cycle, and number of pulses, the output on counter 0 (pin2) will indeed output the correct pulse train.  However, during this pulse train, the output on counter 1 (pin 40) goes high.  This also occurs vice versa (if dev1/ctr1 is selected, counter 0 output goes high during the pulse train on counter 1 output).
    Thus, it appears the counter outputs cannot be used simultaneously.  If one is used to generate a pulse train, the other will go high and vice versa.  Is this by design?  Is there a way to get around it?  I can't find anything in the literature. 

    What you see is in the nature of how DAQmx manages finite pulse train generation.  It actually uses 2 counters, where one of them is used to generate a single, hardware-timed "gating pulse" which controls how long the other counter's pulse train is generated, thereby also controlling the # of pulses generated.  As an experiment, try performing continuous pulse train generation -- you'll see that the other counter no longer sends its output high.
    Workarounds?  That depends.  I'm not near LV or hardware to experiment, but I *think* I recall reading a thread one time that discussed how to prevent an output pulse from being routed out to the terminal block pin.  However, I'm not sure if that same technique would allow you to suppress the gating pulse in a finite pulse train generation.  Ah yes, here's that posting. 
    If you can't suppress the gating pulse directly via the finite pulsetrain task, there *are* old-school ways to generate finite pulsetrains which should give you the ability to use the linked technique.  You would configure for continuous generation but use the gating counter as a "pause trigger."   You would also generate a single pulse with the gating counter after calculating the exact pulse width needed for the # pulses you want.  After the single pulse task is done, you'd stop the continuous pulse train task.
    -Kevin P.

  • Frequency sweep with DAQmx

    The following is the setup :
    LV7.1 + PCI_6229 + WIN_XP
    For controlling the drive rpm of a servo motor, I need to generate a range of frequencies from 60 to 2500 at 10 Hz intervals.
    With the DAQmx polymorphic VI,  "CO Pulse Freq" , I can generate  a particular frequency.
    But if I have to change it on the fly how do I do it ? Like ideally if
    there was a property node for the polymorphic VI (!) , I could easily
    do it. But it does not have one such node for frequency and hence the
    query.
    Having started the frequency generation at a default value, I would
    like to alter it programmatically without having to stop the VI and
    reload the fresh frequency.
    Any suggestions welcome.
    Thanks
    Raghunathan
    Raghunathan
    LV2012 to Automate Hydraulic Test rigs.

    Hello SG_ENGINEER,
    So that is possible, but it is a completely different approach than that mentioned above.  You would have to use a continuous analog output program and change the output waveform.  Check out the attached example.  I modified a shipping example to do an analog output and increment the frequency of the output waveform. 
    -Alan A.
    Attachments:
    Continuous_Analog_Out_Update_Sinewave.vi ‏100 KB

  • How can we change output pin for counter in X series daq

    hello every one...
    If this question is repeated then forgive me and direct me to that.
    I am using X series DAQ USB-6343. In specific instant i want counter output at specific pin and then agian for other requirement i want it to other pin. plz so me some path. i try to find thing but i was not luck...
    thanks & regards,
    Solved!
    Go to Solution.

    Attached is my example (it provides both methods discussed).  I used a text panel with the same device to count edges on PFI0.  Methodology:
    1) Run Example and export to PFI0.
    2) Stop Example
    3) Change output terminal to PFI1
    4) Run Example
    Notes:
    For Method 1, I would continue to see counts until I stopped and started the test panel.  Without digging it to deeply it appears as though the route is not released until the edge count timer is stopped.  Stopping and starting this counter stopped the counter from seeing edges on PFI0.
    For Method 2, I stopped seeing edges immediately after stopping the CO Pulse Freq task.
    Hope that helps,
    Dan
    Attachments:
    DiffCounterOPModified.vi ‏23 KB

  • What is the simplest way to toggle the counter terminal when time has elapsed in the Complete PWM Example?

    I have successfully downloaded and executed this: http://www.ni.com/white-paper/2991/en
    and I know it works because I can see the pulse train on channel #1 on my osciloscope. 
    I have modified the sample code from the website to use pulse width and frequency knobs that may change dynamically:
    What I would like to do is toggle the "Dev1/ctr1" to "Dev1/ctr0" every 10 seconds.  I have investigated into the "Elapsed Time" express vi and I am able to successfully count the number of times the time has elapsed, however when 10 seconds have gone by I cannot simply update toggle input to "CO Pulse Freq" with a different counter input because it has already past that object and is busy running in the loop above.  How can I reset the pulse to execute with a different counter input?
    In short, the Elapsed Time express VI works perfectly by itself, but when the time has elapsed how do I force restarting the pulse train with "Dev1/ctr0"?
    Solved!
    Go to Solution.

    assuming you want to toggle control from 1 to 0 and back every ten secs and zeroing out the other channel...index the array to write values to one or the other channel.
    Spoiler (Highlight to read)
    note: if needed...use shift registers to hold onto the last freq/pulse width values for the last channel when toggling to the other. use 'n channel' for multiple counters, concatenate multiple channels on your counter constant
    Spoiler (Highlight to read)
    Attachments:
    toggle.vi ‏47 KB

  • Slow counting(PCI-6601)

    Dear friends
    I wish to count TTL pulses from my device(Avalanche Photo Doide) by using PCI-6601 for a certain time. Thus, I tried to use "Measure Period.vi" with "for loop" configuration.
    And the gate frequency from another counter is 100 Hz ( 10 ms time binning). Unfortunately, the acquition time is so slow considering binning time (10 ms).
     We tried to modify this vi and found that the acquisition speed cound be fast when we remove "while loop" with "0" counting. As I know, the "while loop" function is to check  whether arming acutally occurs, which is quite questioning why this kind of function exist even though the control code already do it. 
     Can you guys help me ? ^_^
    P.S. Pulse train has a role to generate gate pulse with 100 Hz.
    Attachments:
    SPM_NI.vi ‏98 KB

    Hi yatintyagi,
    This VI has two tasks, one for edge counting and one for pulse generation. When doing Edge Counting the task counts the rising or falling edge of your input signal using a counter channel. The read VI is reading the value of the counter task. In this case a Buffered Edge Counting is performed, so the actual count will be updated with every edge of the sample clock. I think the image on the Edge Counting of the LabVIEW Help might be really helpful, you can also find it here. The counter output task is generating a signal that is defined by the frequency and duty cycle specified in the “Create Channel – Co Pulse Freq” VI. This pulse train generated is used as the sample clock for the Edge Counting task. I hope this is helpful,
    Ana P
    National Instruments
    Applications Engineer

  • DAQmx error code -200452

    I cannot find any detailed information on this error code.
    I created a task with 2 counters. One Channel (Fuel_Press_Ctrl) is running at 100hz and the other (TachOut)is at 1000Hz. During the program they work fine. When I try to clear the task I get this error.
    Property: CO.Pulse.Freq
    Channel: TachOut
    I did not have this problem until I added the 2nd channel (TachOut).

    Are you trying to generate two finite pulse trains, or are you trying to generate two continuous pulse trains? Which board are you using?
    If you are doing finite on an MIO board, then you will run into errors because a finite pulse train actually requires both counters.
    "Finite pulse trains are produced in the same manner as continuous pulse trains, except that the counter is gated so that the gate is high for exactly the length of time it takes to generate the required number of pulses, then the gate falls low and no pulses are generated. Finite pulse trains require a second counter"
    Taken from Generating a Pulse Train with a Counter
    However, if you are just doing two continuous pulse trains you shouldn't have a problem from a hardware standpoint.
    Otis
    Training and Certification
    Product Support Engineer
    National Instruments

  • Pwm using counter

    Hi, I'm trying to use pwm on a dc signal to control a buck converter for pv panel. I'm using pxi 6221 chassis. http://zone.ni.com/devzone/cda/tut/p/id/2991 this is an example on ni zone. However I don't understand the circuit. In particular the daqmx vi's. The any help would be great.

    Hey mtronics
    The DAQmx vi's are what are configuring and controlling your hardware.
    The first vi, CO pulse freq, is saying that you want to output a signal prom the counter output on your device at a set frequency and duty cycle.
    The timing vi is then configuring the clock that your task is using. As you have already configured a frequency, this is set to implicit.
    Now that the taskis configured the task is started.
    Within the while loop the write to channel is checking if the duty cycle has changed. If it has it will update the duty cycle to the desired value.
    The task then waits for an error or the user clicks the stop button to exit to while loop and then clear the task. This is to release the resources for any other code to use.
    Hopefully that clears up things for you.
    Matthew Trott
    Applications Engineer
    National Instruments UK
    www.ni.com/ask

  • Easy driver stepper control via digital outputs

    Hi, I have a couple little motors that I'm driving with a Sparkfun easy driver board. The board just takes in pulses, and for each pulse it gets it steps the motor one step. Another digital pin sets the direction. I have attached the VI.
    I have the digital PFI1 on my DAQ connected to the "pulse" terminal on the board, and it steps when you send pulses to the board. However, the DAQ seems to be operating in burst mode. If I set the frequency to 10 Hz, for instance, with a finite number of steps (say, 1000), the motor steps in little bursts rather than continuously moving. I scoped the output of the DAQ, and it does appear to be turning the square wave on and off.
    The pulse chain is initiated by:
    1. CO Pulse Freq, set to 0.5 duty cycle and the specified frequency using ctr1
    2. Implicit timing with finite samples, # of pulses is the number of user provided steps
    3. DAQmx Start Task
    I enter a loop to monitor the progress, which just checks DAQmx Is Task Done every so often and updates a counter.
    What is a better way to do this? Why is the counter operating in burst mode?
    Thanks
    Attachments:
    Stepper2.vi ‏51 KB

    Hm. It appears that Sparkfun has a number of defective units that behave this way. I think my code is actually fine.

  • Pulse count with a 9401 modules (cDAQ-9172 system)

    I'm trying to do a pulse counting by a 9401 module in a cDAQ-9172 system. I have three 9401 modules . One of them is working as a trigger (start-stop count) and the other two  (in slot 5 and 6) are for counting pulses from the 2 meters. It looks like a simple task but my problem is that I am counting always  3 to up to15 pulses less than my reference counter. everything points out to a task in my program is causing a delay. The question is where or what is causing such a wrong counting
    Attachments:
    COOMET Comparison DN80 short.vi ‏737 KB

    First for triggering with cdaq you must use the 9405 or 9406 (for analog triggering or 9401 for digital triggering) module in slot 5 and 6 - look in following link. Signals are routed with the chassis PFI Lines and only available at Slot 5 and 6.
    http://digital.ni.com/public.nsf/allkb/851828B06A20E01B862571DA0005591A?OpenDocument
    http://digital.ni.com/public.nsf/websearch/EFD808DC883F095186257170005A634D?OpenDocument
    Then the other moduls in other slots can be configured with these pins for triggering. When you wants triggering on both edges you can look in following link:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=248456&requireLogin=False
     Best Regards

Maybe you are looking for

  • All music, shows, films etc not showing up in itunes but still on computer

    Hi all - my computer froze sometime in the night - i restarted it and now have lost my library in itunes. It must still be somewhere on the computer i have exactly the same free HD space as before - I also back up to my time capsule. My question is -

  • How do i get my ibook to start up?

    I have had my iBook G4 since about February of '05, and today it just will not start up. It worked fine yesterday, and I turned it off the normal method, so there was nothing out of the ordinary. But this morning when I plugged the adapter into the o

  • Bundles can't contain multiple app packages error

    Hi All, I am building an universal windows application targeting to multiple platforms x86,x64 and ARM. However when i build my project in TFS i get following exception "D:\Builds\22\MDWindowsClient\MDWindowsClient_dev\src\MDWindowsClient\MDWindowsCl

  • Multiple network ports.... options?

    Our Xserve has 4 ethernet ports, but our switch doesn't support the right kind of link aggregation to make use of a fat trunked 4Gb connection to our network. Is there any way I can I make use of these multiple ports to enhance or optimise network tr

  • Mixing down tracks within a GB project

    Hi Guys. Here's a question that I cannot work out (perhaps because it's not possible??) How do you mix down 3 or 4 tracks into one, as we used to do in the days analogue mixing. eg, I have a nearly completed project, but decide to add a string quarte