joe rocci - 2014-07-29

Edit: I apologize for putting this in the wrong forum; hopefully the right people will see it.

#chip mega328p, 16 'Arduino Uno

I'm having problems using variables in the address field of EPread statements.

This code, with absolute Epread address values, works properly, reading back exactly what I wrote:

DIM myLong1 as long
DIM myLong2 as long
myLong = 123456789

EPStart = 2
epwrite EPStart + 0, myLong1
epwrite EPStart + 1, myLong1_H
epwrite EPStart + 2, myLong1_U
epwrite EPStart + 3, myLong1_E

epread 2, myLong2
epread 3, myLong2_H
epread 4, myLong2_U
epread 5, myLong2_E

However, this code, using a variable computation for the Epread address, doesn't:

EPStart = 2
epwrite EPStart + 0, myLong1
epwrite EPStart + 1, myLong1_H
epwrite EPStart + 2, myLong1_U
epwrite EPStart + 3, myLong1_E

epread EPStart + 0, myLong2
epread EPStart + 1, myLong2_H
epread EPStart + 2, myLong2_U
epread EPStart + 3, myLong2_E

It appears that you can use a variable computation as the address for writes, but not for reads. Can someone verify my result and comment on what might be wrong?

Thanks
Joe

 
Last edit: joe rocci 2014-07-29