How to reference _eeprom in code

Discuss the Integrated Development Environment (IDE)

Moderators: David Barker, Jerry Messina

Post Reply
User avatar
Senacharim
Posts: 139
Joined: Tue Aug 10, 2010 5:19 pm
Location: Ventura, CA

How to reference _eeprom in code

Post by Senacharim » Thu Jan 27, 2011 5:44 pm

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.
Surviving Member
Bermuda Triangle Battalion
from 2026 to 1992

Voted "Most likely to time travel"--Class of 2024.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Thu Jan 27, 2011 10:38 pm

Try the online help file under 'EEPROM data'

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

User avatar
Senacharim
Posts: 139
Joined: Tue Aug 10, 2010 5:19 pm
Location: Ventura, CA

Post by Senacharim » Thu Jan 27, 2011 10:41 pm

Negative, reading from the EEPROM works fine.

I am looking to read the PIC's maximum EEPROM capacity en silico, as it were.
Surviving Member
Bermuda Triangle Battalion
from 2026 to 1992

Voted "Most likely to time travel"--Class of 2024.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Post by Jerry Messina » Thu Jan 27, 2011 10:58 pm

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

User avatar
Senacharim
Posts: 139
Joined: Tue Aug 10, 2010 5:19 pm
Location: Ventura, CA

Post by Senacharim » Fri Jan 28, 2011 3:06 pm

It works!

Thanks.
Surviving Member
Bermuda Triangle Battalion
from 2026 to 1992

Voted "Most likely to time travel"--Class of 2024.

Post Reply