What cruel teachers you have. 20 hours is enough to do some preliminary research. In any event real servo systems have overshoot and damping issues which you need to consider. Start with the application note on Microchip's page which shows how to build a servo-controlled DC motor system that accepts commands much like yours. Note that it was built around a 17C42 which has hardware PWM. If you get it done in 20 hours, consider a career in embedded systems. You are clearly a genius and will dominate the field. Best of luck > ---------- > From: Tim Kerby[SMTP:tim.kerby@UKONLINE.CO.UK] > Reply To: pic microcontroller discussion list > Sent: Thursday, December 11, 1997 8:00 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Servo Laser Control > > Hi > For my higher (Scottish version of A level) Computing Studies > investigation > I am looking into the control of laser light shows by computers. As > well > as contacting various companies, I want to build a PIC based servo > controller. This will accept RS232 from a PC giving the following > data > > H0 to H255 - Horizontal position from leftmost (0) to rightmost (255) > V0 to V255 - As horizontal but vertical control. > S0 or S1 - shutter closed (1) and open (0) > > These will be in the form of a bite of ascii as an identifier (H, V or > S) > followed by the value. > This will be carried out on the 16C84 which is easily adequate for > this > processing. > > To save me time on coding and working out how to do the serial control > and > the servo control I would like some help. This is because I only have > 20 > hours from start to finish (cruel computing teachers - who can do much > in > this time). > > I would like people to send well documented serial and servo control > software that they use and know works. Some theory on the servo side > would > be nice too. What really annoys me is the lack of details such as > pinout > to the devices. Circuit diagrams would be even nicer. > > I understand that servos have power and a PWM input line that > translates to > position but can the pic drive the PWM line directly? The servos draw > a > max of 500ma but I presume this is from the power lines. > > > My plan is this > > 1 All initialisation carried out > 2 Start values are placed in a variable (to center the servos 080H) > 3 Loop with the correct pulsing to both servos. BTW how do you do > both at > once? > Set shutter appropriately (solenoid) > > Interrupt: On change of serial line > 1 Read serial inputs (all 3) and store in 6 bytes of memory > 2 Look at identifier and place each variable into appropriate register > (called in main loop) > 3 Return to the start of stage 3 above with new data. > > > > Can anyone help? If you have an include or header to do serial and > servo > stuff then this would be best but I can make do with any well > documented code. > > > > Send to my private email (tim.kerby@ukonline.co.uk) if you are > attatching > code. This wont clog the list. > > > Thankyou very much > > Tim Kerby > > > > ------------------------------------------------------------------ > Personal Web Pages: http://web.ukonline.co.uk/members/tim.kerby/ > Email: tim.kerby@ukonline.co.uk > ------------------------------------------------------------------ >