Jump to content

looping with constant waiting


joe T

Recommended Posts

Hi,

I'm new to labview so this should be pretty basic stuff...

I'm trying to create a loop with a delay between each iteration:

1. The minimum waiting time between iterations that I could accomplish is 1 ms (The metronom image requires integer mltiples of 1 ms only?). How can I get a faster time between iterations? (Say - 0.1 ms)

2. How do I make sure that the waiting between iterations is not affected by the actions taken during this iteration?

Meaning - if in one iteration, the computer does nothing, I want it to wait exactly the same amount of time as in another iteration, in which it performs many calculations.

Hope I made myself clear,

Thanks

Joe

Link to comment
Hi,

I'm new to labview so this should be pretty basic stuff...

I'm trying to create a loop with a delay between each iteration:

1. The minimum waiting time between iterations that I could accomplish is 1 ms (The metronom image requires integer mltiples of 1 ms only?). How can I get a faster time between iterations? (Say - 0.1 ms)

2. How do I make sure that the waiting between iterations is not affected by the actions taken during this iteration?

Meaning - if in one iteration, the computer does nothing, I want it to wait exactly the same amount of time as in another iteration, in which it performs many calculations.

Hope I made myself clear,

Thanks

Joe

Joe,

It might be important for us to know why you need such an accurate wait between iterations. If this is not just an excersize, then maybe we can help you with the real goal you have in mind.

That metronome is only intended for rough timing and that's why it doesn't go to smaller increments. Data acquisitions are clocked to a "Timebase." The maximum timebase will depend on the hardware you have. For instance my E-series DAQ card has a maximum rate of 1.25MSamples/second. So I could easily take readings at 10kHz, 100KHz and perhaps 1MHz depending on how many channels I need to sample.

It is possible to do custom work at these speeds, but usually we just pull out some application specific vi or function that does it for us. This way we never have to write code that operates that low down in the system. Not that you can't do it, but it would be very untypical.

So tells us what you are up to.

Mike

Link to comment
Joe,

It might be important for us to know why you need such an accurate wait between iterations. If this is not just an excersize, then maybe we can help you with the real goal you have in mind.

That metronome is only intended for rough timing and that's why it doesn't go to smaller increments. Data acquisitions are clocked to a "Timebase." The minimum timebase will depend on the hadware you have. For instance my E-series DAQ card has a maximum rate of 1.25MSample/second. So I could easily take readings at 10kHz, 100KHz and perhaps 1MHz depending on howmany channels I need to sample.

It is possible to do custom work at these speeds, but usually we just pull out some application specific vi or function that does it for us. This way we never have to write code that operates that low down in the system. Not that you can't do it, but it would be very untypical.

So tells us what you are up to.

Mike

Thanks for your reply,

I am activating a laser pointer that is connected to a standard parallel port. The activation is by giving it 5V via the parallel port and then 0 - thus the laser is blinking.

I need it to blink at about 10Khz.. and until now I managed to work at most at 1Khz, as stated in my previous message.

So I guess that a VI that I will need is one that gives one of the data pins of the parallel port the value "1" for 0.1 ms and then "0" for 0.1 ms and so on.

thanks!

Joe

Link to comment
I need it to blink at about 10Khz.. and until now I managed to work at most at 1Khz, as stated in my previous message.

So I guess that a VI that I will need is one that gives one of the data pins of the parallel port the value "1" for 0.1 ms and then "0" for 0.1 ms and so on.

I think you will find it hard to get that performance (10kHz), assuming you are using windows, depending on your pulse requirements. With windows you never really know what is going on in the background.

What you could do is to install a DAQ board, e.g. http://sine.ni.com/nips/cds/view/p/lang/en/nid/202004.

Then you can use the onboard counters to generate the desired pulses, specifying the frequency directly.

If, however, you still like to use the parallel port, a DAQ board can be used as Timing source for the TimedLoop structures, enabling you to get better resolution in the loops.

Good luck!

/J

Link to comment
I am activating a laser pointer that is connected to a standard parallel port. The activation is by giving it 5V via the parallel port and then 0 - thus the laser is blinking.

I agree - you're not going to get 10kHz from windows, as the loop you're using is software timed. You might be able to get a cheap USB-based DAQ device that will do the job here.

Link to comment
I am activating a laser pointer that is connected to a standard parallel port. The activation is by giving it 5V via the parallel port and then 0 - thus the laser is blinking.

