Hello Everyone,
I am a beginner hobbiest in embedded systems. I want to build a system which will have i. 16 channel, 16 bits ADC with SPI interface (it could be two 8 channel ADC) ii. 16 RC Servo motor driver (capablity of generating 1-2ms RC servo pulses with 10 bits resolution, for 16 RC servo motors) iii. 1 RS232 port to communicate with a PC iv. PIC microcontroller (all the above devices will be operated by a PIC Microcontroller)
PIC will run the following algorithm;
A. Initialise devices B. Create a timer interrupt service routine which will read the 16 analog signals via ADC at 500 times per second and calculate a running averagefor each channel C. Read ADC channels (16 channel, 16 bits resolution) and calculate running averages for each channel D. Transmit the calculated averages (16 channel, 16 bits resolution) to a PC via RS232 channel E. Every 20ms. the RC servo motor positions (10 bits resolution) data will be updated with the calculated averages F. Goto step C
I will borrow an ICD-2 and MPLAB for the project and I will use Microchip's PIC C compiler.
Can someone out there with PIC and MPLAB experience help me on PIC-C code segments for I. How to create an interrrupt service routine which will be called
500 times per second? II. How to read data from SPI devices? III. How to generate 16 RC servo pulses with 10 bit resolution (this seems to be the most difficult)? IV. How to send data via RS232?I do appreciate if you can share your PIC C code snips.
Thank you
Roberto Hawkowski