Glad to meet you - Please Help?
Mike W
Posts: 105
·
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
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
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
·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
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 Williams
Applications Engineer, Parallax
Dallas, TX· USA
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video Display Module" Available Now.
www.sxvm.com
"A problem well defined, is a problem·half solved."
·