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.

Can I make LM335 temperature output into 4bits?

Status
Not open for further replies.

Cleong

Member level 2
Joined
Feb 17, 2006
Messages
53
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,789
As i know the LM335(temperature sensor) output is 10mVolt/Degree 'k..
My problem is when it connect to Pic16F873,
Can i make the temperature output into 4bits?
Jz like
0000=273k , 0001=274k .......
I intend to do the project using PT2272 to transmit the tempearture signal and receive by PT2262.
is it possible?
 

lm335

0000=273k , 0001=274k .......

with 4 bits you can get only 16 combination, like this:
0000=273k , 0001=274k , 0010=275k , 0011=276k,
0100=277k , 0101=278k , 0110=279k , 0111=280k,
1000=281k , 1001=282k , 1010=283k , 1011=284k,
1100=285k , 1101=286k , 1110=287k , 1111=288k

and then... how to code 289k and so on?
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
lm335 adc

budhy said:
0000=273k , 0001=274k .......

with 4 bits you can get only 16 combination, like this:
0000=273k , 0001=274k , 0010=275k , 0011=276k,
0100=277k , 0101=278k , 0110=279k , 0111=280k,
1000=281k , 1001=282k , 1010=283k , 1011=284k,
1100=285k , 1101=286k , 1110=287k , 1111=288k

and then... how to code 289k and so on?

yaya.i jz wan 16value enough..
so how to know the return voltage from the temperature sensor?
as i know connect the sensor to pic ADCON there.
but after tat how to do?
is it need 74HC4066?
 

lm355 temperature sensor

yaya.i jz wan 16value enough..

What is the range of temperature value you want to use?

Say you want 300k to 315k, what you have to do is substract your temperature value with 300 and you get 0 (b000) to 15 (b1111) with 1 degree step.
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
lm 335 to adc

budhy said:
yaya.i jz wan 16value enough..

What is the range of temperature value you want to use?

Say you want 300k to 315k, then substract your temperature value with 300 and you get 0 (b000) to 15 (b1111) with 1 degree step.

And is it connect the LM335 to the ADCON and output we set port B0 till B4?
 

lm335 con pic

Sorry, I'm not a PIC player, I don't know about ADCON.

But generally, digital value of LM335 is read into ADC, room temperatur 27°C=300°K will give 3.0 Volt.
If the ADC has 8 bit resolution an it is operate on 5 Volt, then 3 Volt equal with 3/5 * 255 = 153 biner value.

And you have to decide what is the 16 value will be transmited with PT2272, for doing more detail calculation.
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
formula lm355

budhy said:
Sorry, I'm not a PIC player, I don't know about ADCON.

But generally, digital value of LM335 is read into ADC, room temperatur 27°C=300°K will give 3.0 Volt.
If the ADC has 8 bit resolution an it is operate on 5 Volt, then 3 Volt equal with 3/5 * 255 = 153 biner value.

And you have to decide what is the 16 value will be transmited with PT2272, for doing more detail calculation.

Im using pic16f873,
it have 10bit resolution.
for ur example , 300k =3v =153biner value
then when 301k=3.1v=158.1biner value??
and how to use the biner value change to 0000-1111?
 

using lm335

What is your minimum temperature?
What is the temperature resolution? (different in °K for 0000 and 0001)
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
lm335 equivalent voltage output range

Hi,
I understand that you want to convert output from Lm355 to digital and transmit the same using pt2272.
First, the output voltage of lm355 seems to be of 10mV. so you can directly connect it to the analog input of PIC(Poat A , i suppose).
But i am not very sure whether PIC will be good enough to detect the millivolt range inputs. so you can try adding an instrumentation amplifier which can help you to increse the voltage lineraly.
My suggestion wold be.

LM355 -----> Instrumentation Amplifier --------> Pic -------> Ptc2272.

Second, when you have finished connecting you can select the analog channel in which u have connected the LM355. now configure the ADCON0, ADCON1.
once the conversion is finished a 10 Bit digital data will be present in ADRESH and ADRESL register. now you can try converting 10- bit data to DECIMAL VALVE and AGAIN convert it to 4-Bit binary data, in order to maintain accuracy.

regards,
Kumara
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
pt2272 project

budhy said:
What is your minimum temperature?
What is the temperature resolution? (different in °K for 0000 and 0001)

resolution are 21'c-36'c!!

Added after 9 minutes:

kumeemb said:
Hi,
I understand that you want to convert output from Lm355 to digital and transmit the same using pt2272.
First, the output voltage of lm355 seems to be of 10mV. so you can directly connect it to the analog input of PIC(Poat A , i suppose).
But i am not very sure whether PIC will be good enough to detect the millivolt range inputs. so you can try adding an instrumentation amplifier which can help you to increse the voltage lineraly.
My suggestion wold be.

LM355 -----> Instrumentation Amplifier --------> Pic -------> Ptc2272.

Second, when you have finished connecting you can select the analog channel in which u have connected the LM355. now configure the ADCON0, ADCON1.
once the conversion is finished a 10 Bit digital data will be present in ADRESH and ADRESL register. now you can try converting 10- bit data to DECIMAL VALVE and AGAIN convert it to 4-Bit binary data, in order to maintain accuracy.

regards,
Kumara

thks. and the last question is how to convert 10bit data to dec valve then --> 4bit binary?
sry tat im new in pic.....
 

lm335 sample

I don't know about PIC, but indeed
Code:
ADCvalue = 256*ADRESH + ADRESL;
for 10 bit ADC the maximum value of ADCvalue is 1023, if the Vref is 5 Volt (equivalent with 500°K) then each every 1 ADCvalue = 0.48828125°K (500 / 1024)
Code:
Kelvin = ADCvalue *  0.48828125; 
Min = Kelvin - (273+21);
Hex = Min /16;
Hex is the 4 bit temperature value you want to transmit.

