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

16 Bit PWM On Labjack


  • Please log in to reply
3 replies to this topic

#1 dfashbaugh

dfashbaugh
  • Members
  • 8 posts

Posted 31 January 2013 - 09:16 AM

Hi, I'm attempting to run a 16bit PWM signal to control a light while performing other operations on the Labjack. When I call my function to turn on the PWM signal, the light turns on momentarily, then turns off again. The code I'm using in my function is shown below. AddRequest(mLJDeviceHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 6, 0, 0); AddRequest(mLJDeviceHandle, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0); AddRequest(mLJDeviceHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ_DIV, 0, 0); AddRequest(mLJDeviceHandle, LJ_ioPUT_TIMER_MODE, 0, LJ_tmPWM16, 0, 0); AddRequest(mLJDeviceHandle, LJ_ioPUT_TIMER_VALUE, 0, 32758, 0, 0); GoOne(mLJDeviceHandle); Any help would be greatly appreciated. Thanks, Dylan

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 31 January 2013 - 02:19 PM

What language are you using? Do you have any error checking/handling? Based on the code you posted, you need errorhandling after every UD call, and need to add GetResult calls to check whether any requests generated errors. If you just have the simplest program with that code and nothing else, does it work? Do you have a scope you can use to look at the PWM output on FIO6? Can you get PWM to work as desired using the test panel in LJControlPanel?

#3 dfashbaugh

dfashbaugh
  • Members
  • 8 posts

Posted 31 January 2013 - 02:43 PM

What language are you using?

Do you have any error checking/handling? Based on the code you posted, you need errorhandling after every UD call, and need to add GetResult calls to check whether any requests generated errors.

If you just have the simplest program with that code and nothing else, does it work?

Do you have a scope you can use to look at the PWM output on FIO6?

Can you get PWM to work as desired using the test panel in LJControlPanel?


I'm using C++ and there is error checking. The code produces no errors.

By itself the code works fine.

I can test FIO6 with a scope tomorrow and see what happens.

It also works how I want it to in the LJControlPanel

Thank You For Your Help. Any ideas would be appreciated.

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 31 January 2013 - 03:11 PM

So what is the minimum code you have to add to what you posted to cause a problem? I assume if you put a 5s pause between the timer config code and this other code, that the PWM works for 5s? Seems like that other code is what we need to look at.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users