22

Sensor interfacing in 8051

Embed Size (px)

Citation preview

Page 1: Sensor interfacing in 8051

Microcontroller

to Sensor

Interfacing

Techniques

GROUP MEMBERS

IRFAN AHMAD

MUHAMMAD JUNAID

MUHAMMAD ISHAQ

ALAM NASIR

Micro-controllers are useful to the extent that they communicate

with other devices such as sensors

motors switches keypads displays memory and even other

micro-controllers

Many microcontroller designs typically

mix multiple interfacing methods In a

very simplistic form a microcontroller

system can be viewed as a system

that reads from (monitors) inputs

performs processing and

writes to ( controls ) outputs

Input Devices Microcontroller Output

Devices

Microcontroller Interfaces

Analog Interface

Analog InputsOutputs

Sensor Types Temperature

Sensors

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 2: Sensor interfacing in 8051

Micro-controllers are useful to the extent that they communicate

with other devices such as sensors

motors switches keypads displays memory and even other

micro-controllers

Many microcontroller designs typically

mix multiple interfacing methods In a

very simplistic form a microcontroller

system can be viewed as a system

that reads from (monitors) inputs

performs processing and

writes to ( controls ) outputs

Input Devices Microcontroller Output

Devices

Microcontroller Interfaces

Analog Interface

Analog InputsOutputs

Sensor Types Temperature

Sensors

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 3: Sensor interfacing in 8051

Input Devices Microcontroller Output

Devices

Microcontroller Interfaces

Analog Interface

Analog InputsOutputs

Sensor Types Temperature

Sensors

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 4: Sensor interfacing in 8051

Microcontroller Interfaces

Analog Interface

Analog InputsOutputs

Sensor Types Temperature

Sensors

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 5: Sensor interfacing in 8051

Analog Interface

Analog InputsOutputs

Sensor Types Temperature

Sensors

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 6: Sensor interfacing in 8051

Analog InputsOutputs

Sensor Types Temperature

Sensors

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 7: Sensor interfacing in 8051

Sensor Types Temperature

Sensors

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 8: Sensor interfacing in 8051

Thermistors

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 9: Sensor interfacing in 8051

LM34 and LM35 Temperature Sensors

The sensors of the LM34LM35 series

are good integrated-circuit

temperature sensors whose output

voltage is linearly proportional to the

FahrenheitCelsius temperature

1048766 The LM34LM35 requires no external

calibration since it is inherently calibrated

1048766 It outputs 10 mV for each degree of

FahrenheitCelsius temperature

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 10: Sensor interfacing in 8051

Semiconductor Temperature

Sensors

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 11: Sensor interfacing in 8051

8051 Connection to ADC0848 and

Temperature Sensor ADC0804 is a very commonly used 8-bit analog to

digital convertor It is a single channel IC ie it can

take only one analog signal as input The digital

outputs vary from 0 to a maximum of 255 The step

size can be adjusted by setting the reference voltage at

pin9 When this pin is not connected the default

reference voltage is the operating voltage ie Vcc

The step size at 5V is 1953mV (5V255) ie for every

1953mV rise in the analog input the output varies by 1

unit To set a particular voltage level as the reference

value this pin is connected to half the voltage For

example to set a refer ence of 4V (Vref) pin9 is

connected to 2V (Vref2) thereby reducing the step

size to 1562mV (4V255)

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 12: Sensor interfacing in 8051

QUESTIONQ1

Q2

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 13: Sensor interfacing in 8051

ADC808 has 8 analog inputs

1048766 It allows us to monitor up to 8 different

transducers using only a single chip

1048766 The chip has 8-bit data output just like

the

ADC804

1048766 The 8 analog input channels are

multiplexed and selected according to

table

below using three address pins A B

and C

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 14: Sensor interfacing in 8051

8051 Connection to ADC804

and Temperature Sensor

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 15: Sensor interfacing in 8051

Getting Data From the Analog

World

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 16: Sensor interfacing in 8051

Noise considerations

Many sensors such as

thermocouples generate a relatively

small voltage so noise is always an

issue

The most common source of noise is

the utility power lines (50 Hz or 60

Hz)

Typically the bandwidth for

temperature sensors is much lower

than 50 or 60 Hz so a simple low-pass

filter will work well in many cases

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 17: Sensor interfacing in 8051

FOR GROUNDING

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 18: Sensor interfacing in 8051

ProgramCode to read temp from ASC0848convert it to

decimaland put it on P0 with some delay

includeltreg51hgt

bit RD=P2^5

Sbit WR=P2^6

sbit E=P2^7

Sfr MYDATA=P1

Void ConvertAndDisplay(unsigned char value)

Void MSDelay(unsigned intvalue)

Void main()

MYDATA =0xFF

E=1

RD=1

WR=1

While(1)

WR=0

WR=1

While(INTR==1)

RD=0

Value=MYDATA

ConvertAndDisplay(value)

RD=1

Id ConvertAndDisplay(unsigned char value)

Unsigned char xd1d2d3

X=value10

d1=value10

d2=X10

d3=X10

P0=d1

MSDelay(250)

P0=d2

MSDelay(250)

P0=d3

MSDelay(250)

Void MSDelay(unsigned int value)

unsigned char xy

For(x=0xltvaluex++)

For(y=0ylt1275y++)

Page 19: Sensor interfacing in 8051