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

Can't command simultaneously 2 DC servo motor on U3


  • Please log in to reply
2 replies to this topic

#1 ermips

ermips
  • Members
  • 15 posts

Posted 06 April 2013 - 03:06 AM

Hi, I try to command simultaneously 2 DC servo motor connected on FI04 FI05. I mixed c# code example but, just one motor run... Thanks for advices [codebox] U3 u3; u3 = new U3(LJUD.CONNECTION.USB, "0", true); // Connection through USB // RESET LJUD.ePut(u3.ljhandle, LJUD.IO.PIN_CONFIGURATION_RESET, 0, 0, 0); //Set the timer/counter pin offset to 4, which will put the firsttimer/counter on FIO4. LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.TIMER_COUNTER_PIN_OFFSET, 4, 0, 0); //Enable 2 timer. LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.NUMBER_TIMERS_ENABLED, 2, 0, 0); //Use the 48 MHz timer clock base with divider. LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.TIMER_CLOCK_BASE, (double)LJUD.TIMERCLOCKS.MHZ48_DIV, 0, 0); //Set the divisor to 48 so the actual timer clock is 1 MHz. LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.TIMER_CLOCK_DIVISOR, 48, 0, 0); //Configure Timer0 as 8-bit PWM. Frequency will be 1M/256 = 3906 Hz. LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_TIMER_MODE, 0, (double)LJUD.TIMERMODE.PWM8, 0, 0); //Configure Timer1 as 8-bit PWM. Frequency will be 1M/256 = 3906 Hz. LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_TIMER_MODE, 1, (double)LJUD.TIMERMODE.PWM8, 0, 0); //Set the PWM duty cycle Motor 1 LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_TIMER_VALUE, 0, DutyCycle, 0, 0); //Set the PWM duty cycle Motor 2 LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_TIMER_VALUE, 1, DutyCycle, 0, 0); //Execute the requests. LJUD.GoOne(u3.ljhandle);[/codebox]

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 08 April 2013 - 07:54 AM

I don't see anything wrong with your code. Have you tried using the test panel in LJControlPanel to confirm that the hardware is good? Confirm that you can get your 2 PWM outputs in the test panel.

#3 ermips

ermips
  • Members
  • 15 posts

Posted 08 April 2013 - 01:30 PM

Thanks, you were right. I used test panel. My brand new motor is breakdown. With a new one, the code makes the two weels to turn.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users