Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Freqout on multiple timers: how to start stop individual outputs?


  • Please log in to reply
2 replies to this topic

#1 twm

twm
  • Members
  • 2 posts

Posted 11 October 2012 - 03:07 AM

Hello,
after some testing i got it to work to output different frequencies with 3 active timers.
I can change individual frequencies at runtime:
LJUD.AddRequest(u6.ljhandle, LJUD.IO.PUT_TIMER_VALUE, 1, divider, 0, 0);
LJUD.GoOne(u6.ljhandle);

when i try to stop one of the outputs:
LJUD.AddRequest(u6.ljhandle, LJUD.IO.PUT_COUNTER_ENABLE, 1, 0, 0, 0);
LJUD.GoOne(u6.ljhandle);
All 3 counters stop. if i try to restart:
LJUD.AddRequest(u6.ljhandle, LJUD.IO.PUT_COUNTER_ENABLE, 1, 1, 0, 0);
LJUD.GoOne(u6.ljhandle);
The Labjack hangs up. If i do a full reinitialization of all three timers after the disable command, it doesn't hang up.

So: What is the best way to start stop the frequency output individually on the channels without stopping / disturbing the other channels? (I would like to control some stepper motors with the Freqout feature)

Best regards
Ben

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 11 October 2012 - 02:53 PM

I am not sure why disabling or enabling Counter1 is affecting your timers, but that is not what you want anyway.

To enable and disable timers you use iotype LJ_ioPUT_CONFIG with special channel LJ_chNUMBER_TIMERS_ENABLED:

http://labjack.com/s...ers-guide/4.3.6

For example, to enable 3 timers (Timer0-Timer2), you could do something like:

ePut (lngHandle, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 3, 0);
If you want to disable 1 timer, then Timer2 is the only one you can disable leaving Timer0 and Timer1:

ePut (lngHandle, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 2, 0);
A better way to "stop" an output, is to change the mode of the particular timer you want to stop to some input mode. For example, you can have all 3 timers enabled, and change the mode of Timer1 to make it stop outputting:

ePut (lngHandle, LJ_ioPUT_TIMER_MODE, 1, LJ_tmRISINGEDGES16, 0);

I suggest you start by trying to do what you want in the test panel in LJControlPanel, before doing it in code.

#3 twm

twm
  • Members
  • 2 posts

Posted 15 October 2012 - 08:21 AM

thanks for your reply. Although i found the answer by myself before the post was published, changing the timer mode is the right solution. I enable 3 timers and can start stop the frequency output individually by changing the timer-mode. This doesn't affect the other timers in contrast to the enable/disable i previous tried. Regards, Ben


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users