Revision: 2449
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 20, 2007 19:58 by k2vol
Initial Code
'**************************************************************** '* Name : DS18B20 Temperature sensor reading * '* Author : Daniel Bowen [email protected] * '* Notice : Copyright (c) 2007 UTARC www.utarc.org * '* : All Rights Reserved * '* Date : 2/20/2007 * '* Version : 1.0 * '* Notes : Displays temperature from DS18B20 in Celsius on hardware serial port '* : Microcontroller used: PicMicro 18F4620 '* : * '**************************************************************** INCLUDE "MODEDEFS.BAS" DEFINE OSC 20 DEFINE LOADER_USED 1 DEFINE HSER_BAUD 2400 DEFINE ADC_CLOCK 1 DEFINE ADC_BITS 10 DEFINE ADC_SAMPLEUS 50 SYMBOL LF=$0A CMCON=$07 ADCON1=%00001100 TRISA=%00110111 TRISB=%01111101 TRISC=%10010100 TRISD=%10010100 TRISE=%00000000 '*** Pin assignments TempIn VAR PORTA.4 '*** Temp Read Variables *** char VAR BYTE TTData VAR BYTE TSign VAR BIT TempData VAR WORD Sign VAR TEMPDATA.15 START: GOSUB TEMPINREAD LOOKUP TSIGN, ["+","-"], CHAR HSEROUT [char,DEC3 TEMPDATA, "C" CR,LF] ' and display it 0=positive, 1=negative GOTO START TEMPINREAD: OWOUT TEMPIN,1,[$CC,$44] HIGH TEMPIN PAUSE 10 OWOUT TEMPIN,1,[$CC,$BE] OWIN TEMPIN,0,[TEMPDATA.LowByte,TEMPDATA.HighByte,SKIP 7] tSign = SIGN ' save sign bin IF TSIGN=1 THEN TEMPDATA = $FFFF-TEMPDATA TEMPDATA = TEMPDATA + 1 ENDIF TEMPDATA = TEMPDATA/16 RETURN
Initial URL
http://www.utarc.org/wiki/index.php?title=Source_Code
Initial Description
Displays temperature from DS18B20 in Celsius on hardware serial port
Initial Title
PicBasic Interfacing 18F PIC with Temperature Sensor Maxim DS18B20
Initial Tags
Initial Language
PicBasic