Jump to content

egraham

Members
  • Posts

    41
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by egraham

  1. That's one idea. However, I'm still starting and stopping tasks to accomplish this. I'm using an old SCXI system for all analog measurements - thermocouples, 4-wire RTDs, current inputs. I average measured samples to increase accuracy, especially on the 4-wire RTDs. The RTDs happen to be connected to a mechanically multiplexed module. The NI manual suggests scanning multiple samples from one channel before switching to the next channel to avoid wearing out the mechanical multiplexer. The channel switching is actually audible. Imagine switching a mechanical multiplexer 100 times/second - it would wear out quickly. I've seen this recommended scanning method mentioned multiple times in NI documentation, but there doesn't seem to be any obvious and convenient way to implement it using channels configured in MAX without starting/stopping tasks. I'm just hoping I'm missing something. Maybe this is further incentive to stop using MAX...
  2. I saved the edited version in 8.5 and attached. A queued state machine could work for what you're doing, but might be more than you want to look into right now. If you're really going to use the timeout event like that, at least wire a number other than zero to it. That prevents it from eating up as much CPU by limiting how often it executes. Keep in mind that making your application work this way is something you should consider changing in the future as it's not considered best practice. I added a clear button and a corresponding event case that writes zeros to all your indicators. After a loop executes data is written to the shift register on the right side of a loop then that data becomes available on the next loop iteration on the left side of the loop. Spend a little bit of time learning about shift registers. I attached an example to show you what happens with shift registers. Watch numeric2 and see how it contains data from the previous loop iteration. State machine description http://zone.ni.com/devzone/cda/tut/p/id/3024 If you want to see some state machines implemented in examples, the CLD sample exams are a good resource for that. https://lumen.ni.com/nicif/us/ekitcldexmprp/content.xhtml rajnew-edit1 8.5.zip shift register example.vi
  3. This is a question I've wondered about for a long time... During continuous acquisition is there an easy way to scan from the same channel multiple times within a task set up in MAX before switching to the next channel? By default, channels within a task are scanned one at a time and this process continues - acquire one point, switch to the next channel, acquire one point, and continue through the list. Where the time relationship between channels is not important, sometimes it makes sense to acquire several samples from one channel before switching to the next. Chapter 4 in the M series user manual discusses this under Multi-Channel Scanning Considerations > Avoid Scanning Faster Than Necessary. Back in September 2009 an NI engineer came up with a workable solution, but you can't use MAX to configure the task because he configures the channels using FOR loops to create a channel for every sample for every channel. http://decibel.ni.com/content/docs/DOC-6901 I've had an application running for a while where I commit the cardinal sin of starting and stopping tasks during acquisition. So rather than have one task in MAX configured with all the channels, I've got multiple tasks, each with one channel configured. This allows me to control how the channels are scanned. I just feel like I'm missing something. There has to be an easier and more efficient way of doing this. Any ideas or experience with this? Eric
  4. You're trying to reset your indicators with your controls? I'm not completely following what it is you're trying to do. I attached your VI with a few edits just to make a few pointers. • One thing you can do to get rid of repeated local variables in your event cases is to put shift registers on your while loop and run the wires through your event at the top of the loop. Then the data in the shift register is available to all your cases and you don't have to create a bunch of locals. • You're using the timeout event with a zero wired to the input. This will continually run the code within it as quickly as possible. You'll find the timeout event in event structures is rarely used. If you want some kind of continuous operation, consider adding a second while loop without an event structure in it. • You can optionally add your controls/indicators to a cluster and save it as a typedef to make it easy to edit and reuse other places in your code. Notice in the events where you are updating indicators, I've instead used the bundle by name function to update specific indicators within the cluster. • I'm not sure why the numeric controls are used as visa commands that are then being written back to their own locals with the output from visa read, but maybe I'm not understanding something about how your program is supposed to function. Try to elaborate on what it is you're tyring to do and I'll see if I can help. Eric rajnew-edit1.zip
  5. Have you tried invoking Run VI on VI insert before invoking Insert VI?
  6. NI has some old code (Version 5) on their website and I can't open up their example in 8.6. Any advice on how to view this in the current version of LV? Even a screenshot of the code would help. http://zone.ni.com/devzone/cda/epd/p/id/158 Thanks for your help.
  7. QUOTE (crelf @ May 6 2008, 04:50 PM) Thanks for the insight crelf. Considering the $500, maybe I'm better off trying to learn a little VB. By the way, did you write a LV book? I was on Amazon a while back and I thought I saw something that could have been written by you. I'm new to the LV community so maybe everyone already knows this.
  8. Hi, it seems topics similar to this one have been brought up several times both here and at the NI forums, but I haven't found an answer yet. Thought I'd try my luck with a new post. Using the Report Generation Toolkit I am saving Excel reports to a folder location named with the current date. All that is required from the user is the click of a front panel button. I'd like to also create a PDF version of the report without any additional requirements from the user. I've got a couple of great tools at my disposal. I'm using Office 2003 and I have PDFMaker 7.0 installed and I can also print to Adobe PDF. I can get as far as prompting the user to choose a name and location for the PDF file, but like I said, I would like this to be automatic. I want the PDF to be named the same and saved in the same location as the Excel file from which it is generated without manually having to do this. The Report Generation Toolkit allows me to call macros in Excel so it seems that if I knew Visual Basic I could control the file name and the save location this way. OR I can use the print report.vi to bring up a save dialog for the PDF file, but I don't know how to automatically choose the file location and save it. If I knew the right command line code, the System Exec.vi might allow me to do this? Given my knowledge this is as far as I can get. Any suggestions? If not, maybe I need to spend some time getting up to speed with Visual Basic.
  9. Yes, it would appear that way, but look at the attached picture from the LV example VI. It is wired in exactly the same way and it works very well like this. So there is something else I'm not seeing. It wouldn't be the first time...
  10. The LabVIEW example "Manual-Automatic Control" uses the PID Advanced function to control a simulated process variable. It allows the user to switch between manual and automatic control of the manipulated variable. When in manual mode, the horizontal slider representing the MV is a control. When in automatic mode the controller takes over and using a local variable the horizontal slider represents the output of the PID controller. I'm trying to do the exact same thing in my VI, but when I enter manual mode the control of the manipulated variable is very erratic. It's almost like the local variable is trying to lock it in place and keep me from moving it. I can get it to work if I disconnect the process variable input to the PID function, but this shouldn't be necessary and obviously something else is wrong that I'm overlooking. The input goes through a mean pt-by-pt function to clean the signal up a bit, but whether or not I remove this doesn't change anything. As far as I can tell, my VI is identical to the LabVIEW example, but it is not behaving the same way. I uploaded a picture and the VI. If anyone could point out what I'm not seeing I would be much obliged. Thanks!
  11. First off I wanted to say thanks to all the support provided by the people in the LabVIEW community. It's great that experienced veterans are willing to help out beginners like me who are trying to get our feet off the ground. Today's questions spawned from creating a VI that allows me to control when I capture single data points from analog inputs and write that data to a streaming data file (TDMS). This VI runs for five seconds, takes data from a simulated DAQmx device, cleans it up, plots it to a chart, continuously writes it to a streaming data file, and also lets me record individual data points versus time. I took the "TDMS - Write data (events)" example and modified it slightly to make it work for me. 1. In the attached VI does it make sense to add a Wait timing function to the loop? If not, it appears the loop runs at the rate set on the DAQmx timing function. If I add a Wait function to the loop it seems that the Wait function overrides the sample clock.Or is the sample clock still running at its set speed and just dumping data to file after every loop iteration? Adding a Wait function seems like it decreases the frequency of the sine wave coming from the simulated device. 2. Buffer – I've read the LV help on how buffer size is determined when the sample mode is set to continuous samples. I created the DAQmx property node to monitor available samples per channel. As long as I don't add a timing function the available samples per channel stays at zero. This is desirable, correct? This tells me that I have more than enough space available in my buffer?? The only problem I worry about with respect to my buffer is when it gets too full? 3. Error signal wiring – because LV is a data flow language, in this case it's important how I wire my error signal so I don't start reading data until I have created the TDMS file. Have I correctly wired my error wire? Data will not be read until after the TDMS file has been created, correct? 4. Is this VI the correct way to accomplish what I'm trying to do – control when I capture a single data point and simultaneously stream the data to file? I want to make the VI as efficient as possible. I want it to do exactly what I need it to do and nothing more. Thanks in advance for all your help. All of you are great.
  12. QUOTE(Aristos Queue @ Jan 17 2008, 09:03 PM) Hey, thanks. I think that will do. I really don't need a stop button on the main loop because for this VI as long as LV is open, the loop should be running. I'm starting to understand event structures. I thought if it existed in a case structure that was never called that it would be ignored. I see that's not the case.By the way, I think I got the inner loop to stop with the stop button. See attached.
  13. Hi, I'm new to LabVIEW and I've been working on this one for hours before coming here for help. I've created a switched start button that generates a dialog before performing an action. If the user selects "yes" it signals a case structure to do something - in this case hold a boolean value true. If the start button is pressed again it turns the boolean indicator off and waits for the start button to be pushed again. In the case that the use selects "no" at the dialog, the switch should reset to default (false) and wait for the switch to be pressed again. I've got the whole thing working except for when the user selects "no". When that happens, the switch resets to default, but then it locks the entire VI. I'm not sure what else to try at this point. I've tried using a local variable instead of an invoke node to reset the switch, but it doesn't help. What perplexes me is it doesn't lock up when the user selects "yes" and then turns the switch off. Any help would be greatly appreciated. Maybe I'm going about this the wrong way?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.