Accessing different pins with the One Wire commands
Hi!
I'm writing a program that will read two DS1820 digital thermometers.· The DS1820s are on separate output pins.· Is there anyway to make·the OW*** instructions work with more than one·pin?·
In other words, I want to write·a subroutine which will read a DS1820 and I'd like to pass the pin to be read in a variable.· That way I can set a variable, call the subroutine and read the inside DS1820, then change the variable and call the subroutine again and read the·outside DS1820.
Is this possible?
Thanks,
Dave
P.S. By OW*** instructions, I mean OWRDBIT,·OWRDBYTE, OWRESET, OWWRBYTE and OWWRBIT·
I'm writing a program that will read two DS1820 digital thermometers.· The DS1820s are on separate output pins.· Is there anyway to make·the OW*** instructions work with more than one·pin?·
In other words, I want to write·a subroutine which will read a DS1820 and I'd like to pass the pin to be read in a variable.· That way I can set a variable, call the subroutine and read the inside DS1820, then change the variable and call the subroutine again and read the·outside DS1820.
Is this possible?
Thanks,
Dave
P.S. By OW*** instructions, I mean OWRDBIT,·OWRDBYTE, OWRESET, OWWRBYTE and OWWRBIT·
Comments
I've also discovered that the OW**** instructions eat ram hugely. I ended up writing subroutines for every OWinstruction I use and using an IF-THEN-ELSE to send the instruction to the proper device.
doOWRESET:
IF Direction = 0 THEN
OWRESET RC.0
ELSE
OWRESET RC.1
ENDIF
RETURN
That lets you handle two devices and saves a ton of ram, but it's clumsy. But, considering the price, I'm not complaining.