I am afraid not.
I don't know the basic language you are using, so I can't really write the actual code for you, but here are some comments.
You get off to a good start by checking the servo number with if statements, but you need to do a lot more in each if.
You have a delay in the handler. This means you really don't understand how it is supposed to work, so let me try to explain it.
A timer works by setting a value in TMR0H and TMR0L. The timer then starts counting up at some rate determined by the configuration settings. When it overflows to 0, an interrupt is generated. So the idea here is to set a value in the timer that will cause the next interrupt to occur after the desired on time for the servo it is handling this time around. We set a value of 65535 intiallialy so that the first interrupt occurs right away. You appear to have done this correctly.
The idea here is that each time we get a timer interrupt we are going to start the pulse for one servo. We then set the timer to interrupt at the end of that pulse, a variable amount of time based on where we want the servo positioned. When we get the next interrupt, we turn off the pulse for the previous servo and start the pulse for the next servo. So the first and last interrupts will be special. The first one will have not servo to turn off and the last one will have no servo to turn on. It then takes 7 pulses to handle the six servos. You did get that we need to use a servo number to know what to do each time. You used a variable x to do this, then copied x to a variable servo. That is unnecessary, just use the variable servo.
I am going to assume that you deal with time in usec, and that the timer counts once per microsecond. If you cannot arrange for that rate, then you will have to translate the usec times into timer ticks. For example, if the timer actually counts every 2 usecs you would divide the time by 2 to get timer ticks.
So, in pseudo code, the handler should look something like this:
Code:
if servo = 1
turn on pulse for servo 1
time = time for servo 1
count = 65535 - time + 1
TRM0H = 8 high bits of count
TMR0L = 8 low bits of count
totalime = totaltime + time
servo = 2
else if servo = 2
torn off pulse for servo 1
turn on pulse for servo 2
time = time for servo 2
count = 65535 - time + 1
TRM0H = 8 high bits of count
TMR0L = 8 low bits of count
totaltime = totaltime + time
servo = 3
(repeat for 3,4,5,6 )
else if servo = 7
turn off pulse for servo 6
time = 20000 - totaltime
count = 65535 - time + 1
TRM0H = 8 high bits of count
TMR0L = 8 low bits of count
servo = 1
end if
Note that use must write TMR0H and TMR0L in that order, because the hardware handles them specially.
I don't know if your basic has something like the C switch statement, which allows you to do one test and go to multiple branches, but if it does, that would be better than a series of if statements like I have in the pseudocode.
Bob