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 CCS Technical Support

Interfacing MPXA6115A pressure sensor to PIC16F877A
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah
Guest







PostPosted: Mon Jan 08, 2007 4:13 pm     Reply with quote

Model aircraft.
Hence you are unlikely to get over 1000 feet.
The sensor, in it's raw output mode, only gives one count per 30 feet, and with the errors in the ADC, this is going to be less than useful. You need to recalculate my 10000 foot example, using perhape 1000 feet. Then have an amplifier gain of 32*, instead of 3.2*. You need to add a zero pot, which you set at ground level (or a digital pot to do the same, which the computer adjusts to set ground level).
For a ten bit ADC, with 5v Vref, 5v technically = 0b10000000000, and is never reached. 0v = 0 (and is reached). Effectively there is one more count than the ADC actually achieves (for most common ADC designs).
Remember pressure falls with altitude.
You don't have to worry about ADRESL/ADRESH. You are using C (or you should be since you are on this forum...). Just have a 16bit register. Then 'value=read_adc()', gives the reading from the ADC. Personally, since you need an op-amp to give useable gain, I'd invert the signal, and set the 'zero' pot, so there is a reading of perhaps '10' counts at ground level. Then simply read the ADC, and subtract '10' to give the altitude in feet (the small offset is to remove any possibility of the signal actually reaching '0' in flight).

Best Wishes
hepless..!
Guest







PostPosted: Tue Jan 09, 2007 3:18 am     Reply with quote

how about the Vref+ and Vref- of the AN2 and AN3?
connect internally (software selectable) or externally(by +5v ad Gnd of the sensor) ?
Ttelmah
Guest







PostPosted: Tue Jan 09, 2007 3:46 am     Reply with quote

Read the replies you have been already given....
The sensor itself uses 5v, as _it's_ reference. Guess what your ADC reference needs to be...

Best Wishes
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Jan 09, 2007 5:32 pm     Reply with quote

Ttelmah wrote:
Read the replies you have been already given....
The sensor itself uses 5v, as _it's_ reference. Guess what your ADC reference needs to be...

Well, if we assume that the sensor is ratiometric w.r.t (with respect to) Vcc=5V (and this may or may not be a good assumption for this particular sensor/application). That would only imply that the ADC's references also need to be ratiometric w.r.t. Vcc=5V. For example, Vref+/- could be connected to Vcc=5V through voltage dividers.

My programmatic suggestion to our helpless..! friend would be to build a circuit on a breadboard (one way or another), find a tall building* or a sufficiently deep well and calibrate the daylight out of this circuit. Don't write 'the code' just take the sensor readings and do the calculations on paper or in excel.

* Be careful with the buildings, though. Some of them have air conditioning systems that pump the air in or out, so the pressure inside can differ from the atmospheric. Try not to test your sensor indoors.
Ttelmah
Guest







PostPosted: Wed Jan 10, 2007 3:55 am     Reply with quote

Again read what has already been posted. The chip is _not_ 100% ratiometric (manages about 96%). However given the limitations of the PIC ADC Vref range, and that pressure at sea level is close to the top of the chip's output, the chip's Vref+, is going to really have to be 5v, which must be ratiometric to the PIC's Vref+, if good accuracy is to be achieved. Then, though it'd be lovely to be able to set Vref- to only be a few hundred mV below this, to give good sensitivity, this is not supported by the PIC, and amplification is needed...

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
Goto page Previous  1, 2
Page 2 of 2

 
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