Producer consumer with analog and digital inputs and outputs

Hi everyone,
I am working on a control system program for some practical test work. Currently I am working on the data acuisition component of the Labview program. My architecture is produced-consumer loops with a que. My system will have analog inputs, analog outputs, digital inputs and digital outputs. It's not a time critical sytem, but I would like all of the data acquisition to be synchronised. I have attached my program as it is at the moment. I am having trouble getting all of the data into the que since I have two data types. Also, I'm not sure if i've synchronised the four read/write sequences correctly. I would greatly appreciate if somebody could take a look at my program and give me some advice. Thanks in advance.
Solved!
Go to Solution.
Attachments:
control_v2_DAQ loop.vi ‏46 KB

Robert, the specific error that I get is:
Error -200462 occurred at DAQmx Start Task.vi:6
Possible reason(s):
Generation cannot be started because the output buffer is empty. 
Write data before starting a buffered generation. The following actions can empty the buffer: changing the size of the buffer, unreserving a task, setting the Regeneration Mode property, changing the Sample Mode, or configuring retriggering.
Task Name: Heater testing lab digital outputs
This error occurs at the 'DAQmx write.vi' function. I just want to sent one sample per second, for each channel. I would like the producer and consumer loops to each run once every second.
I have attached part of my code with just the data acquisition and writing. Any help would be greatly appreciated.
Attachments:
control_v2_ML_simple.vi ‏83 KB