Note : beware with above numeric value type conversion.
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
pt2262 decode

budhy said:
I don't know about PIC, but indeed
Code:
ADCvalue = 256*ADRESH + ADRESL;
for 10 bit ADC the maximum value of ADCvalue is 1023, if the Vref is 5 Volt (equivalent with 500°K) then each every 1 ADCvalue = 0.48828125°K (500 / 1024)
Code:
Kelvin = ADCvalue *  0.48828125; 
Min = Kelvin - (273+21);
Hex = Min /16;
Hex is the 4 bit temperature value you want to transmit.

Note : beware with above numeric value type conversion.


thank,ur code help me a lot.
but i stil got some part cant understand well
1.)the ADCvalue=256*ADRESH+ADRESL
y mhust 256*ADRESH but not ADRESL?
the ADFM is set to 1 or 0 in this case

2.)the Hex=min/16
i need 4bit binary no. the hex give me hex value.
 

pt2262 read signal

Use the ADC with the minimum resolution available and shift right the ADC value to fit it in the 4 bit range.
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
instrumentation lm335 sensors

1.)the ADCvalue=256*ADRESH+ADRESL
y mhust 256*ADRESH but not ADRESL?
because ADRESL hold the 8 bit least significant value of ADC, ADRESH hold the othe 2 bit most signaficant value
the ADFM is set to 1 or 0 in this case
As I mention before, I am not a PIC player, I don't know ADFM...

the Hex=min/16
I'm sorry it is wrong, you dont need to divide min with 16.
FYI, hexadecimal value is same as binary value!
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
lm335 pic example

Eugen_E said:
Use the ADC with the minimum resolution available and shift right the ADC value to fit it in the 4 bit range.

sry that im not very understand wat u meaning...
 

decode pt2272 with pic

budhy said:
I don't know about PIC, but indeed
Code:
ADCvalue = 256*ADRESH + ADRESL;
for 10 bit ADC the maximum value of ADCvalue is 1023, if the Vref is 5 Volt (equivalent with 500°K) then each every 1 ADCvalue = 0.48828125°K (500 / 1024)
Code:
Kelvin = ADCvalue *  0.48828125; 
Min = Kelvin - (273+21);
Hex = Min /16;
Hex is the 4 bit temperature value you want to transmit.

Note : beware with above numeric value type conversion.


256=1 0000 0000
so when it time with the 2 msb in ADRESH,
mean that if ADRESH result is 11, 11*01 in binary format it will result in 01
or it is time in Decinmal form?11*1=11

but the instruction code in pic is ANDWL.it mean in binary format or decimal format?
 

lm355

A decimal number 123, the value of this number is :
1x100 + 2x10 + 3, OK

10 bit memory counter it will occupy 2 byte of memory (8 bit each) name it MemL and MemH, MemL hold least significant value, MemH hold most significant value.

At this case every pulse make the value of MemL increament by 1, after 256 pulse MemL reset to 0 and there a overflow signal make MemH increament by 1.

Say there are 257 count, the counter will like this
Code:
       MemH        MemL
    0000 0001    0000 0001
the value of counter is 256*MemH + MemL = 1x256 + 1 = 257, do you agree?

but the instruction code in pic is ANDWL.it mean in binary format or decimal format?
Sorry, I'm not a PIC player.
Do your use C? I so don't worry about that!
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
lm335 help

budhy said:
A decimal number 123, the value of this number is :
1x100 + 2x10 + 3, OK

10 bit memory counter it will occupy 2 byte of memory (8 bit each) name it MemL and MemH, MemL hold least significant value, MemH hold most significant value.

At this case every pulse make the value of MemL increament by 1, after 256 pulse MemL reset to 0 and there a overflow signal make MemH increament by 1.

Say there are 257 count, the counter will like this
Code:
       MemH        MemL
    0000 0001    0000 0001
the value of counter is 256*MemH + MemL = 1x256 + 1 = 257, do you agree?

but the instruction code in pic is ANDWL.it mean in binary format or decimal format?
Sorry, I'm not a PIC player.
Do your use C? I so don't worry about that!

yaya..
i totally understand what u mean already.

i think the transmit part i finish,
now remain the receiver part only

my receiver part use the 4 bits as input and output i set at rc6
and the output connect to max232 then to comp port.

can guide me about this?
 

how to connect lm355 to rs232

my receiver part use the 4 bits as input and output i set at rc6
and the output connect to max232 then to comp port.
What is your problems?
Normally data transmission on RS232 lines is use ASCII format, you have to convert the 4 bit data to 2 ASCII character.

Although PTC2272 can only send 4 bit data each time, it is better your send the 10 bit ADC data at 3 transmission as Data1, Data2 and DATA3.

use this simple formula to reform the data :

Code:
Data = 256*Data1 + 16*Data2 + Data3

Goo Luck!
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
lm335 datasheet

budhy said:
my receiver part use the 4 bits as input and output i set at rc6
and the output connect to max232 then to comp port.
What is your problems?
Normally data transmission on RS232 lines is use ASCII format, you have to convert the 4 bit data to 2 ASCII character.

Although PTC2272 can only send 4 bit data each time, it is better your send the 10 bit ADC data at 3 transmission as Data1, Data2 and DATA3.

use this simple formula to reform the data :

Code:
Data = 256*Data1 + 16*Data2 + Data3

Goo Luck!


did u mean that i should not use 0000=22'c this method to transmit?
send the 10 bit ADC data at 3 transmission as data1,2,3??
Can explain detail how it work?
tq
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top