L298N Motor Driver using pwm code not working..


Results 1 to 15 of 15

Threaded View

  1. #10
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: L298N Motor Driver using pwm code not working..

    Hi,
    I don't really follow your coding but you have a main loop which constantly (I mean thousands of times per second) keeps setting the dutycycle to some value. When the interrupt fires, decide which way to turn (if any) and set the dutycycle, don't change it the main loop. BTW, does 10Hz really work? Also, in your previous code I got the impression that the sensors were analog (you used ADCIN to read them) but now they are digital?

    /Henrik.

    EDIT: One more thing, you don't seem to reload the timer value in the ISR.
    Since the timer is freerunning and generating an interrupt on overflow, with a prescaler of 8 and a 4MHz x-tal the interrupt frequency of 4000000/4/8/65536=1.9Hz, I think you need to run faster than that.
    Last edited by HenrikOlsson; - 29th September 2012 at 10:51.

Similar Threads

  1. Replies: 2
    Last Post: - 7th August 2012, 16:16
  2. Motor driver problem w/ HPWM
    By Amoque in forum General
    Replies: 2
    Last Post: - 21st May 2011, 20:51
  3. L293 motor driver options?
    By Ron Marcus in forum Off Topic
    Replies: 0
    Last Post: - 5th December 2006, 15:39
  4. Stepping motor Driver
    By mesamune80 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th August 2006, 04:36
  5. Driver code for 14 segment LED display
    By Durward Searcy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th December 2004, 20:08

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts