PE 5.3.6 Download ?

dgc188

New Member
I'm in the process of playing around with R/C hobby servos and am experiencing servo jittering. This it seems, from various threads, that it is a common problem.

One thread I happened across indicated by IronJungle (back in 2011) that one program worked fine with PE 5.3.6, no jitter, but had jitter with (at that time) PE 5.4.3 (no changes having been made to the code or circuit board, etc.; only the Editor version). Also on that thread, Technical indicated that there had been no change in the compiler code used - but the original writer was adamant (post #34) about the PE version being the only change. https://picaxeforum.co.uk/threads/robot-hand-suddenly-has-the-jitters.20023/

Is it possible that a copy of PE 5.3.6 and its then associated compiler version is available anywhere so that I can give it a try on my project? It might save me an awful lot of head scratching and coding changes only to find that even with the latest PE 6 (& latest compiler) the problem has not been reversed to that as seen/used in PE 5.3.6. I've done a Google search and came up with a version 5.5.5 as the earliest available from Software Informer.

I hope someone out there can dig out an original version of PE 5.3.6, simply for me to prove to myself whether it is the PE/compiler or not or simply something in my (standard from examples) coding/circuit layout/whatever.

Thanks in anticipation.
 

hippy

Technical Support
Staff member
It seems unlikely you will find a copy of Programming Editor 5.3.6 with it being so old and it is unlikely that servo jitter is down to the PE or compiler version.

It would be better to try and solve the jitter problem you have with your current code using PE6. In many cases jitter is down to the commands and timing used. If you could say which PICAXE you are using and post your code that may help identify what the issue you are having could be.
 

inglewoodpete

Senior Member
I checked my archive DVDs and found a full copy of 5.3.3 (64MB) and a copy of the 5.3.4 patch zip file (1.6MB) (Not the full BAS805). These files are dated around March 2011. I can temporarily place them on my drop box and send you a PM with a secure link.

I have no idea how these versions perform with servos. My last work with servos was in 2009.
 

dgc188

New Member
Many thanks to hippy, to PhilHornby and to inglewoodpete for your responses to my request for PE 5.3.6.

Firstly to hippy - all I can say regarding my request is the comments made by IronJungle back in 2011 that he was pretty adamant that the only change to his servo operation between "jitter" and "no jitter" was the PE/compiler version used for his (otherwise unchanged) code. Hence, I am prepared to give the early version a try before condemning my code to a full review. The code I use is basically taken from the PICAXE manual and from various other sources across the community in general. So it "should" work correctly without jitter - which it does in part - but I am prepared to admit to possibly requiring some changes to the code and also to the power and decoupling requirements across the board (I'm using separate mains supplies to the PIC and to the servos). I am just interested to see what differences the old version might provide using my kit 'as is' before throwing more weight behind a reconstruct of it all. It's experimentation in its base form, if you like. Currently I'm using PE 6.1.0.0 (I try to keep it up-to-date) on an 18M2+ Rev.DA (I think that's what I get reported back!).

If I have just the one subroutine and the one servo active - the code works well while it raises & lowers. Once it has settled at the end of the routine it then starts to randomly jitter while waiting for the next input to start the subroutine again. The subroutine itself seems ok - it's just while in the loop watching for an input to C.0, C.1, C.2, C.5, C.6 or C.7. The range of movement being from 75 to/from 150. The code used is to slowly raise-wait 10 seconds-lower a ramp in a subroutine on each servo (Tower Pro SG90) - only one servo being called at a time.

The pins B.3 & B.4 are indicator LEDs - the subroutine (one of six) is called from a "select case" routine after monitoring six input switches, the value of where to jump (case) being placed in b1:

Code:
OUTPUT B.0,B.1,B.2,B.3,B.4,B.5,B.6,B.7
INPUT C.0,C.1,C.2,C.5,C.6,C.7
init:
high B.3                    ; turn off LED white
low B.4                    ; light LED red
servo B.0,75                ; initialise/set servos to (hopefully) a mid/resting point
pause 1000                    ; pause 1 second between each
servo B.1,75
pause 1000
servo B.2,75
pause 1000
servo B.5,75
pause 1000
servo B.6,75
pause 1000
servo B.7,75
pause 1000
b1=0
main:
if b1=0 then
gosub whichservo
endif
if b1=0 then
goto main
endif

select case b1
case 1
    b2=150
        gosub servoraise1
case 2
    b2=150
        gosub servoraise2
case 3
    b2=150
        gosub servoraise3
case 4
    b2=150
        gosub servoraise4
case 5
    b2=150
        gosub servoraise5
case 6
    b2=150
        gosub servoraise6
    else
        goto main
    endselect
b1=0
goto main
;
whichservo:
if pinC.0=1 then
    b1=1
    else if pinC.1=1 then
        b1=2
        else if pinC.2=2 then
            b1=3
            else if pinC.5=1 then
                b1=4
                else if pinC.6=1 then
                    b1=5
                    else if pinC.7=1 then
                        b1=6
                endif
                return
servoraise1:                ; servo1
    for b3=75 to b2            ; raise loop
    servopos B.0,b3
    pause 20
next b3
high B.4                    ; turn off LED red
low B.3                    ; light LED white
pause 10000                    ; wait 10 seconds
for b3=b2 to 76 step -1            ; lower loop
    servopos B.0,b3
    pause 20
next b3
high B.3
low B.4                    ; light LED red
return
servoraise2:                ; servo2
    for b3=75 to b2            ; raise loop
    servopos B.1,b3
    pause 20
next b3
high B.4                    ; turn off LED red
low B.3                    ; light LED white
pause 10000                    ; wait 10 seconds
for b3=b2 to 76 step -1            ; lower loop
    servopos B.1,b3
    pause 20
next b3
high B.3
low B.4                    ; light LED red
return
servoraise3:                ; servo3
etc. etc. for servos 4,5&6.
All pretty basic stuff. If there's anything drastically wrong, I'd be pleased to correct where required.

To PhilHornby - thanks for the links to the two versions - these I have downloaded along with a 5.3.1 (it says). All worth a look and see what happens.

To inglewoodpete - I would certainly appreciate a PM regarding a copy of your 5.3.3 plus the 5.3.4 patch (I'm sure it would end up being a complete 5.3.4 following the patch). There's no comment as to how IronJungle's original code worked (or not) on previous versions to 5.3.6.

Reading through the original post and a couple of others around that time, it seems from various comments made, this it was unlikely that the PE/compiler version would have anything to do with the problem IronJungle was having with his jitter issue - but I'm prepared to give it a try. If it works, fine; if not, back to the drawing board, nothing lost but a bit of time and a gain in knowledge as a result.

I'll admit that I'm new to operating servos but I'm on the learning curve, somewhere near the bottom I guess, and learning fast! Again thanks for your comments and to others on the forums who have already provided me with knowledge of the subject simply by reading through many the posts on the subject. Jitter seems to be a common problem.

Cheers guys
 
Last edited by a moderator:

lbenson

Senior Member
Problems with glitchy, jittery servos have typically been solved by using PULSOUT instead of the specific servo commands. Unfortunately, I can't now find the threads about this that I remember.
 

hippy

Technical Support
Staff member
Your code looks like it should be okay but it can be simplified so there is only one ServoRaise routine needed.

Rather than select which ServoRaise routine to call you can use 'b1' to determine which servo to affect within that. You can set 'b1' to the servo pin to use (B.0-B.7) rather than have a number which indicates which to use (0-7).

In addition it's possible to simplify the waiting for button push routine. This here includes a PAUSE 20 which may reduce the jitter you are experiencing.

Not tested with real hardware but I believe it should work -
Code:
#Picaxe 18M2
#No_Data

Init:
  High B.3
  Low  B.4

  Servo B.0, 75 : Pause 1000
  Servo B.1, 75 : Pause 1000
  Servo B.2, 75 : Pause 1000
  Servo B.5, 75 : Pause 1000
  Servo B.6, 75 : Pause 1000
  Servo B.7, 75 : Pause 1000

Main:
  Do
    Do
      Pause 20   ;  765--210
      b0 = pinsC & %11100111
    Loop Until b0 <> 0
    If      bit0 = 1 Then : b1 = B.0
    Else If bit1 = 1 Then : b1 = B.1
    Else If bit2 = 1 Then : b1 = B.2
    Else If bit5 = 1 Then : b1 = B.5 
    Else If bit6 = 1 Then : b1 = B.6 
    Else If bit7 = 1 Then : b1 = B.7
    End If
    b2 = 150
    Gosub ServoRaise
  Loop

ServoRaise:
  For b3 = 75 To b2
    ServoPos b1, b3
    Pause 20
  Next
  High B.4
  Low  B.3
  Pause 10000
  For b3 = b2 To 75 Step -1
    ServoPos b1, b3
    Pause 20
  Next
  High B.3
  Low  B.4
  Return
 

hippy

Technical Support
Staff member
Problems with glitchy, jittery servos have typically been solved by using PULSOUT instead of the specific servo commands. Unfortunately, I can't now find the threads about this that I remember.
I don't have links to the threads but it is basically issue your servo pulses then pause for however long it takes to make that last 20ms, one servo frame period.

This should be jitter-free using the PULSOUT trick. Again not fully tested -
Code:
#Picaxe 18M2
#No_Data

Init:
  High B.3
  Low  B.4

Main:
  Do
    b1 = $FF
    Do
      Gosub OutputServos
      b0 = pinsC & %11100111
    Loop Until b0 <> 0
    If      bit0 = 1 Then : b1 = B.0
    Else If bit1 = 1 Then : b1 = B.1
    Else If bit2 = 1 Then : b1 = B.2
    Else If bit5 = 1 Then : b1 = B.5 
    Else If bit6 = 1 Then : b1 = B.6 
    Else If bit7 = 1 Then : b1 = B.7
    End If
    b2 = 150
    Gosub ServoRaise
  Loop

ServoRaise:
  For b3 = 75 To b2
    Gosub OutputServos
  Next
  High B.4
  Low  B.3
  For w2 = 0 To 500 
    Gosub OutputServos
  Next
  For b3 = b2 To 75 Step -1
    Gosub OutputServos
  Next
  High B.3
  Low  B.4
  Return

OutputServos:
  If b1 = B.0 Then : PulsOut B.0, b3 : Else : PulsOut B.0, 75 : End If
  If b1 = B.1 Then : PulsOut B.1, b3 : Else : PulsOut B.1, 75 : End If
  If b1 = B.2 Then : PulsOut B.2, b3 : Else : PulsOut B.2, 75 : End If
  If b1 = B.5 Then : PulsOut B.5, b3 : Else : PulsOut B.5, 75 : End If
  If b1 = B.6 Then : PulsOut B.6, b3 : Else : PulsOut B.6, 75 : End If
  If b1 = B.7 Then : PulsOut B.7, b3 : Else : PulsOut B.7, 75 : End If
  If b1 = $FF Then
    w2 = 6 * 75
  Else
    w2 = 5 * 75 + b3
  End If
  w2 = 2000 - w2
  PauseUs w2
  Return
Note there are no PAUSE 20 commands in there because the OutputServo routine itself takes 20ms.

And also note that OutputServo has to be repeatedly called, such as in the loop looking for inputs, and during the ten second delay ( 500 x 20ms ) the servo is held raised within ServoRaise.
 

hippy

Technical Support
Staff member
In both cases, that -
Code:
    If      bit0 = 1 Then : b1 = B.0
    Else If bit1 = 1 Then : b1 = B.1
    Else If bit2 = 1 Then : b1 = B.2
    Else If bit5 = 1 Then : b1 = B.5 
    Else If bit6 = 1 Then : b1 = B.6 
    Else If bit7 = 1 Then : b1 = B.7
    End If
Can be optimised to -
Code:
    LookDown 1, (bit0,bit1,bit2,0,0,bit5,bit6,bit7), b1
    b1 = b1 + B.0
 

dgc188

New Member
Many thanks hippy for the "adjusted" lines/sections of code - there's some syntax in there I can say I'm not familiar with! It's all on my learning curve - on which it seems I'm right close to the bottom of! This is what it's all about, never stop learning.

I shall certainly make use of the code (above) and see how we get on, but I guess it may not be until after the festivities are out of the way - much preparation to be done and SWMBO has laid out the ground rules for what needs to be done on my part!

Good to know my original code should have produced decent results - optimisation may possibly have come after a workable 'base line' had been reached so that I knew I had a good fallback if needed.

Anyway, have a Good 'Un and again, many thanks for the pointers.
 

hippy

Technical Support
Staff member
Good to know my original code should have produced decent results - optimisation may possibly have come after a workable 'base line' had been reached so that I knew I had a good fallback if needed.
Servos are always a bit hit and miss, and possibly more miss the more servos one is trying to use.

The fundamental issue is that SERVO and SERVOPOS generate background pulse trains which then compete with what else the PICAXE program is doing with respect to I/O access. The more I/O and the more servo pulse trains there are the greater the likelihood of two things wanting to access I/O at the same time. When that happens the servo pulse train can get delayed and this translates to jitter.

Limiting I/O and tweaking timing can at least make jitter less likely or even go away, but the potential for it to reappear is always there. Adjust the timing and some way and one can make it better or worse. It's hard to predict.

In many cases there's no jitter at all or it is so minimal it is unnoticed, and the type of servo used can play its part. Some are more responsive and will therefore jitter more than others.

SERVO commands are handy and easy to use but not always perfect. And this isn't just a problem for PICAXE but any microcontroller where pulse generation is done in software rather than hardware.

The 'bit-banged', Post #10, code gets round the issue by having the program completely take control of all I/O which means there never can be an I/O clash because there are no background servo pulse trains being generated. The program generates those servo pulse trains for itself.

The tricky part is often in integrating that in a larger program. Here it isn't so bad.

Looking forward to hearing how you get on. If you do have any questions when you come back to it; just ask. I or other members will be pleased to help out.
 

rq3

Senior Member
I'm in the process of playing around with R/C hobby servos and am experiencing servo jittering. This it seems, from various threads, that it is a common problem.

One thread I happened across indicated by IronJungle (back in 2011) that one program worked fine with PE 5.3.6, no jitter, but had jitter with (at that time) PE 5.4.3 (no changes having been made to the code or circuit board, etc.; only the Editor version). Also on that thread, Technical indicated that there had been no change in the compiler code used - but the original writer was adamant (post #34) about the PE version being the only change. https://picaxeforum.co.uk/threads/robot-hand-suddenly-has-the-jitters.20023/

Is it possible that a copy of PE 5.3.6 and its then associated compiler version is available anywhere so that I can give it a try on my project? It might save me an awful lot of head scratching and coding changes only to find that even with the latest PE 6 (& latest compiler) the problem has not been reversed to that as seen/used in PE 5.3.6. I've done a Google search and came up with a version 5.5.5 as the earliest available from Software Informer.

I hope someone out there can dig out an original version of PE 5.3.6, simply for me to prove to myself whether it is the PE/compiler or not or simply something in my (standard from examples) coding/circuit layout/whatever.

Thanks in anticipation.
I don't do a lot of work with servos, but when I do, I bit bang. https://picaxeforum.co.uk/threads/bit-banged-servo-drive-from-the-20m2-a-0-pin.30712/
 

dgc188

New Member
Thanks Hippy for your code in #10. I've tried it over the past day or so and it seems to work well and twitch free. So thanks for that.

I also tried the substitute lookdown lines in #11 but nothing seemed to happen. The LEDs change but not much else. Not had the chance yet to try and figure out why. I replaced all between and including the if - endiff lines in #10.

At least I have something that works and can now tweak it slightly.

Thanks also to rq3 for the link. Some interesting stuff in there. Will investigate further.

Again thanks to all for your various inputs.
 
Top