Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001
Page 46
' Use the program PP_OWID.BSP to determine the data table for your
' DS1822 sensors.
'
' To run this program on the BS2p Demo Board, connect the LCD and
' install Jumper X6. Adjust contrast pot for best display.
'
' Refer to the Hitachi HD44780 documentation for details on LCD control.
' -----[ Revision History ]-----------------------------------------------------
'
' -----[ I/O Definitions ] ------------------------------------------------------
'
OWpin CON 15
TempType VAR In14 ' 1 = Fahrenheit
LCDpin CON 0 ' connect LCD to OutL
' -----[ Constants ]------------------------------------------------------------
'
NoCmd CON $00 ' No command in LCDOUT
ClrLCD CON $01 ' clear the LCD
CrsrHm CON $02 ' move cursor to home position
CrsrLf CON $10 ' move cursor left
CrsrRt CON $14 ' move cursor right
DispLf CON $18 ' shift displayed chars left
DispRt CON $1C ' shift displayed chars right
DDRam CON $80 ' Display Data RAM control
CGRam CON $40 ' Custom character RAM
Line1 CON $80 ' DDRAM address of line 1
Line2 CON $C0 ' DDRAM address of line 2
DegSym CON 223 ' degrees symbol
' 1-Wire Support
'
OW_FERst CON %0001 ' Front-End Reset
OW_BERst CON %0010 ' Back-End Reset
OW_BitMode CON %0100
OW_HighSpd CON %1000
ReadROM CON $33 ' read ID, serial num, CRC
MatchROM CON $55 ' look for specific device
SkipROM CON $CC ' skip ROM (one device)
SearchROM CON $F0 ' search
' DS1822 control
'
CnvrtTemp CON $44 ' do temperature conversion
RdScratch CON $BE ' read scratchpad
TC CON 0 ' read in Celcius
TF CON 1 ' read in Fahrenheit
NumSensors CON 2 ' inside and outside
' -----[ Variables ]------------------------------------------------------------
'
sensor VAR Nib ' sensor number to process
idx VAR Nib ' loop counter
eeAddr VAR Byte ' ee address of ROM match
romData VAR Byte(8) ' ROM data to DS1822