Hello,
I am trying to write a bit of code that will send out via OWOUT a request for data, then grab the incoming data in 16 bytes, then incrament the address by 16 and repeat. The overall goal is to request data in blocks of 16 bytes from address 0x1000 to 0x2FFF
Here's a bit that will do this manually:
I know there are ways to clean things up with this. It's only a rough "working" copy. The sertxd line outputs as comma seperated value for viewing in Excel. My intent is to incrament the memory address by loop instead of doing each request manually.
For those not familiar with OWOUT or the DS1922 I'm connected to, I'll explain the request. $CC "talks" to any/all one-wire devices on he network (should only be one). $69 is the request to read memory. $00,$10 is the requested address 1000h. You will notice the values are swapped. As the values need to be sent as hex I'm hitting a brain fart with the counter. My idea was to take this in two pieces and incrament the last byte by 16 and the first byte by 1. I can use a variable in the OWOUT command, though it appears to send decimal, not hex, and changing b0 to $b0 is useless as expected.
Here's the code bit I wrote to loop this. It "appears" to work, but the address in the OWOUT is obviously wrong as the one-wire returns all 0's.
As you can see in this example, I have replaced $00,$10 with b26,b25. As these output as DEC instead of HEX this part isn't working. I hope it's something simple I'm forgetting! Suggestions??
I am trying to write a bit of code that will send out via OWOUT a request for data, then grab the incoming data in 16 bytes, then incrament the address by 16 and repeat. The overall goal is to request data in blocks of 16 bytes from address 0x1000 to 0x2FFF
Here's a bit that will do this manually:
Code:
' ***** Data from 1000h
owout 3,%0001,($CC,$69,$00,$10,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF) ' Request Memory
owin 3,%0010,(b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) ' Record result
sertxd ("Data 1000h: ", 44)
sertxd (#b0," ",#b1," ",#b2," ",#b3," ",#b4," ",#b5," ",#b6," ",#b7," ",#b8," ",#b9," ",#b10," ",#b11," ",#b12," ",#b13," ",#b14," ",#b15, 10 , 13)
sertxd (10 , 13)
' ***** Data from 1010h
owout 3,%0001,($CC,$69,$10,$10,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF) ' Request Memory
owin 3,%0010,(b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) ' Record result
sertxd ("Data 1010h: ", 44)
sertxd (#b0," ",#b1," ",#b2," ",#b3," ",#b4," ",#b5," ",#b6," ",#b7," ",#b8," ",#b9," ",#b10," ",#b11," ",#b12," ",#b13," ",#b14," ",#b15, 10 , 13)
sertxd (10 , 13)
For those not familiar with OWOUT or the DS1922 I'm connected to, I'll explain the request. $CC "talks" to any/all one-wire devices on he network (should only be one). $69 is the request to read memory. $00,$10 is the requested address 1000h. You will notice the values are swapped. As the values need to be sent as hex I'm hitting a brain fart with the counter. My idea was to take this in two pieces and incrament the last byte by 16 and the first byte by 1. I can use a variable in the OWOUT command, though it appears to send decimal, not hex, and changing b0 to $b0 is useless as expected.
Here's the code bit I wrote to loop this. It "appears" to work, but the address in the OWOUT is obviously wrong as the one-wire returns all 0's.
Code:
b26 = 10
for b25 = 0 to 240 step 16
owout 3,%0001,($CC,$69,b25,b26,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF) ' Request Memory
owin 3,%0010,(b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) ' Record result
sertxd ("Data : ",#b26,#b25,10,13)
sertxd (#b0,44,#b1,10,13,#b2,44,#b3,10,13,#b4,44,#b5,10,13,#b6,44,#b7,10,13,#b8,44,#b9,10,13,#b10,44,#b11,10,13,#b12,44,#b13,10,13,#b14,44,#b15, 10 , 13)
sertxd (10 , 13)
if b26 = 47 and b25 = 240 then
Return
elseif b25 = 240 then
b26 = b26 + 1
endif
next b25
Last edited: