Shop OBEX P1 Docs P2 Docs Learn Events
Glad to meet you - Please Help? — Parallax Forums

Glad to meet you - Please Help?

Mike WMike W Posts: 105
edited 2005-04-08 00:43 in General Discussion
·
4/7/2005

Hello to all

This is my first post to your Forum, although I have visited often in the last 3 months I have just now decided to join in. I am new to microcontrollers and have just purchased my first this February. After researching every thing I could get my hands on I went with the SX/B. And after reading through the books and manual and playing with the examples I decided that Basic programming was to be my first step. Of course I need help!

Controlling servos has been my first project. At first a standard servo and a potentiometer Right/Left not much of a problem. But now I am working with modified servos for continuous rotation I cannot make them stop turning. I have programmed the code below and the servo rotates left slowly, if I change 159 to 160 same thing other direction.


Main:·
· PULSOUT RA.0,159,1····· ·······················
· PAUSE 15
· GOTO Main

What am I missing, and how do you set up a constant so you can use numbers larger than 255




······················································································· Mike W

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-07 15:46
    Your servo is out of adjustment -- this happens with vibration (internal pot setting moves). If you've got newer Parallax CR servos you're in luck; they have access to and adjustment pot. What you'd want to do is:

    Main:
    · PULSOUT RA.0, 150, 1
    · PAUSE 20
    · GOTO Main

    This sends a 1.5 ms pulse to the servo (which should stop it). If the servo moves at all, adjust the pot until it doesn't. My suggestion is that you adjust the servo(s) to standardized code, not the other way around -- if you do you will chase this problem every time you change servos.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • KenMKenM Posts: 657
    edited 2005-04-07 15:53
    Mike W said...
    ·What am I missing, and how do you set up a constant so you can use numbers larger than 255

    Mike, can you state what you want to do with a number greater than 255?

    The SX has only byte variables, but there are ways to work with larger numbers.

    The method to work with a larger number depends on what you want to do.

    K
  • Mike WMike W Posts: 105
    edited 2005-04-07 21:10
    I'm sorry I guess I asked two questions. I'll watch that.



    Jon

    Unfortunately the modified servo's are not Parallex they were cheap hobby store items so there is no adjustment to them is there any way this can be adjusted in the code.



    The reason I was wondering about larger numbers was that I thought maybe I could get a finer resolution that way.

    ··························································· Mike
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-07 21:21
    The cool thing about SX/B is that it reveals the assembly code that's generated. What you might want to do is create a custom assembly routine with finer resolution.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-07 21:34
    Depending on how SX/B generates the PWM, you can adjust it to a finer degree of resolution. If its inline code, adjusting the delay period; or if its isr code, adjusting the ISR frequency (RTCC timeout period).
  • BeanBean Posts: 8,129
    edited 2005-04-08 00:43
    Are you sure the servo was modified correctly ? With less that a 10usecond deadband that is going to be hard to keep still.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video Display Module" Available Now.

    www.sxvm.com

    "A problem well defined, is a problem·half solved."
    ·
Sign In or Register to comment.