sir_pewe Posted March 11, 2010 Share Posted March 11, 2010 Hi. I have a U3 rev 1.3 and I'm using DAQFactory Express (5.83 build 1632). I have tested the timerPWM example and buy setting correct ID and path to include files I finally got t to work. The thing I don't understand is change of clock used, when I change this (fro axample to 1MHz or 4MHz or 48MHz the PWM still outputs the same freq. What I have to do is shut down Daqfactory express, unplug the labjack U3 and then plug it in again, start up daqfactory and then the change takes effect. So my question is, Am I doing anything wrong or is it like this that I need to restart U3 and/or DAQFactory when I change frequency used for the timer? Code tested: --------------------------------------------------------------- AddRequest (ID, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 4, 0, 0) // use system clock so works on U3 and UE9: AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc12MHZ_DIV, 0, 0) //Set the divisor to get 100Hz with 12MHz clock: AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 2, 0, 0) //Enable 1 timer. It will use FIO4. AddRequest(ID, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 1, 0, 0) //Configure Timer0 as 16-bit PWM. AddRequest(ID, LJ_ioPUT_TIMER_MODE, 0, LJ_tmPWM16, 0, 0) --------------------------------------------------------------- BR // Per Link to comment Share on other sites More sharing options...
AzeoTech Posted March 11, 2010 Share Posted March 11, 2010 Two things: 1) do you have a GoOne() somewhere? 2) are you rerunning the sequence after the change (it autoruns on start)? Link to comment Share on other sites More sharing options...
sir_pewe Posted March 11, 2010 Author Share Posted March 11, 2010 Hi. In the timerPWM example (included in daqexpress folder) there is a start and stop button on page 0. The start button calls the StartUp sequence as in turn calls the setupPWM. So I suppose the setupPWM is runned everytime I press start button. The SetupPWM ends with GoOne(ID) (id is global variable set to my U3's id) BR // Per Link to comment Share on other sites More sharing options...
LabJackSupport Posted March 16, 2010 Share Posted March 16, 2010 That start button calls StartStream not StartUp, so your changed SetupPWM is not getting run again that way. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.