Pulsin Part 2
Archiver
Posts: 46,084
Your last suggestion worked Great!!! But now i have a slightly
different problem. My sensors are good between -40c and somewhere
around 70c.
When i subject my Sensors (tmp04) to cold conditions, my stamp stops
calulating at 67f. I am using 4 sensors and the are all doing the
same thing.
From there on up the have a reading that is about +-1 Degree F from
the temp sensor on my DMM. They returned an accurat reading up to
125d F, that is where i stopped...
Below is my Code:
(Start Code)
.
.
.
p1 var word
p2 var word
p11 var byte
p22 var byte
temp var word
.
.
.
p1 = 0
p2 = 0
p11 = 0
p22 = 0
tz1 = 0
tempcheck:
pulsin 5,1,p1
pulsin 5,0,p2
p11 = p1/100
p22 = p2 /100
temp = (720* p11)/p22
tz1 = 455 - temp
.
.
.
serout 0, N9600,[noparse][[/noparse]clrLCD]
display:
serout 0,N9600,[noparse][[/noparse]nocurs,posCmd,64,"Zone one temp = ",dec tz1]
.
.
.
(End Code)
I am dividing my Orignal number by 100 inorder to get a correct value.
Thanks!!!!
Tobin Moore
different problem. My sensors are good between -40c and somewhere
around 70c.
When i subject my Sensors (tmp04) to cold conditions, my stamp stops
calulating at 67f. I am using 4 sensors and the are all doing the
same thing.
From there on up the have a reading that is about +-1 Degree F from
the temp sensor on my DMM. They returned an accurat reading up to
125d F, that is where i stopped...
Below is my Code:
(Start Code)
.
.
.
p1 var word
p2 var word
p11 var byte
p22 var byte
temp var word
.
.
.
p1 = 0
p2 = 0
p11 = 0
p22 = 0
tz1 = 0
tempcheck:
pulsin 5,1,p1
pulsin 5,0,p2
p11 = p1/100
p22 = p2 /100
temp = (720* p11)/p22
tz1 = 455 - temp
.
.
.
serout 0, N9600,[noparse][[/noparse]clrLCD]
display:
serout 0,N9600,[noparse][[/noparse]nocurs,posCmd,64,"Zone one temp = ",dec tz1]
.
.
.
(End Code)
I am dividing my Orignal number by 100 inorder to get a correct value.
Thanks!!!!
Tobin Moore
Comments
always function properly outside of a safe temperature range. I don't know
what this range is on the stamp though.. You might try keeping the stamp
warm while you cool the sensor.
> Your last suggestion worked Great!!! But now i have a slightly
> different problem. My sensors are good between -40c and somewhere
> around 70c.
>
> When i subject my Sensors (tmp04) to cold conditions, my stamp stops
> calulating at 67f. I am using 4 sensors and the are all doing the
> same thing.
>
> From there on up the have a reading that is about +-1 Degree F from
> the temp sensor on my DMM. They returned an accurat reading up to
> 125d F, that is where i stopped...
>calulating at 67f. I am using 4 sensors and the are all doing the
>same thing. From there on up the have a reading that is about +-1 Degree
F from
>the temp sensor on my DMM. They returned an accurat reading up to
>125d F, that is where i stopped...
>
>p1 var word
>p2 var word
>p11 var byte
>p22 var byte
>temp var word
>' ...
>tempcheck:
pulsin 5,1,p1
pulsin 5,0,p2
p11 = p1/100
p22 = p2 /100
temp = (720* p11)/p22
tz1 = 455 - temp
.
>..
>display:
> serout 0,N9600,[noparse][[/noparse]nocurs,posCmd,64,"Zone one temp = ",dec tz1]
Hi Tobin,
What values are you seeing for p1 and p2? Also, what happens below 67
degrees F? Does it always read 67, or does it do something more weird? Be
sure you use the bypass capacitors right next to the TMP04 power terminals.
It is very sensitive to power supply noise.
In an earlier message you noted TMP04 time values at room temperature:
> p1 => 18.2ms
> p2 => 15.7ms
But that does not make sense. Plug that into the formula and you get -380
degrees F! Look at figure 4 in the TMP03/04 data sheet. The nominal value
of t1 is 10 milliseconds, and it does not change much with temperature.
The ratio, t1/t2 at 67 degrees F should be around 0.53. And the count
values from PULSIN should come in at around p1=5000 and p2=9300.
At 125 degree F, the ratio should be near p1/p2=0.45, and p1~=5000 and
p2~=11000.
One thing to notice is that in going from 67 to 125 degrees F, the p2 value
changes by 11000-9300=1700, but when divided by 100 first, the change is
only 17 distinct values, a significant loss of resolution.
Here is math that retains more significant figures, three digits in the
denominator:
p11 = p1*10 ' * instead of /
p22 = p2/10 ' round off /10 instead of /100
temp = 72 * ( (p11/p22*10) + (p1//p22*10/P22) )
'^^^^^^^^^^^ ^^^^^^^^^^^^^^
' step 1 step 2
tz1 = 455 - (temp/100)
Step 1 finds the first division and multiplies it by ten to free up the
units digit.
Step 2 fills in the units digit by operating on the remainder from step 1.
I hope that helps,
-- Tracy Allen
Electronically Monitored Ecosystems
http://www.emesystems.com