16 Channel ADC + 16 RC Servo Motor + 1 RS232 + PIC microcontroller

General Robotics Forum - All aspects of robots and their applications. 

Page 1 of 2       1 2 > last >> Bookmark this page:  YahooMyWeb Yahoo!  Google Google  Windows Live Favorites Windows Live  del.icio.us del.icio.us  digg digg  Add to Netscape Netscape
Subject Author Date
16 Channel ADC + 16 RC Servo Motor + 1 RS232 + PIC microcontroller Roberto 09-30-2006
If you were  Registered and logged in, you could reply and use other advanced thread options
Posted by Roberto on September 30, 2006, 10:22 pm
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


Posted by Buddy Smith on September 30, 2006, 11:59 pm
> Hello Everyone,

> I am a beginner hobbiest in embedded systems.

Thanks for being upfront and honest. You might get some good results.

Now, I read your description. But, I think it'd be better if you tell
us what you're trying to build. What's the purpose?

Why must it have 16 bit AD converters? Do you know how very unlikely it
is that you will get that much resolution?


> 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)

If you REALLY need 16 bits, you will need very precise analog
circuitry...

> ii. 16 RC Servo motor driver (capablity of generating 1-2ms RC
> servo pulses with 10 bits resolution, for 16 RC servo motors)

Again, where does 10 bits come from? What's it actually doing?
Does it need to be one CPU, or can you have more than one?

> iii. 1 RS232 port to communicate with a PC
> iv. PIC microcontroller (all the above devices will be operated by
> a PIC Microcontroller)

Why does it have to be a PIC? :)

> PIC will run the following algorithm;

> 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

500 times per second * 16 channels * 2 bytes / channel = 16000
bytes/second. Now, RS232 can do that, but that's a pretty heavy load on
your PIC.... (I'm assuming you are transmitting them as binary values.
If you convert the numbers to ASCII, you could be sending much more
data)

> I will borrow an ICD-2 and MPLAB for the project and I will use
> Microchip's PIC C compiler.

How much time do you have? This is a non-trivial task. Find someone
near you with some experience in this field.

Give us some more detail on your project and you'll probably get more
feedback.

Hint: If you've never used microcontrollers before, start with a
blinking LED....

ttyl,

--buddy

Posted by on October 2, 2006, 8:11 am
Hello,

> 500 times per second * 16 channels * 2 bytes / channel = 16000
> bytes/second. Now, RS232 can do that, but that's a pretty heavy load on
> your PIC.... (I'm assuming you are transmitting them as binary values.
> If you convert the numbers to ASCII, you could be sending much more
> data)

I assumed that data over RS323 to be serial asynchronous format
which typically includes 1 start bit and 1 stop bit (no parity).
Therefore every 8 bit data (1 byte) are represented by 10 bits on the
wire. At 16000 bytes/second, the wire rate would be 16000 * 10 = 160000
bits per second. This is faster than typical RS323 line rate of 115200.


Regards,
-Pandit


Posted by on October 5, 2006, 12:15 pm
Have you seen this?

http://www.avrfreaks.net/index.php?module=Freaks%20Devices&func=displayDev&objectid ’

Might go some way to sorting you problem. A storming good chip I think!
and you can use more of the serial channels to get your data out.

Mark

ppanbura@yahoo.com wrote:
> Hello,
> > 500 times per second * 16 channels * 2 bytes / channel = 16000
> > bytes/second. Now, RS232 can do that, but that's a pretty heavy load on
> > your PIC.... (I'm assuming you are transmitting them as binary values.
> > If you convert the numbers to ASCII, you could be sending much more
> > data)
> I assumed that data over RS323 to be serial asynchronous format
> which typically includes 1 start bit and 1 stop bit (no parity).
> Therefore every 8 bit data (1 byte) are represented by 10 bits on the
> wire. At 16000 bytes/second, the wire rate would be 16000 * 10 = 160000
> bits per second. This is faster than typical RS323 line rate of 115200.
>
>
> Regards,
> -Pandit


Posted by on October 6, 2006, 10:14 am
Hi Mark,

THANK YOU for the URL.
Do you know if there is a small, low-cost developmet board for it?

Roberto

> Have you seen this?
>
http://www.avrfreaks.net/index.php?module=Freaks%20Devices&func=displayDev&objectid ’
> Might go some way to sorting you problem. A storming good chip I think!
> and you can use more of the serial channels to get your data out.
> Mark




Page 1 of 2       1 2 > last >>

The site map in XML format XML site map
other useful resources:
Official Robosapien Website
Lego Mindstorms Website

Contact Us | Privacy Policy