Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

I have a problem with a sensor of pressure anb PBP 2.42

Status
Not open for further replies.

debutpic

Member level 4
Joined
Aug 13, 2001
Messages
76
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
475
pbp negative numbers

Hi all

I have a sensor of pressure MPX 2010 DP and a PIC 16F87X, which measures a pressure and a depression.
In the atmospheric pressure ~1013 mb the ADC = 126
with a depression of 2200 mb the ADC=149
I defined one équation:pressure = (-131) X (value ADC) + 17519
Everything is good in pressure value increases, but in depression under 0
my LCD show 65500 mb,65450 mb etc...

Define LCD_DBIT 4
Define LCD_RSREG PORTB
Define LCD_RSBIT 3
Define LCD_EREG PORTB
Define LCD_EBIT 2
' Define ADCIN parameters
Define ADC_BITS 8
Define ADC_CLOCK 3
Define ADC_SAMPLEUS 50

adval var byte
adval_final var word


TRISA = %11111111
ADCON1 = %00000010

Pause 500
loop: ADCIN 2, adval
adval_final=(adval*(-131))+17519
Lcdout $fe, 1
Lcdout "Value: ", DEC adval_final
Pause 100
Goto loop
End


help me please
 

Tornado

Full Member level 3
Joined
Apr 26, 2002
Messages
167
Helped
11
Reputation
22
Reaction score
9
Trophy points
1,298
Activity points
1,265
pbp negative number

Hi Debutpic how are you?
the equation is giving negative number.

Is the output of the pressure sensor linear?
example 1013mbar = 1.000 volts, 2026mbar = 2.000 volts

If not, you have to get data for various pressure points and built a table lookup.

Regards
Tornado
 

Sobakava

Full Member level 6
Joined
Mar 27, 2002
Messages
350
Helped
8
Reputation
16
Reaction score
8
Trophy points
1,298
Activity points
3,346
lcdout

I finished a project with pressure sensor (custom made) and
PIC18F452 project with CCS. Works fine.
I seems you have problem with size of variables. In CCS
compiler you can use 32bit integers and also floating point
variables.
BASIC is not a language for microcontrollers. (It is just my
opinion) :wink:
 

Fragrance

Advanced Member level 4
Joined
Jul 26, 2002
Messages
1,191
Helped
247
Reputation
494
Reaction score
198
Trophy points
1,343
Location
East Of Earth
Activity points
8,916
mpx2010 pic18f

hI,

JUST TRY WITH LOOKUP TABLE


REGARDS
FRAGRANCE
 

Kripton2035

Advanced Member level 4
Joined
Jul 19, 2001
Messages
1,155
Helped
208
Reputation
418
Reaction score
180
Trophy points
1,353
Location
Western Europe
Activity points
7,716
basınç sensörü pbp

Sobakava said:
I finished a project with pressure sensor (custom made) and
PIC18F452 project with CCS. Works fine.
I seems you have problem with size of variables. In CCS
compiler you can use 32bit integers and also floating point
variables.
BASIC is not a language for microcontrollers. (It is just my
opinion) :wink:
it's not mine ! basic is a good language for microcontrolers. c is good for computers.
c is good also if you have floating point needs... althought some basics now have floating points.
basic is easier to learn then c
they are both usefull, each one in their own domain.
basic is also often cheaper than c...

I also made a project with on the same card with lcd display a pressure sensor, humidity sensor, light sensor and temperature sensor, all made with picbasic and it works fine too !
 

para_racer

Newbie level 4
Joined
Apr 18, 2003
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
US
Activity points
82
picbasic pro lcdout dec 32bits

If you still haven't figured it out you can give this a try. There are lots of ways around this problem and here is one example.

adcin 0, temp 'Reads ambient temperature
IF temp >= 428 THEN 'Checks if temp is greater than
'or equal to 0 deg C
temp1 = (temp-428)/9 'Calculates temp in degrees C
lcdout $FE,1 'Clear LCD
lcdout $FE,$80, "Initializing...."
lcdout $FE,$C0, "Temp = ",DEC temp1, " Deg C"
ENDIF
IF temp < 427 THEN 'Checks if temp is less than 0 deg C
temp1 = (temp-427)/(-15) 'Calculates temp in degrees C
lcdout $FE,1
lcdout $FE,$80, "Initializing...."
lcdout $FE,$C0, "Temp = ","-",DEC temp1, " Deg C"
ENDIF

You can calculate the A/D value that causes the equation to go negative and use IF statements to split the positive and negative parts. The example above splits at the 0 crossing and uses a new equation for the negative value. The new equation devides the negative sign out and then you just display a "-" charactor before the negative number.

Hope this helps.

Wade :idea:
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top