Professional Documents
Culture Documents
AN1536
INTRODUCTION
This application note describes a Digital Boat Speedometer
concept which uses a monolithic, temperature compensated
silicon pressure sensor, analog signalconditioning circuitry,
microcontroller hardware/software and a liquid crystal display.
This sensing system converts water head pressure to boat
speed. This speedometer design using a 30 psi pressure
sensor (Motorola P/N: MPX2200GP) yields a speed range of
5 mph to 45 mph. Calibration of the system is performed using
data programmed into the microcontrollers internal memory.
A key advantage in all Motorola pressure sensors is the
patented Xducer, a single piezoresistive implant that
replaces the traditional Wheatstone bridge configuration used
by competitors. In addition to the Xducer, Motorola integrates
onchip all necessary temperature compensation, eliminating the need for separate substrates/hybrids. This stateof
theart technology yields superior performance and
reliability. Motorola pressure sensors are offered in several
different port configurations to allow measurement of
absolute, differential and gauge pressure. Motorola offers
three pressure sensor types: uncompensated, temperature
compensated and calibrated or fully signal conditioned.
T e * (V22g)
where:
V
P
e
g
=
=
=
=
speed
pressure at pitot tube
specific weight of media
gravitational acceleration
V 2
8.208
For example, if the boat is cruising at 30 mph, the impact
pressure on the pitot tube is:
P[PSI]
Sensor
Motorola
Motorola, Inc.
1997 Device Data
AN1536
+8
16
+8
74HC4053
2 Y0
8
+
33078
7
6
22 pF
15
Y1
3
2
+
VOUT1
10 k
XDCR
316 k
10 k
316 k
1
22 pF
1
33078
3
+
4
2
5 Z0
4
3
Z1
DENOTES ANALOG GROUND
VOUT2
10 k
11
12
13
10
6
U31 (U37)
VOLTS OUT
+5
U37 (U31)
0
0
10
20
PRESSURE IN
30
PSI
counter, (3) turning off Q1, and (4) charging C8 and waiting for
the three (U6) comparator outputs to change from 1 to 0.
When the comparator outputs change state, the
microcontroller free running counter value is clocked into the
microcontrollers input capture register. Contained in this
register then is the number of counts required to charge C8 to
a value large enough to trip the comparators. Via software, the
voltage signal from U3 (corresponding to the applied pressure
signal) can be compared to the reference.
LM334Z3
U7
+8
+8
3
POLYCARBONATE
D2 (APPROX. 470 A)
1N914
R13
147
R14
1.5 k
5%
2N7000
C8
0.47 F
R12
4.7
5%
AN1536
1/4 U6C
LM139A
11
13
+
10
32
IC1 (PA2)
INPUT CAPTURE
REGISTER 1
R11
10 k
5%
VREF
(APPROX. 4.5 V)
+5
MC68HC711E9
Q1
27
1/4 U6B
LM139A
9
14
+
12
PA7
GENERAL PURPOSE
OUTPUT
8
FROM U37
33
IC2 (PA1)
INPUT CAPTURE
REGISTER 2
IC3 (PA0)
INPUT CAPTURE
REGISTER 3
R10
10 k
5%
+5
1/4 U6A
LM139A
5
2
+
4
FROM U31
R9
10 k
5%
34
NC
19
26
18 17 16
37 36 5
15
34 35
14 13 11
10
31 32 9
10
26 27 13
24
25
VSS
C2
0.1
CLOCK
MC145453FN
44
DATA BIT
12
40
14
39
15
GND
+5
DATA
CLOCK
36
16
38 37
24 25
LCD
DATA
29 30
VDD
U1
11
35 33 32
22 23 17
31
18
30
19
29 28
20 21
VSS
OSC 21
IN
27 26 22
IN OUT VCC
BP
R1
470 k
+5
AN1536
AN1536
+8
Table 1.
J1
J2
J3
OUT
OUT
OUT
OUT
OUT
IN
OUT
IN
OUT
OUT
IN
IN
IN
OUT
OUT
IN
OUT
IN
IN
IN
OUT
IN
IN
IN
+8
POLYCARBONATE
LM334Z3
3
D2 (APPROX. 470 A)
U7
10
1/4 U6
LM139A
C8
11
13
+
0.47 F
R13
147
2N7000
R6
10 k
8
9
R8
10 k
5%
R5 316 k
3
Z1
11 12 13 9 10
D1
R1
4.7
5%
+ 12
6
GND
1N4004
C1
0.1
42
+ C2
33 F
52
47
49
MC78L08
ACP
U1
C3
0.1
+ C4
10 F
C5
0.1
+8
44
R2
1.15 k
VREF
(APPROX. 4.5 V)
46
R3
1.5 k
50
48
MC34064
P5
U8
XIRQ 18
IRQ
19
VDD 26
R15
IC3 (PA0)
PE1
PB0
VRH
VRL
+5
+ C7
10 F
17
+5
MODB
R9
10 k
5%
34
R18
4.7 k
5%
IC2 (PA1)
R10
10 k
5%
51
C6
0.1
RESET
PC2
PC1
R4
10 k
5%
VREF
MC78L05
ACP
U2
33
45
1/4 U6
LM139A
7
+
1/4 U6
LM139A
5
2
+
C13 22 pF
2
33078
3
+
1/2 U3
4
PE0
+5
R7 316 k
LM139A
14
+
+5
PA7
1/4 U6
4
5 Z0
Y1
8 MHz
MC68HC711E9FN
+8
8
XDCR
U4
C12
22 pF
U5
1/2 U3
+
7
33078
6
C14 22 pF
1 Y1
7
R19
10 MEG
5%
Q1
43
15 5
XTAL
EXTAL
+5
+8
Zero calibrate
R11
10 k
5%
27
6 7 8 16
74HC4053
2 Y0
IC1 (PA2)
VREF
+5
R12
4.7
5%
R14
1.5 k
5%
32
PE2
PE3
PE4
PE5
PE6
PE7
PC0
R16
11*
J3
10
J2
J1
1
VSS
31
PA3
3
MODA
20
PD0
21
PD1
22
PD2
25
PD5
4
STRA
(PD4) SCK
(PD3) MOSI
R17
310 k
5%
24
23
+5
C10
0.1
TEST
JUMPERS
1
2
3
4
NOTES:
UNLESS OTHERWISE NOTED, ALL RESISTORS 1% METAL FILM.
* U5 PINS 1116 (PC2PC7) ARE CONNECTED HERE FOR
* TERMINATION PURPOSES.
AN1536
REFERENCES
Burry, Michael (1989). CalibrationFree Pressure Sensor
System, Motorola Application Note AN1097.
NOTE. THIS
AN1536
#include <io6811.h>
*/
/*
6,
1
59,
2
*/
/* erase complete */
AN1536
{
unsigned
unsigned
unsigned
unsigned
unsigned
int cntr;
/* free running timer system counter */
int r0;
/* difference between cntr and input capture
int r1;
/* difference between cntr and input capture
int r2;
/* difference between cntr and input capture
long difference; /* the difference between the upper and
instrument amplifier outputs */
unsigned long int pfs; /* result defined as percent of full scale
the reference voltage */
if (polarity == 1)
PORTB &= 0xfe;
else PORTB |= 0x1;
delay();
1 register */
2 register */
3 register */
lower
relative to
{
unsigned long int j;
int i;
j=0;
for (i=0; i<50; ++i)
{ j +=atod(); }
j=j/50;
return(j);
}
/* ################################################################### */
cvt_bin_dec ( unsigned int arg )
{
char i;
for ( i=0; i < 6; ++i )
{
digit[i] = 0;
AN1536
}
for ( i=0; i < 4; ++i )
{
if ( arg >= dectable [i] )
{
digit[i] = arg /dectable[i];
arg = arg(digit[i] * dectable[i]);
}
}
digit[i] = arg;
}
/* ################################################################### */
/* ################################################################### */
delay()
{
int i;
for (i=0; i<1000; ++i); /* delay about 15 ms. @ 8 mhz xtal */
}
/* setup i/o for the single slope a/d, initialize the spi port, then
initialize the MC145453 for output */
init_io(void)
{
char i;
/* setup i/o for the a/d */
PACTL |= 0X80;
/* make pa7 an output */
PORTA |= 0X80;
/* turn the fet on */
PORTB &= 0X7F;
/* setup the HC4053 in the Y0/Z0 connect mode */
TCTL2 = 0X2A;
/* capture on falling edge for timer capture 0,1,2 */
TFLG1 = 0X07;
/* clear any pending capture flags */
/* setup the i/o for the spi subsystem */
PORTD=0x2f; /* set output low before setting the direction register */
DDRD=0x38;
/* ss = 1, sck = 1, mosi = 1 */
SPCR=0x51;
/* enable spi, make the cpu the master, E clock /4 */
/* initialize the lcd driver */
for (i=0; i<4; ++i)
/* four bytes of zeros */
{
write_spi(0);
}
write_spi (2); /* this creates a start bit and data bit 1
for the next write to the mc145453 */
}
/* ################################################################### */
/* this is an attempt at the newton square root method */
sqrt(unsigned long b)
{
unsigned long x0,x1;
if ( b < 4 ) { b=2; return (b); }
else
x0=4;
x1=10;
while (x0 != x1)
{
if( (x1x0) ==1 ) break;
x1=x0;
x0=(( (b/x0) +x0 ) >> 1 );
}
b=x0;
return (b);
}
/* ################################################################### */
AN1536
write()
{
char i;
digit[1]=10;
if (digit[2]==0)
{digit[2]=10;}
if ( digit[2]==10 && digit[3]==0 )
{digit[3]=10;}
for ( i=1; i<5; ++i )
{
if (i==4)
write_spi((lcdtab[digit[i]])+0x80);
else
write_spi(lcdtab[digit[i]]);
}
write_spi (2);
/* this creates a start bit and data bit 1
for the next write to the mc145453
*/
}
write_spi( char a )
SPDR=a;
while ( ! ( SPSR & 0x80 ) ) {}
}
/* ################################################################### */
/*
J2
J1
1 = jumper removed
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
*/
setconfig()
{
char i;
for ( i=0; i<125; ++i )
delay();
/* to let the charge pump come to life wll */
i = PORTC & 0x07; /* and off the unused bits */
if ( i == 7 )
display_speed();
if ( i == 6 )
setup_error(); /* nonvalid pattern output SE on display*/
if ( i == 5 )
{write_eeprom(30,&XDCRMAX); /* xdcr is 30 psi */
display(30);
}
if ( i == 4 )
{write_eeprom(15,&XDCRMAX); /* xdcr is 15 psi */
display(15);
}
if ( i == 3 )
fullscale_calibrate();
if ( i == 2 )
zero_calibrate();
if ( i == 1 )
display_pressure();
else
display_speed();
}
/* ################################################################### */
display(char d)
10
{
if (d==30)
{
write_spi(0);
write_spi(0);
write_spi(47);
write_spi(95);
}
if (d==15)
{
write_spi(0);
write_spi(0);
write_spi(6);
write_spi(109);
}
/*
/*
/*
/*
AN1536
write_spi(2);
while(1);
}
/* ################################################################### */
fullscale_calibrate()
{
int i;
long int temp;
union bytes average;
temp=0;
average.l = cala2d(); /* get the average of 50 a/d conversions */
for ( i=0; i<4; ++i)
write_eeprom(average.b[i],EEPROM+i+4);
write_spi(0);
write_spi(113);
write_spi(113);
write_spi(113);
write_spi(2);
while(1);
/*
/*
/*
/*
}
/* ################################################################### */
zero_calibrate()
{
int i;
long int temp;
union bytes average;
temp=0;
average.l = cala2d(); /* get the average of 50 a/d conversions */
for ( i=0; i<4; ++i)
write_eeprom(average.b[i],EEPROM+i);
write_spi(0);
write_spi(95);
write_spi(95);
write_spi(95);
write_spi(2);
while(1);
}
/*
/*
/*
/*
/* ################################################################### */
/* speed=8.208(square root(%full scale*transducer full scale)) */
display_speed()
{
long atod_result;
unsigned int j;
while(1)
{
atod_result = integrate(); /* read the a/d */
atod_result=( (atod_result*10000) / (HIATODADZERO) ) * XDCRMAX;
atod_result=sqrt(atod_result);
atod_result=(atod_result*8208)/10000;
j=atod_result;
11
AN1536
if (j<50)
{ j=0; }
cvt_bin_dec ( j );
write();
}
}
/* ################################################################### */
}
/* ################################################################### */
setup_error()
/* write SE on the display */
{
write_spi(0);
write_spi(109); /* S */
write_spi(121); /* E */
write_spi(0);
write_spi(2);
while(1);
}
/* ################################################################### */
main()
{
init_io();
setconfig(); /* determine how to function */
while(1); /* should never return here except after calibration */
}
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding
the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and
specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters which may be provided in Motorola
data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including Typicals
must be validated for each customer application by customers technical experts. Motorola does not convey any license under its patent rights nor the rights of
others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other
applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury
or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola
and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees
arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that
Motorola was negligent regarding the design or manufacture of the part. Motorola and
are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal
Opportunity/Affirmative Action Employer.
Mfax is a trademark of Motorola, Inc.
How to reach us:
USA / EUROPE / Locations Not Listed: Motorola Literature Distribution;
P.O. Box 5405, Denver, Colorado 80217. 13036752140 or 18004412447
12
AN1536/D
Motorola Sensor Device
Data