Hi Matt, An impressive step forward!
Some suggestions though: 1. There are a lot of 'meaningless' numbers that are (as far as I can see) also dependant on the oscillator frequency, number of servos an servo resolution. Please change the code so: - The 'resolution' has a meaning, like steps, microseconds etc. (the comment says it are 10us steps, but I do not see how you achieve this) - 0-255 respresents a full servo range (0.5 - 1.5 ms) or 0.. 2.55ms or alike - Thus - the libary works independant of the clock rate (with limits, say at least from1 MHz up) 2. Change the paramter sequence; first servo-number, then data: procedure servo_move( byte in servo_number, byte in value) (I think it is okay to change value from word to byte, or do you think otherwise?) 3. I don't see why you have a _servo_count_* for each servo. Is one such counter for all servos not enough? 4. _servo_pulse_* is ideal to implement as an array. The isr code can be implemented as a loop, making it smaller (and just a hair slower). Joep 2010/1/29 mattschinkel <[email protected]>: > I modifed my servo lib, it now uses ISR and can run up to 8 servo's. > It sends 1 pulse every 4ms. > > I did test sending data via serial port at 115200 baud rate which did > work perfect while 8 servos where running. > > I still have not tested what will happen if I send it I2C commands > which cause interupts. What I2C sample should I use to test this? > > > Please take a look. > > Matt. > > On Jan 25, 12:38 pm, Sebastien Lelong <[email protected]> > wrote: >> I'd say with pre/post scalers. With pwm_hardware libs, I can produce a 440Hz >> (A3 note, see tutorials), that's a pulse each ~2ms, near servo expectations >> I think >> >> Cheers, >> Seb >> >> 2010/1/25 mattschinkel <[email protected]> >> >> >> >> >> >> > When I was looking at servo's, I tried with PWM but I could not get >> > PWM to slow down enouf. >> >> > Is there any way to slow down PWM without changing the crystal speed >> > to something lower then 20mhz? >> >> > Matt. >> >> > On Jan 22, 3:28 pm, Sebastien Lelong <[email protected]> >> > wrote: >> > > > You obviously haven't tried it. If there is no load at the servo >> > > > (e.g., when it is used to aim a sharp sensor), you can hear each >> > > > irregular pulse. It moves slightly off and then corrects again. But >> > > > when there is load on the servo, it moves away more (and takes more >> > > > time to correct). >> >> > > I'll add all servos are rather unique, interrupted pulse may not have the >> > > same impact. >> >> > > > I did numerous implementations of servo control and the reason I did >> > > > not get to writin a lib yet is because it is pretty time-consuming to >> > > > do it right. And IMHO it is not worthy to jallib to release a clumsy >> > > > lib. But maybe my standards are too high and adds this library value >> > > > to jallib, even if it does work properly when interrupts are used... >> >> > > If this is that time-consuming to reproduce PWM outputs in software, we >> > > should use a dedicated chip (I'm back on this, no surrender Joep). Few >> > > months ago, I found the following links: >> >> > > - IC to control LEDs with PWM. May be used for PWMhttp:// >> >www.maxim-ic.com/quick_view2.cfm/qv_pk/4539 >> > > - another IC for LEDs control, this one has been used in Arduino >> > project >> > > IIRC:http://focus.ti.com/docs/prod/folders/print/tlc5940.html >> > > - some thoughts about PWM software implementation: >> >http://letsmakerobots.com/node/6282 >> > > - Microchip AN about PWM software impl. for LEDs, too: >> >http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeI... >> >> > > As a reminder, "servo controller" topic on jallib: >> >http://groups.google.com/group/jallib/browse_thread/thread/53603e9bf0... >> >> > > > > On Jan 22, 1:46 pm, Sebastien Lelong <[email protected]> >> > > > > As far as I'm concerned, I have not much problem with PIC being >> > dedicated >> > > > to >> > > > > moving servos, without being able to do other things. I see this as >> > part >> > > > of >> > > > > a servo controller board (even shield, for jaluino), with a dedicated >> > PIC >> > > > on >> > > > > it. >> >> > > > It is not about a board dedicated to move servo's. It is about a board >> > > > dedicated to moving *one* servo. >> >> > > Yes, of course. I mentioned 8 servos for one PIC. >> >> > > > And what is the value of board that can controle a servo, but has >> > > > (hardly) any ability to receive information on the desired setpoint of >> > > > this library? >> >> > > > IMO a proper library should enable an application (servo controller) >> > > > that support multiple servo's and communication (i2c, serial) at the >> > > > same time. >> >> > > Sure ! >> >> > > Cheers, >> > > Seb >> >> > -- >> > 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]<jallib%[email protected]> >> > . >> > For more options, visit this group at >> >http://groups.google.com/group/jallib?hl=en. >> >> -- >> Sébastien Lelonghttp://www.sirloon.nethttp://sirbot.org- Hide quoted text - >> >> - Show quoted text - > > -- > 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. > > -- 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.
