Jump to content

DredPirate

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by DredPirate

  1. I am feading a constant complex double (CDB) set to -9+0i into the square root function and displaying the result.
  2. And here is another reason not to use express VIs or LV unit labels. Had to kill LV to stop this VI.
  3. Maybe I'm missing something but I do not beleive LV does the math correctly for complex numbers. Isn't the square root of -9 = to 0+3i? If so why does LV give a result of -8.13152E-20 +3 i? It's close but not correct.
  4. There are 2 items I don't agree with in this presentation. 1. Backround Color. I find it more readable to set the Block Diagram color to a light manila. 2. Error handling. I that LV does a terrible job of Error Handling. To often have I seen LV lock up code with a popup when it recieves an error. If you're not extremely careful you could loss data or worse destroy equipment. Other then that I think thats a great guidline on how to code in LV.
  5. You could also use a local variables or functional (LV2 Style) globals to pass your data within a case structure to your loops. That way you wouldn't need to send a variable out. And would more closely resemble you line baised equvilant.
  6. First, do not use global variables. They make maintenance and debugging a nightmare. Not to mention they are terrible on resources. If you have to use globals then look up LV2 style globals. If your program is structured correctly you should not need them except for a few special cases. Which brings me to number 2. Your main issue seems to be program structure (or lack of). Look up state machines. This is the best way to program in LV. Also make sure your file structure is well defined (do not use LLBs. They strip the file structure and offer nothing in return but bugs. There is a post on this subject.). Look at the program I've provided for an example of how to structure your code and files. Notice the parallel loop for your DAQ. I did this because of the fast update times (X ms) you require. GUI's can be slow especially when you add graphs. Running them in parallel loops can sometimes help keep your critical programs from locking on slower operations. However, try to limit the number of parellel loops in a program and make sure all of your loops stop with the exit button. (BTW
  7. Fist let me say that I solved this puzzle in about an hour. Great program! Lots of fun. You didn't need to impliment a way to clear mistake LV did it for you. Just right click and re-initialize to default it will clear the element you select. Although it doesn't work on the house color.
  8. First let me make some assumtions. It sounds like your doing a simple Back EMF measurement. Your speed control is probably +/-1 RPM. Your using a Brushless Servo motor for your drive. Your diving a Brush type motor. This is for a piece of development equipment (not production or lab). And you have no budget foir this project. Now unless your servo drive provides some sort of velocity feedback you will be stuck buying something. So lets find the cheapest and easiest solution. Seeing as your a newby to LV we will want something simple to measure. Doing a dynamic signal analysis to extract the RPM from the brush commutaion will take to much time for you to program. It can be done without any additional hardware but is tricky even for those of us with experience because you need to know exatcly what to filter. So we want something you don't have to monitor to get the velocity information. First look up analog tachometers. I have not done much research on this but I know they're out there. This would give you the quickest solution. A voltage output that corresponds to a speed. Otherwise, what you need is some device that will give a pulse or pulses for every revoltion (an encoder). Then conect the pulses into a Frequency to Voltage converter (F-V). This will give you a voltage output that corresponds to a velocity. This site has both the F-V and encoder. http://www.usdigital.com/products/etach2/ FYI - This site has great and cheap indutrial grade encoders. http://www.beiied.com/ Another option - You may be able to use one of your DIOs as a counter timer to measure the frequency. This would be the best solution because you would eliminate the need for the F-V. I have never tried this on the M series cards so you would have to experiment with it. This is all the help I can offer at this point so good luck. If you need more info then do a google search first.
  9. You could throw an AB quad encoder on the motor and use a PCI-6602 counter timer to monitor the position output. Then do some math and you get RPM. Or put the encoder output into a frequency to voltage converter and monitor it on the PCI-6221. Or set up the PCI-6602 to monitor frequency off of the encoder. Or set up a curcuit to capture commutator pulses. Or measure the com pulses with the PCI-6221. Or measure the voltage and current and compare that to a performace curve. Or ................. The list goes on and on. The method you choose really depends on your aplication.
  10. First The software is set up to take 4 readings at a time from a standard NI Multifunction DAQ card. To change the number of channels you need to edit the AI Config:physical channels constant on the left side of the screen. Look up Physical Channel Naming Convention in the help menu. I was taught an LV programmer with like 10+ years expereince so I never had to go through the pains of learning on my own. There were some things that helped though. 1. Take a LV training course if you can afford it. Although I do not agree with alot of the practices they teach, it will help get you familiar with the functions and enviroment and more importantly give you the confidence you need to really experiment in LV. (BTW I hope you didn't buy the sales pitch that anyone can program LV. While anyone can do something in LV it takes training and experience to do it well. Like anything elser.) 2. Learn the array functions inside and out. This is the most important function in LV since almost all data is in an array. 3. STATE MACHINES!!! Use this style of programming in LV. The example I provided above is a style of state machine. Walk through it get know how it operates. I personally hate the LV style state machine and most other floating around the net (See KISS). 3. Use the K.I.S.S. (Keep It Simple Stupid) method. If you can do it with a simple array function then do it with a simple array function. Do not use LV qeueing or other complex functions unless they make your program simpler or greatly improve performance. Usually though they add another uneccessary layer of complexity. 4. Search for examples. NI provides some good examples. Pick them apart and figure out how they work. 5. Use the help menu in LV. They offer alot of good resources. 6. Participate in this forum and the NI forum. There is a wealth of knowledge and experience that you will not find anywhere else. (Lava is much better than NI) If you can't find an example in LV than look here. Another thing, post examples of your code and ask for opinions. This is the easiest way to see what your doing right and wrong. For instance if you provided an example of what you tried in this post it would be easier to give you the answers you need. Share what you have learned! I cannot stress this enough. I know more than many of my conterparts because I do share information. Many of them believe they need to keep what they have learned secret to secure there jobs. NOT TRUE. I keep my job by becoming better at it and I become better at it by sharing information. Lastly, check out this website. I only read a little bit but it seemed pretty well done. http://www.upscale.utoronto.ca/GeneralInterest/LabView.html Also I just found this FAQ searching around on LAVA. http://forums.lavausergroup.org/index.php?showtopic=239
  11. Not true for multicolumn listbox. You can set the selection color. See the attached VI. Download File:post-3219-1131731871.vi
  12. No. It seems to work fine. The only undefined string I get is the empty string and only after I delete everything from the combo box. BTW I am using LV7.1.1
  13. First, look up state machines. This is the method of programing used by all LV programmers with any experience. Next I don't know if this is what you're looking for but I created a quick example of what I think you're looking for. Check it out. Download File:post-3219-1130797095.zip
  14. Same here. Dell monitors seem to like 1280X1024. Although, I do use the space. Every computer in or lab is a Dell (they were bought before I arrived) so I don't see a need to reduce the space to 1024X768 for anything but posting. (Sorry for the earlier post at 1280X1024. I will reduce the size in the future). BTW best computer supplier I found for test equipment is Axiom. Industrial Single Board Computer (SBC) with up to 14 PCI slots and resonable price. Never used more than 6 PCI slots but its nice to know its there is I need it. Its really nice when you have one at your desk. You just load it up with NI cards and debug at your desk.
  15. Ok. I know this is an old post but why not create a backdoor that you can use without comprimising security. I developed a password program that generated a text file with the password, date and time, and random key scrambled by a complex formula and labeled the file password.dat. In a seperate file I stored the date and time the file was created. If the password.dat file were deleted it required the user to enter a new password and created a new password.dat file. This way the admin could still get into the program if the password were forgotten but if someone entered the program without the admin's aprovel the admin would know. The date time was used to as a safegaurd against someone copying and pasting the file to get around the security. For even more security I could of labeled the file something other than password.dat but it was going to China and most of the people they were trying to lock out didn't understand english.
  16. Great trick. I've been ripping apart alot of LLBs lately. I can't believe how popular they still are. BTW Mike, thanks and they were ROUS's (Rodents Of Unusual Size). And thanks for the info. Just more ammo for the argument to kill LLBs.
  17. Globals = BAD code in LV Use LV2 style! Do not get into the practice of using globals. There is no need for them. You'll hate yourself when you have to debug your own code. Check out this simple example of an LV2 style global. Launch Master then notice how slave will close when master closes. And master will not close with slave. Basically an LV2 style global is nothing but an uninitialized shift register. If you need more info just search around. There is alot of info on this style of global throughout the web and even on NIs site. Download File:post-3219-1129607862.zip
  18. I was told by an old time LV programer that LLBs were created because of the filename length and character restrictions in DOS. When microsoft increased the filename length, LLBs became useless but were still very popular so NI continued there support. In my past jobs the use of LLBs was looked upon as worse than using globals. Now at my current company LLBs are used exclusively by every LV programmer but me. Am I missing some special features of LLBs. From what I've seen its easier to use Save with Options-Development Distribution-To New Location_ Single Prompt_Preserve Hierarchy to extract the VIs into one folder. Then Zip them for distribtion. (BTW: I think LV 8 will include some sort of Zip functionality.) I hate the fact that LLBs strip the hierarchy. It makes that much harder to debug and modify someone elses code because you have to search through a huge list of Vis to find anything instead of having a useful and desciptive folder hierarchy. Maybe I'm missing something because they still seem to be popular in the LV community.
  19. Well, first of all I did even realize it was there. So I wrote a quick program to see if it was useful. It works well but there are some issues with it. 1) Because I allow the user to zoom in on a graph it requires a large buffer allocation before I do the decimation slowing the program by by about 40%. 2) The decimation takes the Nth element in an array, this is not a good representation of real data. It also averages N elements, again this is not neccessarily the best representation of real. To more acurratly represent real data it would need a Min, Max and AVG point placed in the proper X location. To speed my program I take smaller buffer allocations and use the Min and Max of N elements. (AVG takes to much time). In my opinion any update over 100ms for normal operation is to long because the user will notice a hesitation in the response of FP. Also, I do not like to elimate features the user is already familiar with unless absolutely neccessary. So eliminating zoom is out of the question as long as it is possible to maintain that feature. Anyway if you want to check it out I'll attach the experimental vi here. I think I need to begin a new thread on this topic though. Download File:post-3219-1129603650.vi
  20. Just read the upgrade notes. No mention of improving the graph update rate. Stuck creating a work around for know. There are some useful features in 8 but I think I'll wait fot the 8.1 release.
  21. Check out this site at NI Synchronizing CAN and Anaolog Signals... If you don't like the way there doing it you could always do what I did and extract the information from the *.dbc file like I did. You need to import it as text, figure out how its constructed and then build it into a useful cluster or something. I've included some of the work I did on this. I only read from the CAN bus so I did not extract the information from the *.dbc on writting to the CAN bus. I also created my own buffer so I can easily extract the data. Sorry some of the code is sloppy. This is an old development example. I never really meant for it last longer than that. Also please be offer feadback. Be brutal. Thats the best way to learn. And if you make any improvements I'd love to see them. Enjoy. Download File:post-3219-1129260176.zip
  22. Great examples of bad code so far. But there are times that huge sub vi's are ok. I have a program that scans 100,000 samples per second for 60 seconds over 4 channels and displays all of the data on the graph (well not all of the data as I do a decimation to speed the graph). Every time I pass an array for one VI to another LV allocates memory from windows to make a copy of my data (buffer allocations is the slowest operation in LV after display updates). So I created a huge VI to create a 16 channel FIFO buffer (12 for later updates), aquire the data, and decimate the data. I spent a good deal of time eliminating any buffer allocation I could. It may not be the prettiest thing but its fast. I have included a small example to show just how slow buffer allocations are. Every time you build an array you allocate memory from windows. I should post a new thread on this subject. but here it is anyway. Download File:post-3219-1129256215.vi
  23. 1. Incorporate the decimation feature into the graph and make it user settable. "Fast Data Display with Decimation In many interactive applications, the only thing you want to do with your data is show it to the user. There may be a real reason to display 5 million data points, but this amount of data is far beyond the capabilities of most displays. The average LabVIEW graph is on the order of 300 to 1000 pixels wide. Five million points is three orders of magnitude more than you can actually see on a waveform graph. Data decimation is the answer to this problem. .........." See: http://zone.ni.com/devzone/conceptd.nsf/we...6256E58005D9712 for more information. There is a-lot of useful info there. 2. Create a
×
×
  • Create New...

Important Information

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