Ok, yet another try...

First of all, I am still using timer0. This may change, I have not had
time to research 16 bit timers. It would be nice if the user could
choose which timer to use.

It still works the same with interupt each 10us (exactally 10us),
adding servo's does NOT affect this 10us timing or any servos. I still
see benifit to using this method which is more servo's.

I basically created it on 4 servo's, then if only one servo is used,
there is some small useless code to delay and keep the timing
exactally the same. I did however moved the timer to the beginning of
the code as you suggested.

I also see some possible disadvantage to using a 16 bit timers, maybe
you can give your opinion on this because I don't know much about
timers. I think if a 16 bit timer is used (for full 20ms), there is
more chance for something such as an I2C interupt, to interupt the
servos interupt. With an 8bit timer (2.5ms), the count is smaller so
less affect???

I still don't know what to do about lower oscillator speeds. 20mhz
only so far. I will still need to do some testing on this. Faster
oscillators should not be an issue.


I modified it to 20ms per pluse, there is larger timer at the end of
the pulses so there are no interupts at that time. Here is the step by
step:

1. servo's 1 to 4 all get pulsed (interupt each 10us for 2.5ms)
2. servo's 5 to 8 all get pulsed (interupt each 10us for 2.5ms)
3. larger timer delay till 20ms is up (no interupt till 20ms)

This also could allow for a possible 32 servo's.


About I2C...


Test 1, I2C Echo Fast:
It's hard for me to measure the pluse length, but I did a for 50_000
loop with this I2C setting:
const word _i2c_bus_speed = 3 ; 300kHz

No Jitter.


Test 2 I2C, Echo Slow (send result to PC within loop):

same I2C speed setting, _i2c_bus_speed = 3, no bad data
400kHz did not return the correct result. I think this may be because
my I2C wires are too long.

This doens't make sense to me...
If I do 1 or 2 I2C Echo's, there is no jitter, if I send more then
that in the loop, there is some small sound. Servo does not move
however.
Why do I get this small sound if there is a short delay within the
loop?


Here is my I2C echo code:

for 50_000 loop
   pc_char = "A"

   -- transmit to slave
   -- we want to send 1 byte, and receive 1 from the slave
   i2c_tx_buffer[0] = pc_char
   var bit _trash = i2c_send_receive(icaddress, 1, 1)

   -- receive buffer should contain our result
   ic_char = i2c_rx_buffer[0]

   -- if either of the following lines are uncommented, I get a small
sound.
   ;serial_hw_write(ic_char) ;send recieved "B" to pc
   ;_usec_delay (10_000)

end loop

Should we worry about this small sound? It only makes this sound while
recieving 3 or more spaced I2C interupts in a row.

I will try to upload some code again soon.

Matt.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to