Generate a synchronized PWM

Hi, I am able to generate (counter out)hi,lo and pwm(f=5,D=%3)using Case statement. But,when I put it inside a while loop that also reading voltage I get a glitch on hi and lo state. And when I switch it to pwm the frequency are not synchronized (different time interval between each frequency)..I Appreciate any idea to fix it?
Attachments:
Sub-PPB-PPM-Ctro.vi ‏190 KB

Hi Alexx,
You can get descriptions of the error in LabVIEW by going to Help >> Explain Error.
Here is what it said for your error:
Error -200279 occurred at an unidentified location
Possible reason(s):
Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.
Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.
Where are you getting this error? I see that in your attached code that you have some subVIs missing.
However, you mentioned another error in your block diagram:
Error -200301 occurred at an unidentified location
Possible reason(s):
Cannot update the Pulse Generation property.
The pulse generation with previous property settings must complete a full cycle before the property can be updated.
I would suggest not having the PWM stuff in a subVI. I'm guessing that you have a while loop in your PWM subVI. So what is happening is your LabVIEW code is entering the PWM subVI and then it stays in the loop. The program will not return from the PWM subVI until the loop inside it stops. This means that the loop in the main program does not execute until the PWM subVI is done. If this takes awhile, you will lose datapoints and get errors from the analog input VI.
Here is what I suggest:
1) put both tasks in the same VI (the top level main VI)
2) have the task setup outside the while loop
3) have both task's continuous stuff (DAQmxRead and the PWM's while loop stuff) inside the same loop
4) then have both stop/clear tasks on the other side of the loop
-Sal

