spacetoon34 Posted March 9, 2007 Report Share Posted March 9, 2007 I am wondered if labview can operate with loop as for and while with time in micro seconds I tried to make a program that control a servo motor HS311 that needs a train of pulses to control its position The pulse width is between 0.9 to 2.1 ms and i can not output a signal with 0.1 ms = 100 us, it only output 1 ,2 ms How I Can ????? Please help I attach a file to help to understand or solve my problem Quote Link to comment
Eugen Graf Posted March 9, 2007 Report Share Posted March 9, 2007 I want to know it too. If you change your wating from 1 ms multiple to 0, the loop will iterate much more fast, but your CPU load goes to 100%. Why LV doesn't have an NOP operator? Eugen Quote Link to comment
AnalogKid2DigitalMan Posted March 9, 2007 Report Share Posted March 9, 2007 Presuming you are running under a Windows OS, such timing cannot be achieved in software. There is just too much overhead from the OS, in addition when another process takes prioirity over your vi, timing will become slower and unpredictable. You could look at timed loops though, but performance may not be up to your requirements. You need a hardware solution- a DAQ card with counters/timers to get short duration and accurate pulse trains with adjustable duty cycles. Or possibly LabVIEW RealTime (RT). Another alternative, since you are attempting motion control is to get a dedicated motion control card. Quote Link to comment
rafa Posted March 9, 2007 Report Share Posted March 9, 2007 You can make an "active wait" for microseconds (or less) in windows using the functions QueryPermormanceCounter() and QueryPerformanceFrecuency() in kernel32.dll, see MSDN and Call Library Function Node. (This is published in this book, chapter 12, in spanish). Quote Link to comment
crelf Posted March 9, 2007 Report Share Posted March 9, 2007 QUOTE(rafa @ Mar 9 2007, 03:05 AM) You can make an "active wait" for microseconds (or less) in windows using the functions QueryPermormanceCounter() and QueryPerformanceFrecuency() in kernel32.dll, see MSDN and Call Library Function Node. The term you need to research is "determinsim" - Windows is not determisitic at the microsecond level. Quote Link to comment
LAVA 1.0 Content Posted March 9, 2007 Report Share Posted March 9, 2007 QUOTE(spacetoon34 @ Mar 8 2007, 02:09 PM) I am wondered if labview can operate with loop as for and while with time in micro secondsI tried to make a program that control a servo motor HS311 that needs a train of pulses to control its position The pulse width is between 0.9 to 2.1 ms and i can not output a signal with 0.1 ms = 100 us, it only output 1 ,2 ms How I Can ????? Please help I attach a file to help to understand or solve my problem If you have got an RT-System, then you have the micro seconds available for the timed loop... Quote Link to comment
Eugen Graf Posted March 18, 2007 Report Share Posted March 18, 2007 I knew of them what you wrote, but why Windows don't give a NOP functionality, how in uCs. I don't want to wait any determenistic time, but less than 1 ms without 100% CPU load. Eugen Should I ask Bill Gates? :thumbup: Quote Link to comment
Sparc Posted March 20, 2007 Report Share Posted March 20, 2007 QUOTE(Eugen Graf @ Mar 16 2007, 03:28 PM) I knew of them what you wrote, but why Windows don't give a NOP functionality, how in uCs. I don't want to wait any determenistic time, but less than 1 ms without 100% CPU load.Eugen Should I ask Bill Gates? :thumbup: A NOP would still give you 100% cpu load since all it does is increment the program counter and eats up exactly one clock/instruction cycle. A loop of NOPs would indicate 100% cpu usage. It always has. If you want NOP functionality, you need to use rafa's idea of an active wait, cause thats all NOP ever did. What you want is a thread Sleep with more than 1 mS resolution (Want to me to break out my grouchy old man voice and tell you that not long ago the best we could hope for was 15 mS resolution?). As others have stated, Microsoft's Desktop OSs don't offer that resolution for a multitude of reasons, the most fundamental being you don't need it for an OS designed to be operated by humans. If you only get 100% usage while talking to your hardware and you don't have it pegged for hours on end, I wouldn't worry about it too much. But if you're hung up on it here's how you can reduce it. Run your little loop without any delay for 999 iterations. And on iteration 1000, add a 1 mS delay. Rinse. Repeat. It'd be smarter to add that little delay at some non-critical moment instead of a fixed 1000 iterations, but hopefully you get the idea. Better yet, check and see if your [wiki]DAQ[/wiki] card has any buffer memory where you can write a waveform. Quote Link to comment
crelf Posted March 20, 2007 Report Share Posted March 20, 2007 QUOTE(Eugen Graf @ Mar 17 2007, 09:28 AM) I don't want to wait any determenistic time... I think you need to look at the definition of determinsim - what you're asking for sure sounds like determinism to me: a timeslice with an acceptable jitter. Quote Link to comment
Eugen Graf Posted March 20, 2007 Report Share Posted March 20, 2007 QUOTE(crelf @ Mar 19 2007, 12:58 PM) I think you need to look at the definition of determinsim - what you're asking for sure sounds like determinism to me: a timeslice with an acceptable jitter. I opine not any time items, I want only unload CPU for some processor-ticks. Nothing with determinism. Eugen Quote Link to comment
Mike Ashe Posted March 20, 2007 Report Share Posted March 20, 2007 QUOTE(crelf @ Mar 8 2007, 12:23 PM) The term you need to research is "determinsim" - Windows is not determisitic at the microsecond level.Not in the normal "User Mode", also known as Ring 3 priority. Spacetoon, your best bet is ti use a hardware card with a counter and then trigger off the HW clock, perhaps using [wiki]DAQ[/wiki] Occurences. What you ask for, a software accessable submillisecond timer, is possible under Windows, and you can even make it deterministic, but to do so you have to write a Kernel Mode (Ring 0) device driver, (these used to be called Virtual Device Drivers, or VxDs) then access that driver through another Windoes DLL, then access the DLL through either a Call Library Node or an Occurence hooked to the DLL.None of this is for the timid. It is a black magic, alchemy type of programming that is guaranteed to introduce you to the BSOD. Take the easy way and use a cheap timer card & HW timer. Quote Link to comment
crelf Posted March 20, 2007 Report Share Posted March 20, 2007 QUOTE(Mike Ashe @ Mar 20 2007, 12:52 AM) ...guaranteed to introduce you to the BSOD. Speaking of which, check out this evil screen saver... Leave it going for a few minutes - it's a cracker http://forums.lavag.org/index.php?act=attach&type=post&id=5237''>http://forums.lavag.org/index.php?act=attach&type=post&id=5237'>http://forums.lavag.org/index.php?act=attach&type=post&id=5237 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.