I'd like to program a Temperature Sensor using the PIC18F4550, but I'm not sure how to start. For the moment, I am using a 10k Ohm pot to try to calibrate it. The Temperature Sensor that I am using is the LM335Z:
http://www.national.com/ds/LM/LM135.pdf
As I move the potentiometer from one end to the other, in ADRESH/ADRESL
I get values that range from 0x000 to 0x3FF. I understand that this is the voltage.
My first approach was to go into the datasheet and program every value. For example, values < 0x156 = -40*C, values > 0x1C6 = 100*C (since these are the max values), then program brackets. 0x157 = -39*C, 0x156 = -37*C, etc.
If I approached it this way, I would be killing myself going through all those values, especially if I found out the part is a little off or I need to change sensors or something.
I read somewhere on this forum:
http://www.national.com/ds/LM/LM135.pdf
As I move the potentiometer from one end to the other, in ADRESH/ADRESL
I get values that range from 0x000 to 0x3FF. I understand that this is the voltage.
My first approach was to go into the datasheet and program every value. For example, values < 0x156 = -40*C, values > 0x1C6 = 100*C (since these are the max values), then program brackets. 0x157 = -39*C, 0x156 = -37*C, etc.
If I approached it this way, I would be killing myself going through all those values, especially if I found out the part is a little off or I need to change sensors or something.
I read somewhere on this forum:
This looks like something that applies to me, but I don't fully understand it, let alone try to program this in assembly.This simple device output 10mV/C. Feed this signal to one input of the comparator. The other input can be derived from a resistor network to provide the voltage for comparison.