Similar Messages

  • Generate two alternating PWMs with one counter of 6025E

    I am using LabView 6.0.2 with a PCI-6025E card. My requirement are to put out a pwm signal with 250Hz. The problem is, that for example, first a PWM with exact 100 pulses of duty cycle 1% is needed, after that exact 5 pulses of 10% duty cycle. These two PWMs are repetetive without any big pauses between. I tried this with Pulse Train Generation with "Changing Pulse Specs.llb" from the ni libraries, but the PC based on windows is not able, to do the PWM changes in these exact time slots. Note: The second timer of the card is used for another item.

    Unfortunately, you won't be able to do exactly what you want with a single counter. You'll need to use additional hardware. Here are some possibilities:
    1. Analog Output:
    A 1% duty cycle at 250 Hz requires a minimum of 25 kHz update rate, but your 6025E only goes up to 10 kHz. Your board is also limited by having only 1 DMA channel for Data acq buffered operations, and it may already by used by your other counter's operation.
    If you had an analog board with faster output, you could try to create a buffer with 0 V and 5 V values representing the desired finite pulse train. However, if the device you're controlling with PWM requires TTL edges, the rise and fall times of your DAC output may still not be fast enough to fool it.
    2.
    PCI-6601/6602 Counter/Timer:
    You could use two counters from a 6601 to generate the finite pulse trains you describe, but there would need to be a pause between the the two duty cycles. The pause is where your software detects the end of one finite pulse train and reprograms the counters to generate the other one. The pause might likely vary from 10 to 100 or more msec.
    If that variable dead time between pause trains is acceptable, the 6601 is the cheapest solution I know of for today's application. If you need reuse for future apps, you might want to consider the 6602 for double the price, but a bit more than double the capability.
    3. PCI-6533/6534:
    NI's timed digital boards would allow you to define the pulse trains as a one-bit digital pattern that you could generate continuously. I suspect the 6533 would suffice for the app you describe.
    Please double-check these hw suggestions with your local rep before ordering. (S)he'll know more than me about
    your present-day app and potential future needs. Good luck!
    -Kevin P.

  • How to generate Low Width PWM

    Hi all,
    I need to interface this sensor with my LM3S8962 Board.
    According to the datasheet, I will send pules 5uS wide avery time I need to neasure distance, So I'd like to generate a 5uS wide pulse that is periodically repeated every 25mS.
    I tried to do that with two ways but there is no signal on ocsilloscope.
    Did any one know an other way to do that?
    thanks

    The interger part of 0.2 is always zero.
    Configure PWM in project:
    PWM Divider /32
    Configure the node:
    Frequency: 40 Hz
    Duty Cycles Units: PWM Clock Cycles
    Wire an integer constant to EIO node (5us*50MHz/32 = 7.8125 => floor(7.8125) = 7)
    However, SIG on that PING))) is bidirectional, so be patient when building the hardware. You cannot connect that directly to a microcontroller pin without using Inline C Nodes (in LabVIEW you have GPIO in, GPIO out, PWM, which is output, but no option for in/out)
    You don't need the Timed Loop to make the signal.
    Message Edited by NicB on 09-26-2009 11:45 AM

  • Generate PWM signal with 6602 utilizing load cell feedback

    Hi Everyone,
    I am new to LabVIEW so I apologize if this question is elementary but I really need some help with the coding. First of all, I need to generate 8 independent PWM signals to control 8 separate linear acuators using the NI 6602 board. I have each actuator wired to their own COUNTER OUT pins and ground on the SCB-68 that is connected to the 6602. The specs for the actuators state that it will take an input of "RC input range of 1.00 to 2.00msec pulse widths @ 55Hz. Bandwidth=.44to160Hz. Period from 6-23  msec". How can I code for these PWM signals given the specs from the manufacturer?
    In the end I need to be able to not only control these actuators based upon duty cycle, but based upon the load each actuator is applying. Each actuator has a load cell in series measuring the tensile force through the load cell (the actuators will be pulling on strings). Each load cell is wired to a NI 9237 in a NI 9074 block that is connected via USB to the same computer. So first comes first, how can I code for the load cell output to be brought into the LabVIEW environment?
    My last question is pulling this all together. How can I code so that I can input a specified load into LabVIEW and then based upon the value the load cell is reading, the duty cycle of the PWM will be adjusted until the the desired load is achieved?
    Thanks in advance for any help! Also, I know that this is quite a complex questions so if you can even point me in the direction of resources that would be helpful, I would greatly appreciate that too!
    Thanks,
    Ryan

    Hello Ryan,
    Here's a tutorial on generating PWM with LabVIEW:
    http://zone.ni.com/devzone/cda/tut/p/id/2991
    How are the load cells outputting the data? Is it an analog signal? If so, you can read that in using an analog input task, and run that in parallel with the PWM task. Then you can modify the frequency and duty cycle inputs that you're giving you the DAQmx write inside the PWM code based on the analog input. By putting the DAQmx read and the DAQmx write in the same for loop, you can read from one and modify the other at the same time.
    Here's a tutorial that shows a lot of useful information for using DAQmx within LabVIEW:
    http://zone.ni.com/devzone/cda/tut/p/id/2835#toc6
    If you're interested in getting better at LabVIEW in general, NI has some learning materials available here:
    http://www.ni.com/academic/students/learnlabview/
    Let me know if you have any further questions once you've gone through those first two tutorial links.
    Colden

  • Synchronize buffered pwm outputs on Daqmx

    I'm using Daqmx to produce two synchronized pwm outputs.
    The pwm outputs: 
                a) have variable controllable frequecy, and therefore use buffered data as input to daqmx write vi. and also use 'implicit' as input to clock type in timing vi
                b) have their beginning edges synchronized
    The design I use uses two separate tasks to create the signals. The only way I could think of of synchronizing the pulses was by putting the 'start vi' and 'write vi' in two different sequential frames. The idea doesn't seem to work, the two pulses somehow drift apart on the oscilloscope. Even the start part does not work; there seems to be a delay.
    Since I'm not using any clock to generate the signals (implicit), how can the two pulses be synchronized?

    Hello lvuser111
    You may take a look to this community example, it could give you a good idea how it may be implemented:
    Synchronize Two Counter Output Tasks Using a Dummy AI Task
    Regards
    Mart G

  • How to use Counter/ti​mer PWM Pulse as a trigger to aquire data??

    I posted this question on the Counter/timer BOARD, but i got no replies. So i decided to post it here.
    (1) I'm using the NI DAQpad 6015 multi-function card with the DAQmx Driver. I'm using the counter/timer (counter 0, and counter 1) to generate 2 different PWM pulses to supply my sensor circuit. each pulse is a 1 second in duration. The pulse with 5m.sec duty cycle is the supply for my sensor. (Imanaged to generate the required pulses). 
    In addition to that  I'd like to use the 5 m.sec as a trigger to aquire the sensor reading. The DETECTIN POINT should be the middle of the HIGH State of the 5m.sec pulse (i.e just after the 2.5 m.sec point of the high state). Detection takes place only at the HIGH State of the pulse. How Can i read my sensor voltage for this limited duaration (2.5 m.sec) each time the pulse is high.
    (2) another point is: how to display the counter/timer pwm output pulses on the front pannel?? 
    Attached is the VI i'm using (Complete PWM.vi), and the pulses diagram
    regards,
    Attachments:
    Complete PWM.vi ‏49 KB
    pulse.JPG ‏10 KB

    This question has been replied to on this other post.
    Thank you,
    Raajit L
    National Instruments

  • How to use Counter/timer PWM Pulse as a trigger to aquire data??

    (1) I'm using the NI DAQpad 6015 multi-function card with the new DAQmx Driver. I'm using the counter/timer (counter 0, and counter 1) to generate 2 different PWM pulses to supply my sensor circuit. each pulse is a 1 second in duration. The pulse with 5m.sec duty cycle is the supply for my sensor. In addition to that, I'd like to use the 5 m.sec as a trigger to aquire the sensor reading. The DETECTIN POINT should be the middle of the HIGH State of the 5m.sec pulse (i.e just at the 2.5 m.sec point of the high state).  
    (2) another point is: how to display the counter/timer pwm output pulses on the front pannel?? 
    Attached is the VI i'm using (Complete PWM.vi)
    regards,
    Attachments:
    Complete PWM.vi ‏49 KB

    Hello alaali,
    It sounds like what you need is a trigger delay property node.  This property node specifies an amount of time to wait after the Start Trigger is received before acquiring or generating the first sample. This value is in the units you specify with Start.DelayUnits.  This way you can still acquire using the trigger, and you can specify the delay to be 2.5 ms so that the point that you actually acquire will be 2.5 ms after the trigger.
    Hope this helps.
    Regards,Message Edited by Raajit L on 04-23-2007 04:34 PM
    Raajit L
    National Instruments
    Attachments:
    DAQmx Trigger Delay.jpg ‏6 KB

  • Synchronous JDBC scenario

    Hi All,
    The scenario is
    SAP Portal will send data to XI using web service(SOAP Adapter) and then XI will post data in Database using JDBC adapter.
    When above scenario executes it is automatically creating response (Synchronous) once it post data in Database (New message in SXI_MONITOR). I have checked message interface both inbound and outbound are asynchronous. When I ran the same scenario using file adapter instead of SAP portal it is not creating new message.
    Please guide how to avoid creating new message in case of SAP Portal .

    Hi,
    The jdbc response is generated in synchronous cases.
    Make sure the webservice call that you are making is asynchronous.
    In case of file adapter the call you made was asynchronous, hence no response was generated.
    Check this blog for configuration for Capturing response message.
    /people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step
    - Deepak

  • Générer un pwm avec NI9474

    Bonjour à toutes et à tous!
    Je souhaiterais créer un pwm avec un rapport cyclique modifiable en tout temps avec un NI 9474 sans utiliser le mode scan engine...
    Est-ce possible ?
    Si oui pourriez-vous m'indiquer s'il existe un exemple ou si vous pouviez m'expliquer comment faire...
    Et si quelqu'un a déjà réaliser une telle application, un exemple sous la main, je suis preneur...
    Merci et bonne journée.

    Bonjour Luc,
    Il est possible de créer un PWM avec en passant par la chip FPGA de controlleur. Ici un exemple (a modifier):
    Generate multiple offset PWM outputs for FPGA
    https://decibel.ni.com/content/docs/DOC-18000
    Il suffit de remplacer les parties du VI annotées " a remplacer" par les sorties de votre cartes (et, eventuellement, l'entree de trigger s'il y en a une) et de définir les temps haut et bas depuis le VI RT (il existe une propriété FPGA pour changer la valeur d'un control du VI FPGA).
    Avez-vous déjà travaillé avec LabVIEW FPGA? Dans quel chassis votre carte est-elle insérée?
    Cordialement
    Florian Abry
    Application Engineer Group Leader
    NI Germany

  • Pwm labview using NI USB 6251

    Hello I´m new in LabVIEW
    I would like to generate 3 PWM signals using NI USB 6251, but I have only 2 counters..
    I use the example of LabVIEW of this link http://www.ni.com/tutorial/2991/en/
    but how can I generate the other pwm?
    Besides I need to generate a specific number of pulses like 10
    How can I do that? and how can I show the pulse in a waveform
    Thanks!

    Hi ZelDrums,
    sounds like you bought the wrong DAQ hardware for your task!
    Which frequencies are we talking about? For low frequencies you could use software timing to generate a PWM: switch on/off a digital output pin with some delay in between…
    Besides I need to generate a specific number of pulses like 10 How can I do that?
    Well, generate a signal (aka waveform) consisting of your ten pulses. There are a lot of signal generation functions!
    and how can I show the pulse in a waveform
    Please use proper LabVIEW terms. You probably want to show your signal (aka waveform) in a chart or graph: just wire your waveform to an indicator of your choice!

  • PWM on USB 6008

    I want to generate 50 Hz PWM wave on USB 6008.
    How can i do it?
    Elad

    To create a pulse train output with the USB-6008/9, you will have to write a series of high and low values to one of the digital lines.  The digital lines on the USB-6008/9 are all software timed, so you will have to control the timing in software (LabVIEW presumably) in a loop with a wait function.  Take a look at the digital output examples in LabVIEW.  Go to Help>>Find Examples, then navigate to Hardware Input and Output>>DAQmx>>Digital Generation, then perhaps an example like "Write Dig Chan.vi".
    Hope this helps.
    -Alan A.

  • Synchronizing counters output using NI9401

    Hi,
    I'm using cDAQ9174 and NI9401; I need to generate two synchronized square waves (using two counters). The two waves could have different frequencies (from 500Hz to 7KHz) and duty cycles, but I need they start at the same time (first rising edge together). Is there a way to synchronize the two tasks? I would prefer without using an external trigger.
    Thank you in advance for the answers 

    Hello Domcar,
     I think the best way to synchronize your two counter outputs would be to use a dummy task as shown in the following link. Could you please take a look?
    Synchronize Two Counter Output Tasks Using a Dummy AI Task
    https://decibel.ni.com/content/docs/DOC-11755
    Regards,
    Antonios

  • Generating 2 clocks with different phase using PXIe-6674T ??

    Hi,
    is it possible to generate 2 clocks (same frequency) with different phase using PXIe-6674T ?
    regards,
    Yan.

    hi,
    somehow i cant use the daqmx digital counter to generate nice 10MHz pulse train with my pxi 6733.
    The option now I can use my timing module pxie 6674T to have base clock 40MHz, and then using divisor 1 and 2  I can generate 2 synchronized clock in PFI0 and PFI1.
    Then I use function connect terminal to connect Oscillator and PXI_Clock_10 to get my pxi chassis synchronized with my timing module.
    Then I use pxi clock as reference to generate my digital signal with pxie 6544.
    Somehow, my generated signals; clock from timing module, pxi clock from backplane and digital signal from pxie 6544 are not synchronized. The phase difference keeps changing.
    I dont see any Init.vi while working with pxie 6674T. I'm assuming I can simply connecting clocks and triggers through RTSI bus, then generate my digital signal with 6544.
    I need help to have 10Mhz from 6674T and another 10Mhz from 6544 with 1/4 phase difference between them, which should be stable all the time.

  • How I use 2 AI with 1 AO in the same program without hardware errors?

    I have a machine with a Motor (velocity controled with PWM), a Strain Gauge, and a Encoder (inner the motor). This machine is controled with a LabVIEW 6.1 program in a computer with Intel Celeron 1.5Gb 360 Mb RAM and DAQ 6024E.
    In my program I have two AI Adquisition Waveform blocks with AI different ranged Channel (the firts in my Strain Gauge ranged -9 to +9 V) and the second in my encoder ranged 0 to +5 V), and one AO Generate Waveform (the PWM signal ranged 0 to +5 V). When I put on the program, the motor Glitches an my computer turns slow. It´s cause me problems!
    Whats the problem?

    You would probably get more info on this in the DAQ Discussion Forums, but I can help you out a bit here. The VIs that you are using are very high level VIs so there is a lot going on behind the scenes that you do not see. More importantly, they are synchronous, meaning that you have to wait until they're finished to do anything else. This is probably why your computer is slowing down. The UI may even freeze until you have acquired all the points you requested. I would suggest using the more advanced DAQ VIs to control your system. There are many examples that ship with LabVIEW which demonstrate how to use these. They allow you to build an asynchronous acquisition system so that other tasks may operate while the DAQ board is acquiring data.
    J.R. Allen

  • Frequency divide by N doesn't work on Counter-Ti​mer PCI-6602

    Hello everybody,
    I tried to do something basic ( ?) with this Counter-Timer 6602 Board, and it doesn’t work.
    So I hope some people with more experience than me could understand what happens here.
    1) What I need:
    I need to generate 4 synchonised clocks, whose periods will be multiple of 1 ms.
    2) What I have:
    LabVIEW 7.0 and a PCI-6602 Counter-Timer Board in a DELL PC running under XP pro.
    The PCI-6602 Counter-Timer Board has 8 counter timers named CTR 0, CTR 1, ... CTR7.
    3) What I have already done, and that worked:
    - Generate a 1 kHz “Master Clock” signal from CTR 4, configured by “Continuous Pulse Generator Config.vi” (found in “Data Acquisition, Counters...).
    - configure CTR 0 and CTR 1 to work as frequency dividers, by use of “Down Counter or Divider Config.vi”.
    - Apply the output signal of CTR 4 (OUT ) to the SOURCE inputs of CTR 0 and CTR 1 by means of physical wiring in the SCB-68 connection box.
    When I do this, I get two nice secondary clock signals on my oscilloscope screen, ( with periods = 3 ms, or 5 ms or whatever multiples of 1 ms I choose) from CTR 0 and CTR 1 outputs , very clean and perfectly in phase with the 1 kHz Master Clock.
    So far, so good...
    But I still need 2 more secondary clocks...
    One would say: “No problem, do the same trick with two other counters...” Well, not so simple, it seems...
    4) What I tried to do, and that didn’t work:
    When I try to do the same frequency division with any of the remaining counters, (CTR2 to CTR7), the program stops and I get an error “ –10020 : Time base not valid “.
    I can’t figure out what happens here: I thought any counter could be configured to work as a frequency divider, but it seems not to be so, and I am stuck here.
    Has anyone an idea about how to fix this type of problem?
    Attached file: hor_div02New.vi
    Attachments:
    hor_div02New.vi ‏123 KB

    karolik,
    I'm just adding a followup in English. As Marc L. mentioned, the particular vi named "Down Counter or Divider Config" isn't compatible with the 6602. While the 6602 does have the ability to generate 4 synchronized clocks, a different syntax is needed. Here's how I'd do it:
    Traditional NI-DAQ
    1. Configure a continuous pulsetrain on CTR 4. Route its output to, say, RTSI 4. Don't start it yet.
    2. Configure CTR 0,1,2,3 for continuous pulsetrains using RTSI 4 as their "timebase source." Start them.
    3. Start the CTR 4 pulsetrain.
    4. Now CTR's 0-3 should generate separate clocks with synchronized phasing.
    DAQmx
    1. Configure a continuous pulsetrain on CTR 4. Don't start it yet.
    2. Configure CTR 0,1,2,3 for continuous pulsetrains using "Ticks" for units. Use a DAQmx property node (probably Channel property node, but am not 100% sure and don't have a LV PC handy to check) to specify that the "ctr4 internal output" should be used as the timebase. Start them.
    3. Start the CTR 4 pulsetrain.
    4. Now CTR's 0-3 should generate separate clocks with synchronized phasing.
    -Kevin P.

Maybe you are looking for

  • How do I make IE open PDF inside browser and not prompt?

    I am using IE 11, Adobe Reader 11.0.06. When I try to open a PDF inside a browser window (for example this one: http://helpx.adobe.com/dk/pdf/acrobat_reference.pdf) I am prompted to Open, Save or Save As. I want open the document directly without bei

  • Slideshow in iphoto

    how do we reverse the order of pictures in slideshow?

  • SapScript - Output a big letter as "watermark"

    I have a problem with output a big letter as watermark with SapScipt. The letter is much to big. only 2/3 will print. Followig sequence (roh data, is it PCL?) arrive the printer (behind SapScript): IN02GROSSBST                                        

  • How do I get my iPad to print from my home printer

    How do I get my iPad to print on my home printer?

  • URGENT -  Included texts with duplicate names!

    Let me explain a bit.  We just had our orders flip to the 500K range.  The problem is that our intercompany stock transfers also lie in the 500K range.  What is happening is all of the included header text, on orders/deliveries, are displayed by an i