Servo's need to be continuously updated about 50 times per second.
Those pauses are screwing with your servo causing it to lose it's mind.
Servo's need to be continuously updated about 50 times per second.
Those pauses are screwing with your servo causing it to lose it's mind.
Aha.. Hmm, but my original code didnt have those pauses, and still doesnt work..
But I'll change my testcode and remove the pauses and makes it update continuosly.
..Also, if I make a loop that just send 150 to the servo, it stands in one of the nedpositions.. shouldnt that (150) be the middle position ?
If your original code was going too FAST, you might see the same results.
And a middle position of 150 (1.5ms) is almost an arbitrary number...might be 160, might be 140-ish. Depends on the servo and what day of the week it was made...
Code:@ device INTRC_OSC_NOCLKOUT,MCLR_OFF,LVP_OFF,WDT_OFF,PROTECT_OFF DEFINE OSC 4 ct var byte : ct2 var byte : ct = 150 : low portb.1 main: for ct = 150 to 250 step 1 'sweep one way for ct2 = 1 to 50 pulsout portb.0, ct pause 18 next ct2 next ct for ct2 = 1 to 50 'hang out there for a bit pulsout portb.0, ct pause 18 next ct2 for ct = 250 to 150 step -1 'sweep the other way for ct2 = 1 to 50 pulsout portb.0, ct pause 18 next ct2 next ct for ct2 = 1 to 50 'hang out there for a bit pulsout portb.0, ct pause 18 next ct2 goto main
Hmm, well that works, sort of.. its not centering and its not full to the ends..
I tried my old "center the servo" code with slightly modifications too:
..Well, this is strange..Code:' servocenter @ device INTRC_OSC_NOCLKOUT,MCLR_OFF,LVP_OFF,WDT_OFF,PROTECT_OFF DEFINE OSC 4 start: pulsout portb.0, 150 pause 18 goto start
The first time I tried it it seemed to work.. but if i moved the servoarm (with power disconnected ofcourse) it gives very strange results.
If its in 180 degrees position, or close to that, it will work, it will center (more or less) the arm and hold it there.. HOWEVER.. if its in another position, it will just hold the current position ??
this is so strange.
Ok, now I suspected the servo, so I changed the brand new chinese servo to an old one from my box of "old RC stuff", and with two different (working) hitec servos (different models) I get another result, they go to one endpoint and stay there, regardless of the original position ??
That's why when you buy a transmitter, it has trim settings on it. when you change servo's in an airplane, generally you have to re-center it, reset the endpoints, etc.etc.etc.
If the one servo isn't going end to end, increase the end points in the program.
And I was wrong. The endpoints in that previous program should've been 100 and 200, not 150 and 250.
Hi, Glenn
Just try
LOW PortB.0
just before the PULSOUT Command ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks