U3 2-PWM | LabJack
 
Friday May 29th 2020
Support: LabJack engineers available through email and chat.
Shipping: We are processing and shipping all orders.
Stock: 51 of 56 products are in stock. More details.
Supply Chain: Minor impacts. More details.

U3 2-PWM

4 posts / 0 new
Last post
MAH2681
MAH2681's picture
U3 2-PWM

Hello,

I am attempting to use the U3 2-PWM function and vi as part of a larger program and setup to generate 2 pulses on respective pins.  This works fine as I am able to do so.  However there is one thing that I'd like to do, that I can't seem to get correct.  After the pulsing occurs (I have it programmed to stop after a certain number of acquisitions are acquired by an USB oscilloscope we are using), the pulses do not seem to go low.  They remain high on say pins FIO4 and 5.  

I see there is a command LJ_tmSYSTIMERLOW.  I added the LJUD_eTCConfigSB.vi after the Pin configuration Reset.vi and have the LJ_tmSYSTIMERLOW command being entered into the LJUD_eTCConfigSB.vi.  Is this suppose to make the pins low at this point?  Or is there some other way I can make the pins go low after we are finished with the pulsing we need?  

Any suggestions or examples would be most appreciated. 

LabJack Support
LabJack Support's picture
Some related details are

Some related details are mentioned in 2.9.1.1 and 2.9.1.2:

https://labjack.com/support/datasheets/u3/hardware-description/timers-co...

Perhaps the lines are set to input.  You could add a pull-down (e.g. 10k from FIO4 to GND) to overpower the internal 100k pull-up.

How exactly are you "stopping" the PWM?  Are you setting NumberTimersEnabled=0?

MAH2681
MAH2681's picture
Thanks for the reply.

Thanks for the reply.

We need the timer to run for a certain amount pulses.  We are measuring the pulses that are generated by the LabJack with a USB oscilloscope.  Once it reaches a certain number, say 10, we'd like the pulsing to stop.  In my program, I have the pulses generating as we'd like, pulsing for whatever number we set and then the o'scope will stop measuring.  The initial problem I was seeing was the pins (FIO4 and 5) were still high after the program stopped.  To fix this, I added the "eDO" vi's with setting FIO4 lo, then the same for FIO5.  This seemed to work as the we monitored the signal going low at this point.

I was wondering what you mean by setting "NumberTimersEnabled=0"?  I initially tried using the LJ_tmSYSTIMERLOW as I mentioned in my first post, but this did not work.  I wired two false constants instead of the true constants, thinking this would set them to false as well.  I thought maybe I didn't have something correct in Labview as well for this.  Where should this "NumberTimersEnabled=0" be connected to in Labview?  I didn't see where this would go, or the like, unless I'm completely missing it.  Is there a certain sub-vi this is located in?  

I'm thinking if in fact I'm not stopping or shutting down the counter properly, this is the cause of another problem I'm seeing in that the pulses are not correct on subsequent calls when I place my program in a while loop.  It works fine if it just runs once i.e. start the Labview program, it runs, then stops, push the white arrow again, repeat, etc.

I can at least provide you a screen capture if that would help or try to repeat what I'm seeing minus the o'scope and post my Labview code if that would help as well.

LabJack Support
LabJack Support's picture
"U3 2-PWM.vi" is not a

"U3 2-PWM.vi" is not a function.  Rather it is an example showing how to call some functions.  We do not recommend using this example as a sub-vi, but rather copy/replicate code from this example to make your own VI as needed.

When I mentioned NumberTimersEnabled I was thinking of the traditional style of timer/counter code:

https://labjack.com/support/datasheets/u3/high-level-driver/example-pseu...

... but "U3 2-PWM.vi" uses the 2 easy functions instead:

https://labjack.com/support/datasheets/u3/high-level-driver/function-ref...

https://labjack.com/support/datasheets/u3/high-level-driver/function-ref...

https://labjack.com/support/datasheets/u3/high-level-driver/example-pseu...

With this method, the applicable parameter is aEnableTimers in eTCConfig.  This is an array specifying which timers are enabled.  The U3 has 2 timers, so you always pass a 2-element array for the U3.  You want to pass FALSE, FALSE to disable both timers.

So in your program you want to:

    1. Call eTCConfig whenever you want to enable and configure the timers.

    2. Call eTCConfig whenever you want to disable the timers (and perhaps call eDO right after to set them to output-low).