Page 1 of 1

How to reference _eeprom in code

Posted: Thu Jan 27, 2011 5:44 pm
by Senacharim
Hi!
To make a long story short, I am attempting to define a variable or constant which will be populated with the _eeprom value from the SystemTypes module which I can then use as a limiter for a mildly open-ended eeprom reading routine.

Thus far, I've discovered a few ways in which this does not work:

Code: Select all

{example of not working stuff}
'1
Const x = _eeprom 'nope

'2
#define Y = _eeprom
const x = Y 'nope

'3
dim b as byte
b = _eeprom 'nope

'4
#define Y = _eeprom 'works
dim b as byte
b = Y 'nope
I am running out of ways which I might use to accomplish this. Any help appreciated. Thanx in advance.

Posted: Thu Jan 27, 2011 10:38 pm
by David Barker
Try the online help file under 'EEPROM data'

eeprom [(address)] = (item [as type] {, item [as type]})

Posted: Thu Jan 27, 2011 10:41 pm
by Senacharim
Negative, reading from the EEPROM works fine.

I am looking to read the PIC's maximum EEPROM capacity en silico, as it were.

Posted: Thu Jan 27, 2011 10:58 pm
by Jerry Messina
I've done it like this before... probably other ways as well.

Code: Select all

#option _eeprom_size = _eeprom
const EEPROM_SIZE as word = _eeprom_size

Posted: Fri Jan 28, 2011 3:06 pm
by Senacharim
It works!

Thanks.