Has anyone any suggestions on how to read the id code from 1wire products?
I've read up on the 1wire project on Rentron.com and have a slight problem
the code below assumes you have a serial 4 X 20 LCD
HOW would I modify this to work with a normal parallel 4 X 20 lcd module as I havent figured out how to convert it to serial yet, and it would be great if this code could be made work on a "normal" lcd module, or someone can give me ideas on it please?
What I eventually want to do is have 2 ds18b20's and actually use the 1wire properly instead of having them on seperate ports!
OR I noticed in his description he said...Code:'**************************************************************** '* Name : 1-Wire-ID.Bas * '* Author : Bruce Reynolds * '* Date : 11/10/2001 * '* Version : 1.0 * '* Notes : 1-Wire Identifier * '* ; Identifies & Prints 1-Wire Device Information * '* : Uses 20 x 4 Serial LCD for Display * '**************************************************************** DEFINE LOADER_USED 1 ' Boot loader is being used DEFINE DEBUG_MODE 1 ' Send Inverted serial data with debug DEFINE DEBUG_REG PortB ' Debug Port = PortB DEFINE DEBUG_BIT 0 ' Debug.bit = PortB.0 DEFINE DEBUG_BAUD 9600 ' Default baud rate = 9600 DEFINE OSC 4 ' We're using a 4 MHz oscillator DQ VAR PortC.0 ' One-wire data pin "DQ" on PortC.0 Clr CON 1 ' Serial LCD command to clear LCD LINE1 CON 128 ' Line #1 of serial LCD LINE2 CON 192 ' Line #2 of serial LCD LINE3 CON 148 ' Line #3 of serial LCD LINE4 CON 212 ' Line #4 of serial LCD Ins CON 254 ' Instruction for LCD command-mode ID VAR BYTE[8] ' Array storage variable for 64-bit ROM code Begin: PAUSE 500 ' Wait .5 second DEBUG Ins,Clr ' Clear LCD on power-up Start_Convert OWOUT DQ, 1, [$33] ' Issue Read ROM command ID_Loop: OWIN DQ, 0, [STR ID\8]' Read 64-bit device data into the 8-byte array "ID" DEBUG Ins,Line1,"Family Code = ",HEX2 ID[0],"h" DEBUG Ins,Line2,"Ser# = ",HEX2 ID[1],HEX2 ID[2],HEX2 ID[3],HEX2 ID[4],HEX2 ID[5],HEX2 ID[6],"h" DEBUG Ins,Line3,"CRC Value = ",HEX2 ID[7],"h" ID_Device: IF ID[0] = $5 THEN DEBUG Ins, Line4, "Device = Switch " ENDIF IF (ID[0] = $28) OR (ID[0] = $22) THEN DEBUG Ins,Line4, "Device = Temp Sensor" ENDIF IF ID[0] = $01 THEN DEBUG Ins,Line4, "Device = Serial # " ENDIF PAUSE 10000 ' 10-second pause GOTO Start_Convert END
The code is easy to convert to any PIC, and the serial LCD can easily be replaced by using any RS-232 terminal program.
Can anyone give me any ideas on doing this? as it would be a lot simpler to have a small board to plug the individual ds18b20's (or any other 1wire device) in and just read the 64-bit ROM number from each one and display on the pc, saves wasting an lcd module! I presume I'd just have to have a small board with a 5v regulator and that should be able to be powered from the com port? any clues as to how to communicate with the 1wire device or what program/commands?




Bookmarks