I'm running into some problems that aren't making much sense to me so I'm hoping someone here can point out why this is not working the way I think it should. For some reason the raw_temp variable is not loading properly into the array. I can read each sensor fine but when I go to store the value into the array it doesn't seem to store information in the right locations.



Code:
    x               var     byte            ' Loop counter
    dq              var     byte[9]         ' 9 Byte Arrray for DS18B20
    raw_temp        var     word[5]         ' Raw Temperature

read_temps:
    for x = 0 to 4
    owout x,1,[$CC,$44]                 ' Send start temperature conversion command
    low portb.5                         ' Turn on transistor between rail and data pin
    pause 750                           ' Allow enough time to process Tconv
    high portb.5                        ' Turn off transistor between rail and data pin
    owout x,1,[$CC,$BE]                 ' Send read scratch pad command
    owin x,0,[STR dq\9]                 ' Read all 9 bytes and store them in dq array
    raw_temp.Byte0[x] = dq[0]           ' Isolate raw temperature from the rest
    raw_temp.Byte1[x] = dq[1]
    next x
goto read_temps