OWIN and variable usage/conservation

drjeseuss

Member
Hello. I'm trying to use and understand OWIN properly. I have a DS1922E which stores temperature readings to memory. With an appropriate OWOUT request, the DS1922 will respond with data from an address, then the next byte, then the next until it reaches EndOfPage or until reset. This would result in 32 bytes if a full page were requested. On the 28x1 I have variables b0-b27 "available" and only if I don't plan to use a variable anywhere else at the same time. My current method has been to grab half a page (16 bytes) to variables, then grab the other half to the same variables after I have displayed/stored them as so:

Code:
owout 3,%0001,($CC,$69,$00,$10,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF) ' Request Memory starting at $1000
owin 3,%0010,(b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) ' Record result
As the memory dump continues until reset (which occurs when the OWIN runs out of variables due to %0010 [Reset Pulse After Data]) I cannot interrupt the process to pass into memory, etc. (I think). Would it be possible to do the following:

Code:
for b0 = 1 to 32
  owin 3,%0000,(b1) ' Record result
  sertxd (b1)
next b0
If you notice, I have changed from %0010 to %0000 to avoid sending a reset. My concern is the program will not be ready in time and will miss the second byte. Would the incoming OW data be "cached" somewhere on the 28x1 allowing this approach to work correctly?

Another option I considered was to grab fewer bytes at a time to conserve on variable use, though I feel that will impact speed as I will be transmitting a LOT of repeat data to grab the smaller chunks.

Has anyone else dealt with a similar issue? Any suggestions on a variable-friendly way of doing this without killing speed?
 

Technical

Technical Support
Staff member
Have a look at using the scratchpad instead of bx variables

ptr =0
owin 3,%0010,(@ptrinc,@ptrinc,@ptrinc,@ptrinc.....x 32 ) ' Record result

You would then have 32 bytes in scratchpad addresses 0-31 (use 'get' to retrieve)
 

drjeseuss

Member
Have a look at using the scratchpad instead of bx variables

ptr =0
owin 3,%0010,(@ptrinc,@ptrinc,@ptrinc,@ptrinc.....x 32 ) ' Record result

You would then have 32 bytes in scratchpad addresses 0-31 (use 'get' to retrieve)


This is a much better alternative! I'm able to grab larger chunks of data. Also, I've written it so I'll grab 32 bytes (1 page) 4 times to fill the scratchpad (on 28x1), then dump the 4 pages all at once. The speed is considerably faster now. Thanks!
 
Top