0000=273k , 0001=274k .......
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..
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.
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.
budhy said:What is your minimum temperature?
What is the temperature resolution? (different in °K for 0000 and 0001)
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
ADCvalue = 256*ADRESH + ADRESL;
Kelvin = ADCvalue * 0.48828125;
Min = Kelvin - (273+21);
Hex = Min /16;
budhy said:I don't know about PIC, but indeed
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:ADCvalue = 256*ADRESH + ADRESL;
Hex is the 4 bit temperature value you want to transmit.Code:Kelvin = ADCvalue * 0.48828125; Min = Kelvin - (273+21); Hex = Min /16;
Note : beware with above numeric value type conversion.
because ADRESL hold the 8 bit least significant value of ADC, ADRESH hold the othe 2 bit most signaficant value1.)the ADCvalue=256*ADRESH+ADRESL
y mhust 256*ADRESH but not ADRESL?
As I mention before, I am not a PIC player, I don't know ADFM...the ADFM is set to 1 or 0 in this case
I'm sorry it is wrong, you dont need to divide min with 16.the Hex=min/16
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.
budhy said:I don't know about PIC, but indeed
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:ADCvalue = 256*ADRESH + ADRESL;
Hex is the 4 bit temperature value you want to transmit.Code:Kelvin = ADCvalue * 0.48828125; Min = Kelvin - (273+21); Hex = Min /16;
Note : beware with above numeric value type conversion.
MemH MemL
0000 0001 0000 0001
Sorry, I'm not a PIC player.but the instruction code in pic is ANDWL.it mean in binary format or decimal format?
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
the value of counter is 256*MemH + MemL = 1x256 + 1 = 257, do you agree?Code:MemH MemL 0000 0001 0000 0001
Sorry, I'm not a PIC player.but the instruction code in pic is ANDWL.it mean in binary format or decimal format?
Do your use C? I so don't worry about that!
What is your problems?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.
Data = 256*Data1 + 16*Data2 + Data3
budhy said:What is your problems?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.
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!
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?