Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MPX4115 Pressure sensor based on PIC16F877a

Status
Not open for further replies.

Ali A. Noori

Newbie level 3
Joined
Mar 14, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,306
Hi
I found this Website very interesting and I have some equations in my attached project
I designed my project based on PIC 16F877A by using Proteus 7.6 and Proton IDE basic
the result of pressure in LCD is incorrect

Basic Code In PROTON PROGRAM
'============================
Device = 16F877A
XTAL 4
Cls
ALL_DIGITAL true
' LCD connections
'*****************
LCD_DTPIN PORTB.0
LCD_RSPIN PORTC.1
LCD_ENPIN PORTC.0
LCD_INTERFACE 8
'*****************
' Define A/D converter parameters

Declare ADIN_RES 8 ' 8-bit result required
Declare ADIN_TAD FRC ' RC OSC chosen
Declare ADIN_STIME 50 ' Allow 50us sample time

' Variables
'
Dim R As Float untitled.JPG' A/D converter result
Dim P1 As Float ' pressure in mmhg
Dim P2 As Float
Input PORTA.0 'TRISA = 1 ' RA0 (AN0) is input
Output PORTB 'TRISB = 0 ' PORTB is output
DelayMS 500 ' Wait 0.5sec for LCD to initialize
'
' Initialize the A/D converter
'
ADCON1 = 0 ' Make AN0 to AN4 as analog inputs, Analogue to Digital Converter control register,
'that chooses which pin is analogue and which is digital.

' make reference voltage = VDD
ADCON0 = %11000001 ' A/D clock is internal RC, select AN0 ,Analogue to Digital Converter control register.
' Turn on A/D converter
Cls ' Clear LCD
loop:
'
' Start A/D conversion
'
ADCIN 0, R ' Read Channel 0 data
P1= (0.1087*R + 9.0175)
P2= P1 *760/101.325 ' convert 760mmhg=101.325 kPa


Print At 1,1,"Pressure= ",DEC2 P2, "KPa" ' Display decimal part
DelayMS 250 ' Wait 1 second
GoTo loop ' Repeat
End
 

See if you have to configure CMCON register in code. You have to disable Comparator register on PORTA to use ADC. If that doesn't work then your conversion formula is wrong. Provide the website where the project is mentioned.

See attached project.
 

Attachments

  • mpx4115.rar
    61.4 KB · Views: 100
  • max4115.jpg
    max4115.jpg
    258.3 KB · Views: 157
Last edited:

I don't know the language you are using but give me the formula for different conversion I can help you in another programming language c,Mikroc or assembly.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top