Re: Motion control and RELATIVE position problem
- From: Tim Wescott <tim@xxxxxxxxxxxxxxxx>
- Date: Mon, 08 Aug 2005 11:19:47 -0700
Scott Seidman wrote:
-snip-
Take the applications notes for what they are-- thumbnail sketches on how to get a job done--not necessarily the best way to do it, and not even guaranteed to work. Read ALL the relevant notes, and take the best bits and pieces from each. You should be able to wade through the software and figure out how to provide the algorithm with an absolute command instead of a relative command. I think Tim Wescott has published a PID algorithm in the past that is relatively easy to port to PICs, as well.
Easy to port if you know how to make a PIC do the math. If you just take the code as written it will be a couple of orders of magnitude slower than if you use fixed-point arithmetic with hand-optimized multiplies in assembly.
I know it seems frustrating, but once you start playing with something as deeply embedded as this, you should jump in with both feet. It's tough to make things work unless you understand the task at a fairly fundamental and algorithmic level, and can make the system do exactly what you need it to do. If you're not willing to get comfortable at this level, then each task you take on has a real possibility of turning into a can of worms. You invest enough time in it to realize its a hair over your head and then pick another tack, so it can be a huge resource waster if you're not careful. Even if you have the skills, if you can find a reasonable off-the-shelf solution, its often cheaper in the long run than rolling your own embedded system.
Ask for a sample snippet of code before you proceed, though. I'm working with one of those off-the-shelf solutions for a PIC and it could be used as an example of unmaintainable code. Partially this is because it's heavily optimized, and the PIC is not amenable to fast, well-structured C code, but partially it's because (in my humble opinion) the guy writing the code didn't really pay attention to maintainability.
Yes it will. When I interview people I ask questions and listen to answers to find out what they've actually done, and at what level. To earn top points from me folks need to demonstrate that they can understand all levels of a development effort, and that they know the level that they're being hired for intimately.
Otherwise, you might as well go with the $150 controller from jrkerr--it really seems to be quite a deal. If you're a student, or not under any time pressure, keep hammering away at your own custom-tailored embedded solution--it's good for your soul, and will make you MUCH MORE VALUABLE.
FWIW, I ended up building a PID controller because I needed to drive it with an analog signal, and get the position output with a D/A and the reasonable commercial systems I could find used a 10-bit A/D, which wasn't high enough resolution for my needs, and didn't provide D/A outputs.As a last note _I_ recommend avoiding PICs entirely. Atmel makes the AVR line of microprocessors that has all the same features of the PIC, plus an instruction set that was designed from the get-go with input from a compiler group. As a result you have much less temptation to write terribly structured code "because it'll be more efficient".
As a last note, I recommend avoiding the 17C line of PIC entirely. It's userbase is extremely limited. Stick with "F" chips--you have a lot more flexibility while debugging code. Move to the 18F line (if you can afford the compiler), or stick to the 16F line, and you're more likely to get support from a big userbase. This doesn't seem important, until you get a note from a user that points out a mistake in the documentation for the PIC you're trying to use, or a small hardware bug with a workaround. Input like that can keep you from tearing out your hair, and a large user base is the only way to get it.
I would apply the same advice to the 8051 but (alas) it is just too damn popular.
And lest I start a flame war: These are just my opinions, and I may design a PIC (or an 8051) into a product tomorrow (particularly if the client pays by the hour :). There are huge numbers of good products that are based around PICs and 8051s, so even though _I_ think they should all be used as doorstops shouldn't keep _you_ from making good stuff with them.
--
Tim Wescott Wescott Design Services http://www.wescottdesign.com .
- Follow-Ups:
- Re: Motion control and RELATIVE position problem
- From: Scott Seidman
- Re: Motion control and RELATIVE position problem
- References:
- Motion control and RELATIVE position problem
- From: louis_reginaldjean
- Re: Motion control and RELATIVE position problem
- From: Tim Wescott
- Re: Motion control and RELATIVE position problem
- From: Scott Seidman
- Re: Motion control and RELATIVE position problem
- From: louis_reginaldjean
- Re: Motion control and RELATIVE position problem
- From: Scott Seidman
- Motion control and RELATIVE position problem
- Prev by Date: Re: Motion control and RELATIVE position problem
- Next by Date: Re: Motion control and RELATIVE position problem
- Previous by thread: Re: Motion control and RELATIVE position problem
- Next by thread: Re: Motion control and RELATIVE position problem
- Index(es):
Relevant Pages
|