Shop OBEX P1 Docs P2 Docs Learn Events
Generating PWM with the SX28 — Parallax Forums

Generating PWM with the SX28

crgwbrcrgwbr Posts: 614
edited 2006-12-04 17:35 in General Discussion
Hey Everyone,
I have been trying to gererate motor control PWM with an SX28 for some time now, but have not been able to make it work.· I have tried Bean's 16 channel PWM code and some code of my own, but none of it seems to be working.· Could anybody take a look at the code and see if they can figure out whats going wrong, because it has me stumped?

Thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-12-04 16:51
    I am not well versed in SX/B, but there are samples in Assembly that work well.· Jon Williams did publish SX/B examples in Nuts & Volts and also pointed out that 4mhz was a bit limited for normal servo operations.

    For Assembler, If you have Guenther's book, the last portion discusses providing a BOEbot with an SX28 to drive two servos.· The code from the text is publically available at Parallax, but you have to buy the text.

    Senix-Ubicom has Assembler code examples and so does SXLIST.com; but for the life of me they just seem too complex or to cryptic in their explanations.· At least with Guenther's text, you can get a proof of concept operating in a tangible device and then work from there.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 12/4/2006 4:58:10 PM GMT
  • crgwbrcrgwbr Posts: 614
    edited 2006-12-04 17:21
    In both of the files I posted, I am running at 50MHz; so speed shouldn't be an issue. Also, I am trying to control brushed DC motors, not Servos (I can control servos just fine).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • BeanBean Posts: 8,129
    edited 2006-12-04 17:26
    In your PWM1.SXB program, you never set RB.4 to an output.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
    ·
  • crgwbrcrgwbr Posts: 614
    edited 2006-12-04 17:31
    Thanks Bean, Once again you've saved a project thought to be doomed. [noparse]:)[/noparse]

    On a related note; how do you calculate how many cycles a block of code take to run?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • BeanBean Posts: 8,129
    edited 2006-12-04 17:35
    Use SX-Sim.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
    ·
Sign In or Register to comment.