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

Problem with MCP 3208 using the standard driver

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







Problem with MCP 3208 using the standard driver
PostPosted: Sat Oct 09, 2004 12:02 pm     Reply with quote

Hi,

I have used the standard driver file MCP3208.c that comes with CCS C compiler package to access the ADC. Although the ADC reads accurately,

I find that it is not able to read changing voltages. Here is a sample of the data read ( all values are in volts, Time span between samples are 581 Milliseconds).

0.1933594
0.2285156
0.2109375
0.2109375
0.2109375
0.1933594
0.1757813
0.1582031
0.1582031
0.140625
0.140625
0.140625
0.1230469
0.1230469
0.1230469
0.1230469
0.1230469
0.1054688
0.1054688
0.1054688
0.1054688

The same voltages are read quite accurately by a PIC 16F877 mcu.

Kindly advise wether the driver code is OK or does it need any changes in delays.

thanks
arun
Humberto



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

View user's profile Send private message

PostPosted: Sat Oct 09, 2004 4:00 pm     Reply with quote

Quote:

I find that it is not able to read changing voltages.


Pls could you descibe a little more what the problem is?
Also post the relevant functions calls and delays involved, and a small desciption
of the hardware regarding the analog input, it seems like an capacitive input.

regards,

Humberto
Ttelmah
Guest







Re: Problem with MCP 3208 using the standard driver
PostPosted: Mon Oct 11, 2004 10:46 am     Reply with quote

arun wrote:
Hi,

I have used the standard driver file MCP3208.c that comes with CCS C compiler package to access the ADC. Although the ADC reads accurately,

I find that it is not able to read changing voltages. Here is a sample of the data read ( all values are in volts, Time span between samples are 581 Milliseconds).

0.1933594
0.2285156
0.2109375
0.2109375
0.2109375
0.1933594
0.1757813
0.1582031
0.1582031
0.140625
0.140625
0.140625
0.1230469
0.1230469
0.1230469
0.1230469
0.1230469
0.1054688
0.1054688
0.1054688
0.1054688

The same voltages are read quite accurately by a PIC 16F877 mcu.

Kindly advise wether the driver code is OK or does it need any changes in delays.

thanks
arun

The most likely problem is that your voltage source actually has significant high frequency noise. The MCP, will take a reading in just 1.5 clock cycles of the chip. The PIC, instead has a much larger capacitor, and takes typically more than twenty times as long to actually acquire a voltage. The internal capacitance used in the MCP, is just 20pF, in series with a 1K switch resistance, against the PIC, having 120pF, in series with about 8K for the switch resistance and other losses. About a 50* change in the maximum frequency that can be recorded...
It is also pointless to display 6 digits (and could well mislead you as to the real 'accuracy'), when the chips only support 12bit accuracy.
The MCP, is _better_ at reading changing voltages than the PIC, but can easily show problems with the voltage source, the reference source, and the board layout itself, that the PIC will not register.

Best Wishes
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