Download Netscape! |
Digital ThermometerThe following circuit will use the Basic Stamp to read a thermistor R1 ( 271-110 at Radio Shack), convert the signal that it will send serially to an 74HCT164 shift register, which in turn, will convert it to a signal the 7-segment LED display will use to display the temperature.
Clock con 2 therm con 0 check_temp: high therm 'discharge capacitor pause 100 RCTIME therm,1,W0 'read thermistor W0=W0+10 'adjust the reading W0=W0/7 W1=W0*W0/25*3/50 w0=w0*255/2125+W0 W0=162+W1-W0 W1=W0-32 'convert into celcius W0=W1*5/9 pause 1000 'pause before next reading gosub displaytemp goto check_temp end dispdeg: W0=10 Gosub displayW0 pause 300 W0=11 gosub displayW0 pause 300 goto check_temp displaytemp: if W0<10 then under10 if W0<20 then under20 if W0<30 then under30 if W0<40 then under40 if W0<50 then under50 goto check_temp under10: gosub displayW0 pause 500 goto dispdeg under20: W3=W0 W0=1 gosub displayW0 pause 300 W0=12 gosub displayW0 pause 50 W0=W3 W0=W0-10 gosub displayW0 pause 500 goto dispdeg under30: W3=W0 W0=2 gosub displayW0 pause 300 W0=12 gosub displayW0 pause 50 W0=W3 W0=W0-20 gosub displayW0 pause 500 goto dispdeg under40: W3=W0 W0=3 gosub displayW0 pause 300 W0=12 gosub displayW0 pause 50 W0=W3 W0=W0-30 gosub displayW0 pause 500 goto dispdeg under50: W3=W0 W0=4 gosub displayW0 pause 300 W0=12 gosub displayW0 pause 50 W0=W3 W0=W0-40 gosub displayW0 pause 500 goto dispdeg displayW0: lookup W0,[%00111111, 3, %01011110, %01001111, %01100011, %01101101,%01111101, %00000111, %01111111, %01101111, %01100110, %00111100, 0],W2 ' 0 1 2 3 4 5 6 7 8 9 degree C clear shiftout Datap,clock,msbfirst,[W2] return Martin-Luc Girard |
|
Any comments? E-Mail the Webmaster |