Jump to content
  • 0

Using hardware timer output as a source for a timed loop


GBH

Question

Hello,

I'm new to LABVIEW and trying to use the timer output on my USB-1608GX as a timing source for a timed loop.

I understand that I need to read the channel and convert the data into a string (see attached photo). The simple way I tried to do this isn't working and returns error 20001.

 

What am I missing? Is there an error code description available for the ULx?

 

Thanks in advance,

Guy

timed loop.jpg

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

The USB-1608GX timer is a physical output on its screw terminal block. It is not used to time an acquisition loop. If you're using a Timed Loop, you set the timing of the loop using the Period control on the side of the loop. For instance, if you set the Period to 10, it would try to execute ten times per second.  A better use of the USB-1608GX Timer is to provide a square wave signal to external circuitry. If you plan on updating digital outputs, using a While Loop and a delay might be easier.

Check out our examples in \National Instruments\LabVIEW 2023\Examples\ULx\. You can also access the ULx documentation from the LabVIEW Help menu. For help with error codes, it is best to inquire about them unless you're familiar with our C programming API. 

 

Link to comment
Share on other sites

  • 0

Thanks for the answer JRys,

I will elaborate a bit on what I am trying to do.

I need to generate multiple PWM signals and I want to have a phase shift between the begining of each one. I tried to do this software timed with timed loops (inserting the delay time as you suggested), hoever the phase shift becomes inconsistent (from my understanding this is because of the software timing). I found an example that uses a "DAQmx create timing source VI" to send ticks to the first timed loop, with all the sub loops being software triggered. My thinking was that if the original loop is hardware timed, it could fix my problem.

is there a way to generate ticks based on the USB-1608GX hardware to do something similar to what the DAQmx create timing source VI does?

 

Thanks again.

Link to comment
Share on other sites

  • 0

The USB-1608GX Digital Output write is an asynchronous operation. The fastest the port can be updated is around 100B/s and is PC-dependent. The timer output is a better solution for a PWM because its frequency and duty cycle can be set. However, there's only one timer and its support could be better when using LabVIEW, as opposed to DASYLab, C, or Python. Once started, there's no way to change the duty cycle without closing the task and recreating it.

The USB-DIO32HS is a device to consider. It has two synchronous 16-bit ports. It would allow you to configure a buffer containing your PWM profiles that can be output at a desired update rate, up to 8MB/s. It can be set to do it once or continuously loop on the buffer, which can be updated while running.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...