Servos Propeller GCC - Need to Drive 8 servos
BTL24
Posts: 54
I have been looking for a propeller C routine that will drive 8 servos in background. The "servo.h" library functions only support 7 servos, if memory serves.
1) Has there been an update to the C Libraries of late that support 8 or more servos?
2) Is there an assembly routine that I can call from a propeller C program that runs in background that will drive 8 servos?
I have searched the forums, but came up dry (probably due to my inadequacies of using advanced search engine).
Regards,
BTL24 (Brian)
1) Has there been an update to the C Libraries of late that support 8 or more servos?
2) Is there an assembly routine that I can call from a propeller C program that runs in background that will drive 8 servos?
I have searched the forums, but came up dry (probably due to my inadequacies of using advanced search engine).
Regards,
BTL24 (Brian)
Comments
I'll be happy to help you write a C interface and wrappers for it if you post a first attempt.
Forum search is to blame for inadequacies. Just use google. " site:forums.parallax.com servo "
I assume this will run in parallel with my current executive code that will store off the 8 servo commands to this routine. I will be reading continuously from an SD card with standard file I/O. I assume this servo code wont interfere with those operations.
I am currently using servo_angle function from servo.h libraries and all is well. Just don't want to mess something up.
Thanks again...
Brian (BTL24)
Start with making a C version of servo32. Then add API candy wrappers that have similar names to servo.h functions.
The hardest part of making a C -> PASM interface is by making a mailbox structure for communications.
The mailbox in spin appears to be this:
You can include these files in the SimpleIDE project directly to use the PASM.
Servo32v9.spin
Servo32_Ramp_v2.spin
The PASM code symbols for each of those will be:
extern int binary_Servo32v9_dat_start[];
extern int binary_Servo32_Ramp_v2_dat_start[];
I suggest looking at the SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial project for an example to get started.
If that turns out to be "just too hard" try the spinwrap program. http://forums.parallax.com/showthread.php/153919-SpinWrap-a-tool-for-allowing-C-or-C-to-use-Spin-Objects?p=1243144&viewfull=1#post1243144
Having just updated my "learn" folders tonight in getting to review the SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial project , I happened to notice that the latest version of the C library "servo.h" now handles 14 servos or more!
This solves my problem immediately. I will be testing over the next several days and report status.
Jazzed... I will put the spin code on hold until I check this out. I will be getting back to it as it is a great example on how to include Spin programs in C.
Regards,
Brian (BTL24)
Well Surprise... Surprise! When I compiled my old program with new libraries, it ran out of Hub memory (Over by 4,824 bytes).... OUCH! LOL.
But, I converted some functions like scanf to getStr and saved a bundle of memory. Whew! Still need to try out that 8th servo...but this little issue got in the way.
Will keep you posted...
Regards,
Brian (BTL24)
The 8th servo works like a champ! Very pleased my friends... very pleased.
I even may expand my project more and take advantage of the 14 servos. Nice to have margin.
Regards,
Brian (BTL24)
Thanks... I will take a look.
Regards,
Brian