Vincent Chan wrote: > > hi, > I just begin programming pic. I have question about rc servo, motor a nd > sensor. Do you know where can I find above items for cheap price? Cost is > my most important factor. > I am also wondering what kind of above items I should use. I am just > planning to build a little car that can detect object and avoid to collide > with it and find a way around the object. The main component of my car are > just rc servo, motor, sensor, a regular(2"x6") breadboard(don't plan to do > soldering my 16F84 for now)and chip; so should not weight too much. > Also, I am wondering if I have to use seperate chips for each componen t. > Do you know if there are any sample code and circuit for controller mo tor, > sensor and rc servo that I can read as reference? > > thanks. bye. Vincent, RC servos use a variable pulsewidth signal proportional to arm position or speed. U can use one PIC pin per servo for control ie -> set up tmr0 for high frequency interupt. -> use one counter per channel; decrement every interupt. -> every interupt check counter for equal setpoint; if equal then turn pulse on -> every time a counter reaches zero turn pulse off. -> you can use AN513 as a guide to analog to digital conversion off digital pins, I have developed similiar code for this that goes even further and uses macros. for direct control of a DC motor I recomend the SGS Thomson L293D as a quick and easy solution, two years ago I trained a PIC16C84 to bidirectionally drive two geared motors using an X-Y joystick under I.R. control with this setup. The L293D is power hungry even in low power mode so helps to use a transistor/mosfet to it for a power down mode. Be carefull driving mosfets in a bridge configuration, the internal diodes can "cog" the motor and prevent proper PWM control with out correct drive sequence, this takes 4 pins per bridge where as you can get away with only 2 for a L293D bridge(2 per package). regards, Graham Daniel