CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

external ADC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
DKH
Guest







external ADC
PostPosted: Tue May 01, 2007 12:22 pm     Reply with quote

Does anyone here have an example how to conect and program an external ADC(for example ADC0804)?

tks

Nina
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue May 01, 2007 1:41 pm     Reply with quote

Start with EX-AD12.C in your examples folder. It uses either the LT1298 or the MCP3208 converters, but it is a place to start.
_________________
The search for better is endless. Instead simply find very good and get the job done.
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

external adc
PostPosted: Tue May 01, 2007 2:43 pm     Reply with quote

thanks SherpaDoug....do you have any example showing how to conect and program this devices?

tks

Nina
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 01, 2007 2:58 pm     Reply with quote

One question would be, why do you want to use an external 8-bit A/D
chip when your PIC likely has an internal 10-bit A/D ?
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

external ADC
PostPosted: Tue May 01, 2007 3:25 pm     Reply with quote

PCM programmer..

My load cell has 10000 lbs (at full load) if I have a 10 bits ADC I just have 1024 reading then I would have reading like...10, 20, 30,40,50...100,110,120,130...until 10000 lbs. I need more precision thats why I need use an external ADC

tks

nina
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 01, 2007 4:15 pm     Reply with quote

You need to read posts like this one:
http://www.ccsinfo.com/forum/viewtopic.php?t=30517
Your problem is not really how to do the interface, it's how to do the
PCB layout so the noise is kept at a very low level.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue May 01, 2007 9:32 pm     Reply with quote

Quote:

Does anyone here have an example how to conect and program an external ADC(for example ADC0804)?

You will find how to connect the ADC0804 to any uP it in the datasheet.
It has 8 bit paralel output [DB0...DB7] ChipSelect, Read, Write and an Interrupt
signal that will give a down level at the end of conversion cycle.
It is quite old and it will be out of spec according to your project needs.

Quote:

My load cell has 10000 lbs (at full load) if I have a 10 bits ADC I just have 1024 reading then
I would have reading like...10, 20, 30,40,50...100,110,120,130...until 10000 lbs.
I need more precision thats why I need use an external ADC

The point is, as PCM Programmer said, why are you trying with an external 8
bit ADC while you already have a built in 10 bit ADC module inside the PIC.
To get a monotonic reading increment of 1 lb you will need a resolution of 14 bits.


Humberto
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

external ADC
PostPosted: Wed May 02, 2007 6:53 am     Reply with quote

sorry humberto...I missed when I sad ADC0804. I intend use a ADC (at least 16 bits resolution).

Thanks for explanation about how to conect external ADC, I will check and if I have some doubt I will post here.

About programming PIC to get reading from external ADC. Do I just need do this or do I need something else?

setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
delay_ms(5);
printf("-------Ready to read-----");

while (TRUE)
{

set_adc_channel(0);
delay_us(20);
valor1=read_adc();
delay_us(30);
printf(")%4.0f ->%1.2f :::",valor1,volt1);
printf(lcd_putc,"%2.2f",valor1);
}


Tks

nina
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group