PWM code for controlling DC Motor

Discussion in 'Embedded Systems and Microcontrollers' started by bathini, Jan 25, 2009.

  1. bathini

    Thread Starter New Member

    Jan 25, 2009
    8
    0
    Good Friends

    I am a newbie and I am trying to emulate a 4 bit PWM to a DC Motor control. I have built the circuit, and using the square wave generator I am able to vary the pulse and the motor spins slow and fast. I am planning first to emulate the PWM on a free software, maybe mplab and then make the necessary build by connecting between the 4 bit to microcontroller to H-Bridge motor. Does anyone have a code I can learn to do this?Most preferably assembler.

    Later I want to change this to 5 bit so that I can have an extra bit for direction control of the motor.

    The circuit I have built is attached below



    Jacks
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    So you are setting direction with the DCC input and using the strobe lines for the PWM?
     
  3. bathini

    Thread Starter New Member

    Jan 25, 2009
    8
    0
    Thanks for your reply. That is hundred percent correct. I am using the strobe for PWM and works well.

    Jacks
     
Loading...