1 Continuous MCPWM at a time


Closed Thread
Results 1 to 40 of 47

Hybrid View

  1. #1
    Join Date
    Jul 2011
    Posts
    29


    Did you find this post helpful? Yes | No

    Default Re: 1 Continuous MCPWM at a time

    you're right lol... I'm sorry that you've waisted your time with me, I also figured this out yesterday :s I waisted my time too.
    My last problem is to be able to switch frequency only if my pot = 0 (duty cycle = 0) so that the motor won't stall..
    Any ideas ?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: 1 Continuous MCPWM at a time

    You mean switch direction when the pot is 0, right?
    Code:
    GOSUB GetADC
     
    If PotValue = 0 THEN
      Direction = PortB.7  ' Or whatever
    ENDIF
    This won't touch the Direction variable if PotValue is >0.

  3. #3
    Join Date
    Jul 2011
    Posts
    29


    Did you find this post helpful? Yes | No

    Default Re: 1 Continuous MCPWM at a time

    Hello,

    With your help, my motor works perfectly fine. Thank you very much.
    However, a weird thing happens every 1/2 mins, it seems that my chip reset by itself. Does anyone know where does that come from ? I have a 6.7k resistance on MCLR is that not enough ?

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: 1 Continuous MCPWM at a time

    Almost impossible to say although noise on the MCLR pin or supply lines are likely causes. There's a register, I believe it's called RCON (check the datasheet), which you can check to see what caused the reset. There will be various bits set depending on if it was a brown-out reset etc - that might help.

    Make sure you have sufficient decoupling as close to the supply pins as possible and make sure you coonect ALL the supply pins - not just one pair.

    /Henrik.

  5. #5
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Re: 1 Continuous MCPWM at a time

    Add some capacitors to the MCLR. Maybe 0.1 uF and 2.2uF and hopefully you can still program the pic. If you have a long trace on the pcb to the programming connector you can also try to add the capacitors close to the connector since that trace will act like an antenna.

Members who have read this thread : 1

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