My project is to determine the %moisture content of grain in storage. I’m using 1-Wire DS2438 and Honeywell HIH-4000 RH sensors inside of the grain. I have a number of sensors on each string. All devices are working good using individual SN to address each device. I have ample RAM but I’m running out of CODE space. To reduce the program size I need to be able to use an array of some kind to be called by a variable residing in the routine to address each 1-Wire device in secession so I can loop through a single routine rather than have multiple routines. Instead of using:
Code:
OWOUT DataPin, 1, [MatchRom,$26,$7A,$BA,$11,$01,$00,$00,$D8, ConvertV]
I would like to use:
Code:
OWOUT DataPin,1,[MatchRom, OW_Loop_VAR , ConvertV]
OW_Loop_var VAR BYTE [8]
OWbuffer1 VAR BYTE[8] ;SN first sensor
OWbuffer1[0]= $26
OWbuffer1[1]= $7A
OWbuffer1[2]= $BA
OWbuffer1[3]= $11
OWbuffer1[4]= $01
OWbuffer1[5]= $00
OWbuffer1[6]= $00
OWbuffer1[7]= $D8
OWbuffer2 VAR BYTE[8] ;SN second sensor
OWbuffer2[0]= $26
OWbuffer2[1]= $A7
OWbuffer2[2]= $AB
OWbuffer2[3]= $11
OWbuffer2[4]= $10
OWbuffer2[5]= $00
OWbuffer2[6]= $00
OWbuffer2[7]= $E8
OW_Loop_var = OWbuffer1
GOSUB OWroutine
OW_Loop_var = OWbuffer2
GOSUB OWroutine
OWrutine:
OWOUT DataPin,1,[MatchRom, OW_Loop_var , ConvertV]
It seems to me this would work. As a test I tried:
OWOUT DataPin,1,[MatchRom, OWbuffer1, ConvertV]
But it doesn’t work and I can’t seem to figure out how to make this happen. I’ve been reading posts on strings, arrays, EXT, and everything else I could find but I’ve seen nothing that resembles what I’m trying to do. Assistance please.
Bookmarks