> (at last) I took a look at your servo library. You took a
> well-engineerd approach, with cpu-efficient code with high resolution
> as a result (afaik - I did not have a chance to run it yet...).

Thanks Joep, it is good to hear this from you since you where quite
concerned at the time I was writing it. Your concerns helped me create
a better library :)

> I do find the documentation a bit small though. Since there is no
> description of the method (principle) you use, I had to reverse
> engineer the code to know what's happening. And I still have not
> figured out parts of it, like what the purpose of line 294 (if
> servo_1_to_8_num < 8 then) is. Can you enlighten me?

A quick glance shows that the line "servo_1_to_8_num" may not be
needed. I can't quite remember. I'll try to find time to look at this.
If you comment it out, does it still work ok?

> I also see that sometimes you number servo's from 1 and in other cases
> from 0. Like _servo_1_to_8_number_count that counts from 0 to 7...
> Confusing... Why not make this all 0-based? Embedded programmers are
> used to this!

I had chosen to number actual servos from 1 to 24. To save memory
space, some variables where named 0-7. I think I remember also that
having no servo number 0 actually helped me later on when I made the
I2C slave servo controller.

Do you really think it should be changed now?

>
> Btw: changing line 147 from bit to byte like:
> var byte _servo_1_to_8_isr_count = 0     -- ISR step count (0 - servo
> pulse / 1 - idle state)
> saves (in my case) 23 bytes of code and a byte of ram.

Why does a byte save space over a bit?

>
> Also, using the processor delay routines in apps (samples) is a bad
> example IMO, since it uses more program memory at each call. (And you
> also miss the opportunity to show an other usefull lib to new users).
> Changing to  the four delays in delay_100ms(10) in your sample saves
> an other 27 bytes (at the one-time expense of 3 bytes ram). Each
> additional delay takes 5 bytes, while the compiler delay takes (in my
> case, 16f73 @ 20 MHz) 21 bytes.

A delay is a delay, weather I use _usec_delay or the delay library. I
did not require a exact delay. I would use the delay library more if
delay_1ms was changed to a word input variable. This would allow me to
create 1sec delays.

> I also expect we can improve if  servo_1_to_8_on is checked with a
> bit-mask rather than the bitwise checks you do now, and if
> _servo_1_to_8_set_level() are duplicated of ON and OFF (they are
> inline, so they are duplicated in the target already).
> Also, make 'reverse' optional allows to save an other 64 bytes (in my
> 2-servo setup).
> All this stuff together saves 17% code memory and saves some cpu cycles too.

Could you please give me an example of a bit-mask compared to bitwise?

Thanks Joep!
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