Similar Messages

  • Acquire Analog and Digital inputs at the same time with 6025E card

    I have 6025E DAQ card, all the analog channels are used
    up. There are several digital signals, such as flowmeter. Can I acquire both kinds of data at the same time with my 6025E card? Thanks for your help.

    I suggest you search the examples that ship with LV
    Digital
    Find Examples>>>Hardware Input and Output>>>Digital Input and Output>>>8255
    for doing each type of I/O seperately.
    When you have found two examples. Just try to run the two at the rate use need in your final app.
    Post follow-ups Q's here. I am not personally familiar with that deveice so I can not speak from experience.
    I would generally expect that if you sample rate is low (i.e. <10Hz) you maybe happy with the results. If you want to run faster or have the PC do something else at the same time, the timing of the signals form the DIO lines may be suspect.
    So...
    It depends.
    Trying to help,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Can we acquire the Analog input and Digital Input at

    Can we acquire the Analog input and Digital Input at
    the same time? My sensor data include Analog and
    digital signals.

    Hi Chenchen,
    It usually simplifies things greatly if you use analog inputs to monitor both the analog signals AND the digital signals.
    If you abosulutely HAVE to use digital lines, then the answer is, DEPENDS....
    With the correct hardware and depending on how fast you want to collect data and how closely the measurements have to be syncronized in time, it can be done.
    But first, concider using analog inputs to monitor all signals.
    If you need to move forward with both analog and digital acquisitions, then post a new quesion and give us details on the hardware you are using and the other details we will need to advise you.
    Trying to help,
    Ben
    Ben Rayner
    Certified LabVIEW Developer
    www.DSAutomation.com
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel

    I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
    When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Digital input and digital output at the same time

    Hi all
    I have a PCI-6503 board. I have done 2 task that run simultaneously: the first one is port0_16 output and the second one is port2 input.
    I get sometimes (not every times...this is strange...) error-200587 saying:
    'Requested operation could not be performed, because the specified digital lines are either reserved or the device is not present in NI-DAQmx.
    It is possible that these lines are reserved by another task, the device is being used through the Traditional NI-DAQ interface, or the device is being reset. You might also get the error if the specified resource is currently in use by LabVIEW network variables bound to the DAQ Channel, or if the DAQ Channel is being used in any OPC Client software.
    If you are using these lines with another task, wait for the task to complete.  If you are using the device through the Traditional NI-DAQ interface, and you want to use it with NI-DAQmx, reset (initialize) the device using the Traditional NI-DAQ interface. If you are resetting the device, wait for the reset to finish.'
    In the attached VI i have recreated the basic structure of my real VI (the error is present even here of course...).
    How can i do?
    I want to have both digital input and digital output with the same PCI-6503 every single cycle... Is it possible?
    Please help me!!!
    Kind regards.
    I love the smell of napalm in the morning
    Attachments:
    DIO simultaneously error.vi ‏31 KB

    Hello Maverick,
    Did you have any luck with the example Raven sent you?
    In Raven's example, it properly passes the DAQmx task from one SubVI to another to avoid having to open the task again. These errors are likely to occur when you have multiple DAQmx calls in a VI that call the same task again without clearing the previously opened task. If at any given time you try to open a task that already is being used, you might receive an error "resource is reserved"... similar to your original example.
    If you are interested, here is an awesome link that gives a detailed explanation of the LabVIEW dataflow paradigm
    Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications
    Thanks and good luck!
    Jordan Randall
    National Instruments Italy

  • Can you perform simultaneous timed digital input and output using a PCI-6120?

    Is it possible to do simultaneous timed digital input and output using a PCI-6120? It seems that timed digital operations require using the group read/write commands, which utilize an entire port. Since the PCI-6120 has only 1 digital I/O port, I would like to be able to use 2 lines as outputs and 1 line as input, and do both in a deterministic fashion. i.e. create a digital signal with known pulse widths and read an input line at a known time after the outputs were set. Is this possible to do with only one digital I/O port?

    Hello,
    This can be done in LabVIEW. There is actually an example that installs with NI-DAQ.
    Below is a link to a Knowledge Base that explains how to find the correlated digital I/O examples.
    http://digital.ni.com/public.nsf/websearch/B849664604EB34B886256D12005B5520?OpenDocument
    Just take a look at the example titled �Continuous CDIO with external clock (E).vi�
    Best regards,
    Justin Tipton
    National Instruments

  • SCXI 1600 and digital inputs

    Does anyone know whether the SCXI 1600 card can sample digital inputs from say an SCXI digital input card like the SCXI-1162? The manual and specs say so but I can't see how it is done. The user manual is clear on analog inputs - up to 352 for the 200kS/s max rate but it doesn't say anything specific about digital inputs. An article on DEVZone has a brief response to a similar question to mine that says the specified max channel count does not include digital inputs. I can't work out from the specs at what sample rate one could sample digital inputs with the SCXI-1600 card.

    Hello Andrew,
    As it says in the user manual, the SCXI-1600 is built similar to E Series DAQ devices and can control digital I/O SCXI modules. You are probably looking for dynamic characteristics on the digital side of things kind of like sampling rate. The reason it is not specified is that it is static digital I/O meaning that it is software controlled.
    So a reading is taken when called by software. But rest assured that the SCXI-1600 can support your digital module.

  • Cable input and digital input.

    Right now my TV has an Analog Rf input and a Digital RF input.
    I have cable in the analog and a digital air antenna into the other.
    The new TV's I'm looking at don't have the two inputs.  How do I connect the two to the new TV?
    Thanks  Eric

    My tv doesn't have s video, but I feel it should still be an option being there are millions of dvd players still out that use that connection.
    I know of no receiver that switches RF signals so that isn't an option, and in the end its just a switcher which you can get anyway for like 10 to 30 bucks.
    I just find it odd that 5-7 years ago if you got a decent tv it came standard with 2 or 3 antenna inputs and dual tuner PIP. Now the new tvs are supposed to be more high tech and yet come with less options.
    TV has done the same thing as audio, as the technology progressed the experience actually got worse. These new flat screens look cool asthetically and all, but in the end a good CRT tv is still the better display. I own a HD ready crt tv (7 year old hitachi) and a new samsung plasma. The 7 year old tv still looks better than the plasma in picture quality. And it will display any signal I feed it.
    Same with audio, the new MP3 players look cute and hold a lot of music, but are actually a step down in audio quality from CD's.

  • Comparing digital input and output from two different DAQs

    I want to create this program where the digital output lights up LEDs at random and push buttons are the digital input part of another DAQ are pushed. When the correct button is pushed, the score will increase by 1. My code doesn't work though. Can someone point my errors to me? Both the DAQs i'm using are USB-6008 DAQs. thanks
    Attachments:
    Untitled 1.vi ‏41 KB

    Let's start with the digital output
    What is this code all about?
    Do you want only one of the 8 led's to lit randomly or are multiple led's also ok?
    The two possible codes are in attached file SNAG-003.jpg
    Connect the output of the "Scale by power of 2" function or the "Multiply" output directly to the Write DAQmx vi
    I don't understand the purpose of the "Boolean Value" and "Replace subset array" thing, so I skipped it
    Attachments:
    SNAG-002.jpg ‏49 KB
    SNAG-003.jpg ‏22 KB

  • How to switch USB-6008 between digital input and output modes

    Hi I have been following the examples of setting a specific port to either inout or output using the DAQmxCreateDIChan() or DAQmxCreateDOChan() calls. What I now want to do, is switch betwen inout to output mode and back again.
    DAQmxCreateDOChan()
    DAQmxWriteDigitalLines()
    // do something
    //switch to input
    DAQmxReadDigitalU32()
    // switch back to output
    I can't seem to find any calls or discussions on this.
    rjmiller

    Hi RJM,
    If you want to be able to switch your digital line between input and output, then you will need to use the Tristate Property. There is another discussion forum with more detailed information about using this property and I believe that you have already seen it. I am going to post the link in case anyone else wants to see the other forum as well: Tristate Property Discussion Forum. Reddog's post is very informative.
    Regards,
    Hal L.

  • Simultaneous Digital Input and Output from NI 9403

    Hi,
    I was wondering if it is possible to digital output through one line in this module(NI 9403) while simultaneously reading from 10 other lines?
    Basically what I need is for line0 to always be closed(true), and read lines1:10 - at very least 1sample/second.
    I have attached a stripped down version of my code illustrating my error. I thought I was getting the error because the two tasks were using different clock configurations, but I tried using the same inputs and that doesn't work for me.
    Any input is greatly appreciated.
    Thank you
    Attachments:
    Digital I-O.vi ‏22 KB

    Hi Matthew,
    The behavior you're seeing is expected for the 9403 module, since it is a serial module. The DAQmx help has the following restrictions in the Digital I/O Considerations for C Series Devices section.
    Timed digital input/output restrictions:
    You cannot use parallel and serial modules together on the same hardware timed task. 
    You cannot use serial modules for triggering. 
    You cannot do both static and timed tasks at the same time on a single serial module. 
    You can only do hardware timing in one direction at a time on a serial bidirectional module.
    So you can only do timed input or output at one time, but not both. However, based on the VI you attached and the description of what you want to do, you don't necessarily need both timed tasks in your loop. You can create a static output task to update that one line and after that, you can just start your timed input task on the rest of the lines. This should maintain the state on the DO line, since you're not acquiring from it.
    Cheers,
    Cristina
    Cristina

  • I want to sample syncronously an analog and digital channel and write them to file in array.

    I have a PCI-MIO-16XE-10. I am using the AI01 and a DI01 to recieve the signals. I am monitoring and switch and want to know when it comes on in relation to my analog signals when I post process the data so it is important that the signals be synced and placed in the data array. The attatched vi gives some idea of what I want to do. Thank you in advance for help concerning this.
    JML
    Attachments:
    DigitalAnalogSample.vi ‏34 KB

    I am using 6221 same issue i have .
    i need to accuire pulse of train and its simaltanously triggering the AI.
    Issue is while writing this data to an Excel sheet i am missing some data in-between.
    number of pulses are 870 , this count i am getting incermentally in the output of Counter
    i did "build an array" with this AI and Counter data and writing it to file, there i misses data.
    Attached wiring diagram for reference.
    Pls suggest some method to write data to file for every pulses so that i wont miss any data.
    Joe
    Using Ver. 8.0
    Attachments:
    Wiring1.JPG ‏137 KB

  • Analog in digital in and digital out slow ?

    Hi
    6261 PC board used.
    I have 5 analogue channels as input, 2 digital channels as input, one of which is a trigger for the analogue
    sample read. The analogue samples are written to a labview measurement file (.lvm) all this
    is fine and dandy and can read up to about 720 k samples/s.
    But when I try to output the second digital input (the one that isn't a trigger), I do not get an output
    that is related to the input (using an oscillioscope to view input and output). The input shows
    about 5 pulses to the outputs one. Eventually I want to sample the second digital inputm and
    delay it slightly before outputting it, but I want to be confident I will be getting the same number
    of pulses out.
    I even trimmed to vi down just have one dig in, going straight out, and it still didn't match the
    number of pulses.
    I am using DAQmx throughout, could that slow things down (using express DAQ) ?
    any help appreciated,
    sandra

    here is my latest vi, I am still having some problems.
    I created this vi from the 'Gen Dig Pulse.vi' example, I have changed it to
    generate the pulse according to ticks rather than frequency and I have
    added the trigger.
    The source of ticks is a digital pulse from an optical encoder that is sending
    out 360 pulse per revolution of an engine crankshaft, the trigger is from the
    same optical encoder, but it one pulse per revolution. I require the
    output to be of the same frequency as the trigger and delayed by a
    configurable number of ticks.
    The output is ok for up to about 400 revs per minute, but after that the output
    is intermittent and some pulses are lost.
    If anyone can take a look at the vi and advise me on this I would be grateful.
    I have tried leaving only the 'wait until done task' in the loop, but this gave
    no output, I also tried adding an implicit 'timing' task, but this gave to many
    outputs,
    regards,
    Sandra
    Attachments:
    Gen Dig Pulsetickstrigger.vi ‏32 KB

  • Producer Consumer with a state machine within the consumer

        Hi All,
    I have been trying to develop a data acquisition system with the producer consumer architecture.  To the left of the two main loops I initialize the serial port and any constants and variables im using.  I also have an obtain queue VI needed for enqueue and dequeue. Then in the producer loop i have a state machine.  The first state is where I wait for a button press on the front panel to write a GO signal on the serial line which will tell the device connected to the serial port to begin sampling data.  After this button press I go into the next state which is called my read state.
    In the read state I use a property node to read all of the available bytes at the serial port and then enqueue this collected data into a queue.  The state machine then is directed to continously go to the read state again and collect more data.
    Now this is where my dilemma is......  The consumer loop has the dequeue VI inside it and after this VI i have a state machine (while loop and case structure) which contains the following states
    1.  Build Array - build an array from the dequeue element and if there is any left over data from the parsing states it will build an array with the left over data and the dequeued data
    2.  Determine packet type - this state looks for the packet type byte(not necessarily the first byte in the message) and also check the next byte (packet length) to ensure that I am at the begininng of this chunk of data.  This state may be a little slow because there can be three different packet types and based on this byte and the packet length it may have to search the array several time to find the valid starting point.  This state also determine the next state to go to based on the packet type.
    3 packet type 1 parsing - parse data and store the remaining data it leftOver array.  Go to exit state.
    4 packet type 2 parsing - "" ""
    5 packet type 3 parsing - "" ""
    6 exit - leave this state machine and fall back to the consumer while loop.
    After it exit I think it should fall back to the consumer while loop and dequeue more data and enter the state machine again to build a new array with the dequeued data and leftover data.  It seems to work when I trace the execution using the Highlight execution feature, however when I run this all at full speed, it seems to go into the consumers 1st and 2nd states back and forth and not completely go through the state machine.
    I tried adding in a delay in the producer loop to give the consumer loop time, but I didnt notice any difference.  Is it possible that my dequeue element is retreiving more data while im still in the state machine, causing the execution to leave the state machine before it finished all states?
    Is there a better approach to take to solve this problem. Basically I need to read data at a 1,000,000 baudrate and parse it as quickly as possible so that I can break it up into 3 different packet types, write the data to a file, and graph the actual data (header info removed) in realtime.  I need to also ensure that I am not losing any of the collected data.  Data loss cannnot occur.

    A couple of things more to go along with Ben's pointers:
    You convert your data from a string, to a U8 array, to a Hex string array in the producer loop, then convert back to a integer to determine what to do with it.  In the process, you create two or three copies of your data, slowing yourself down quite a bit.  The code would be quite a bit more efficient if you left the data as a U8 array.  You can change the format of the controls and indicators to show hex values instead of integer by right clicking on them and selecting Format and Precision...
    Your search code is fairly inefficient.  I made a whack at making it a bit better.  See attachment below.
    If you continue to run into race conditions, you can debug them using a calls to the Windows debug write sprinkled liberally about your code.  Check out the post here for more information.
    Don't let your lack of format LabVIEW training stop you.  The biggest thing to get is the data flow paradigm (aka data is wires, not registers).  Once you get past that and learn how to pass data around using shift registers, queues, events, etc, you are most of the way to mastering LabVIEW.  The rest is just learning the plethora of functionality LabVIEW gives you (yes, I have reimplemented LabVIEW native code more than once in the process of learning).
    Let us know if you need more help.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    serialUtil_V3_DFG.zip ‏137 KB

  • Don't know how to specify a digital input or output with Port Config

    I am trying to modify an existing VI that I did not write. I have a 6533 DAQ board connected to a relay box. I would like to use one of the lines on port 0 of the DAQ as an input (it will be a switch used to trigger the sequence of outputs). the rest of the lines I would like to be outputs. I don't know how to specify which line is an input and which is an output. I am using LabVIEW 5.1 and the current VI just contains a sequence of delays and pulse width for each channel. It uses Port Config to specify the port and line directions. Only it's set so that all of the lines are outputs. Does anyone know an easy way of using one input to control several outputs from the same port?

    Thanks.. that is what I thought but I didn't see any examples with the line direction map set up like that. SO.. now I'm stuck on how to use that input to trigger the outputs on the same port. I need to use the input as a switch to activate a sequence using the outputs. So first.. how to I single out just the input line to be used for the trigger. Normally when I need to do something like this I'm referring to channels and not Port lines. Also, how do I language the switch? Is the input going to be normally binary? 0 for off and 1 for on? So should I use a boolean statement?
    Thanks again for the help.. my boss doesn't know much about the programming either so I have to figure it out.

Maybe you are looking for

  • Zen Touch sync and display probl

    I left my Touch connected to my PC with WM0 running to convert and transfer tracks to the Touch. When I came back a few hours later the transfer had stopped - incomplete with and error message (didn't make a note of it ). Now my it is not recognised

  • HT3209 How do I cancel a purchase of a rental?

    I rented a movie from Itunes and realized I selected the HD version. Since I want to download more than one I don't want to waste 3gb of space. How can I cancel the download? I just want the SD version.  Any way to do this?

  • I am being told I need a wpa2 password to login to wifi. .

    I am being told I need a wpa2 password to login to wifi.  The business where I am has a strong wifi And I'm using the correct password. Others here are able to log on. Why can't I? Brand new MacBook Air/snow Leopard. Any ideas? Thanks.

  • Unable to view MMS with PC Suite

    WinXP SP2 I can not view MMS text messages using my PC Suite. with windows explorer I can navigate to my inbox and see all of my text messages but no MMS messages, even though they are stored in the inbox. Any help greatly apreciated.

  • HT5132 Aperture and the end of MobileMe

    I have no MobileMe albums, I switched to iCloud and still everytime time Aperture bothers me with "MobileMe has been discontinued" with a choice between "learn more" OR "ok". OK hangs Aperture. Found the answer in the "Preferences", "Web"