View Full Version : Argg! Why won't Stamp DAQ read values greater than 255?

05-16-2006, 11:55 AM
Hey guys,

So pretty much I'm saving 400 values, with each value between 0-4095. I'm saving them as words, in EEPROM locations of 0-800 (step 2). After all of my data is saved (I tested by saving 4095 to all 400 locations), I run the attached program (dump test 001), which is a modified version of the example code that came with DAQ. I then go into DAQ, check the "download data" box, and click the "connect" button. DAQ then quickly reads all of the values in EEPROM locations 0-800 (step 2), and dumps it into a row.

Now here' the problem. All of the values are 255, instead of 4095. I've messed with the example dump code, and made all the variables words, hoping they would be large enough to hold the number "4095".

Does anyone know how to fix this problem?


Adrian Schneider
05-16-2006, 02:31 PM
Hi Matt.
READ/WRITE are by default byte sized. To handle multibyte values such as word use something like:



Bruce Bates
05-16-2006, 03:01 PM
Adrian and Matt -

What Adrian said is correct, as far as it went. However, in PBASIC 2.5 there is another option as shown by this example extractred from the PBASIC Help File:


' {$PBASIC 2.5}

idNum VAR Word
score VAR Byte

ID_Rec DATA Word 1125, 75 ' Store multiple items

READ ID_Rec, Word idNum, score ' Read multiple variables

end quote

As you can see, the new sub-parameter WORD was introduced as an optional part of the READ/WRITE command, such that WORD-sized varaibles can be read and written more easily. Adrian's example will work on any PBASIC level.


Bruce Bates

<!--StartFragment -->

05-17-2006, 10:30 AM
Okay, thanks you guys. But if I read two different values (highbyte and lowbyte), how do I combine them into a word and send it to DAQ?