Shop OBEX P1 Docs P2 Docs Learn Events
PWM Motor control help needed — Parallax Forums

PWM Motor control help needed

FurballFurball Posts: 4
edited 2009-08-21 17:22 in Propeller 1
Im in the need of some help, i have made a program that will control a Pulse Width Modulation (RC Motor). It when swipped with a magnet· will turn on and ramp the speed up for a given amount of time and then ramp down. It seems to be working, part of the time. Some times it will turn on but not run, and then sometimes the leds will turn on but no motor and then sometimes it will turn on without even swipping the magent on the switch. I was wondering if someone could take a look at this program and tell me what im doing wrong or maybe has a better and easier solution to my problem. [noparse]:)[/noparse]·
Im still a newbee so im sure this will be easy for·you experts. Thanks for all your help.. [noparse]:)[/noparse]

Comments

  • Clock LoopClock Loop Posts: 2,069
    edited 2009-08-21 12:21
    I had random issues like this when my STACK space for new cogs was too low.

    I see you use stack space of BYTE[noparse][[/noparse]100], not the usual LONG[noparse][[/noparse]100]!

    (lots of projects I have looked at, use longs for stacks, and usually assign 50 longs to each cog.)

    At least its something to try. Plus most people don't need the extra space so it does no harm to use more stack.

    I suspect the issue is your circuit, not program.

    Upload your schematic, considering that your using a motor, your circuit might be the issue, not your program.

    Post Edited (Clock Loop) : 8/21/2009 12:26:33 PM GMT
  • TimmooreTimmoore Posts: 1,031
    edited 2009-08-21 16:55
    The other thing to check is your indentation, there looks to be places the indentation isn't correct e.g. the slow ramp the repeat is indente further than the following 2 lines which isn't what I think you want.
  • FurballFurball Posts: 4
    edited 2009-08-21 17:22
    THANKS [noparse]:)[/noparse] I must of over looked that, i will see what happens[noparse]:)[/noparse]
Sign In or Register to comment.