Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001
Page 38
' checksum
LCDOUT LCDpin,NoCmd,[" ",HEX2 romData(7)]
END
' -----[ Subroutines ]----------------------------------------------------------
'
' This subroutine checks to see if any 1-Wire devices are present on the
' bus. It does NOT search for ROM codes
'
Device_Check:
devCheck = 0
OWOUT OWpin,OW_FERst,[SearchROM] ' reset and start search
OWIN OWpin,OW_BitMode,[devCheck.Bit1,devCheck.Bit0]
RETURN
' This subroutine is used to display the part number of a 1-Wire device.
' The text data and pointers to it are stored in the EE of a different
' program slot.
Display_Device_Type:
addr = devType * 2 + $600 ' calulate string pointer addr
STORE NamesPgm ' point to names EEPROM
READ addr,strPtr.LowByte ' get the string location
READ addr+1,strPtr.HighByte
Read_Char:
READ strPtr,char ' read character from string
IF (char = 0) THEN Dev_Type_Done ' at end? (0 = Yes)
LCDOUT LCDpin,NoCmd,[char] ' no, print the char
strPtr = 1 ' point to next char
GOTO Read_Char
Dev_Type_Done:
STORE 0 ' point to main pgm slot
RETURN
' -----[ Title ]-----------------------------------------------------------
'
' BS2p Plus Pack
'
' File...... PP_OWNAMES.BSP
' Purpose... Device names for Dallas 1-Wire components
' Author.... Parallax
' E-mail.... [email protected]
' Started...
' Updated... 26 SEP 2001
' {$STAMP BS2p}
' -----[ Program Description ]---------------------------------------------
'
' There is no actual code in this module. This program stores the names
' of various Dallas Semiconductor 1-Wire devices. The device family code
' is used to map the strings in EEPROM. The pointer to a device's string
' discription is stored at the location determined by this formula:
'
' pointer = device_id * 2 + $600
'