I need it to blink at about 10Khz.. and until now I managed to work at most at 1Khz, as stated in my previous message.

So I guess that a VI that I will need is one that gives one of the data pins of the parallel port the value "1" for 0.1 ms and then "0" for 0.1 ms and so on.

Do you need to decide during each loop iteration whether you'll be turning the laser on or off? If so, what you need is labview real-time, so that you can perform computations during each iteration of a timed loop.

On the other hand, if what you need is a relatively slow on-off modulation of a fast blinking laser (with 2 states of "blinking" or "off"), let me suggest the use of a 555 timer circuit in astable mode, controlled by the 555's 'enable' pin. You'd use your parallel port to control the enable pin.

http://en.wikipedia.org/wiki/555_timer_IC

Never underestimate the power of the 555!

Link to comment
Do you need to decide during each loop iteration whether you'll be turning the laser on or off? If so, what you need is labview real-time, so that you can perform computations during each iteration of a timed loop.

On the other hand, if what you need is a relatively slow on-off modulation of a fast blinking laser (with 2 states of "blinking" or "off"), let me suggest the use of a 555 timer circuit in astable mode, controlled by the 555's 'enable' pin. You'd use your parallel port to control the enable pin.

http://en.wikipedia.org/wiki/555_timer_IC

Never underestimate the power of the 555!

I need to decide in each iteration whether it's on or off. This is done by reading from a file that contains 0's and 1's, in some order. 0 means off - 1 means on, so a 555 won't help me there. I also need in each iteration to read back from the parallel port, which has one pin connected to a photodiode circuit. Is Labview Real-time a different software?

Thanks

Joe

Link to comment
Is Labview Real-time a different software?

I would say that it is a different platform and a different software. LabVIEW RT module is a LabVIEW add-on that runs on a Real Time OS called Pharlap.

You can install this RealTime OS on a standard desktop PC, but you have to check your ethernet chipset so that it is supported.

http://zone.ni.com/devzone/cda/tut/p/id/4480

Once the RT OS is installed, you will have access to microsecond resolution in timed loops etc. (you might have to change an ini-file key for this to be enabled on a desktop PC).

You can still try the counter/timer solution under Windows, but it depends on how much jitter you can tolerate.

/J

Link to comment
Is Labview Real-time a different software?

Adding to JFM's comment: The module is fairly expensive; you can use the RT OS on a standard PC in parallel with Windows or running the real-time OS only. There are also a variety of custom NI hardware.

Another (cooler IMO) option would be the FPGA module, but that's even more expensive!

Depending on your tolerance to cost and time, you might be better off requesting an evaluation package for some embedded processor and program that directly. They usually come with a board with some voltage outputs and a PC-based compiler. It would probably be more time-consuming, but certainly less expensive. =/

Link to comment
I need to decide in each iteration whether it's on or off. This is done by reading from a file that contains 0's and 1's, in some order. 0 means off - 1 means on, so a 555 won't help me there. I also need in each iteration to read back from the parallel port, which has one pin connected to a photodiode circuit. Is Labview Real-time a different software?

A number of "real time" applications can be solved with a bit of creative thinking and a DAQ device.

For this app you may want to consider using an entry level M-Series DAQ device. 8 of the digital I/O lines are capable of buffered I/O. you could load the series of 1's and 0's from your file into a buffer and then ouput it to one of the digital outputs using the devices HW clock. At the same time you may be able to read the digital input at the same rate.

You may be able to use the NI 6503 as well - it has the funcionality of an 8255 interface.

I've only worked with the NI 6533 and buffered digital I/O, but the M-Series device should work.

Link to comment
A number of "real time" applications can be solved with a bit of creative thinking and a DAQ device.

Good point. If your decisions can be made a while in advance, you can effectively enqueue your laser states in the output buffer. Real-Time would only be needed if you don't know a few milliseconds in advance what your laser state should be.

If you cannot calculate your state at time T any earlier than (T - 100us), then you do have an expensive project on your hands =)

Link to comment
For this app you may want to consider using an entry level M-Series DAQ device...

I've only worked with the NI 6533 and buffered digital I/O, but the M-Series device should work.

Yeah, the M-series are pretty nice. I can confirm that they support simultaneous hw-timed DI and DO, where each uses a subset of the bits from the hw-timed port. I've got a mid-range board with 32 hw-timed bits, and have an app that generates 8 outputs on the leading edge of a clock while capturing 24 inputs on the trailing edge of the same clock.

-Kevin P.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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