Hot!How to access the program space variable?

Author
rajatkalyan
New Member
  • Total Posts : 29
  • Reward points : 0
  • Joined: 2018/01/17 21:30:45
  • Location: 0
  • Status: offline
2018/03/08 04:56:35 (permalink)
0

How to access the program space variable?

I have a very simple question, I have declared the following variable in the program space(if i did it correctly).
How can i access(read/write) this variable?
int __attribute__((space(prog),aligned(_FLASH_PAGE))) blankFLASH[128];

#1
NKurzman
A Guy on the Net
  • Total Posts : 16141
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: How to access the program space variable? 2018/03/08 06:30:05 (permalink)
4 (1)
Reading is easy. Just read it like any other variable.
Writing , see the data sheet. Or, MCC if it supports your PIC
#2
Gort2015
Klaatu Barada Nikto
  • Total Posts : 2645
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: How to access the program space variable? 2018/03/08 08:04:29 (permalink)
3 (1)
You can use:  __builtin_
tblpage(blankFLASH)
tbloffset(blankFLASH)
 
To get a 24bit address:
 
tbladdress(blankFLASH)
 
Look in the c compiler user guide,  Appendix G: built in functions

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#3
Aussie Susan
Super Member
  • Total Posts : 3255
  • Reward points : 0
  • Joined: 2008/08/18 22:20:40
  • Location: Melbourne, Australia
  • Status: offline
Re: How to access the program space variable? 2018/03/08 18:27:06 (permalink)
0
Solutions such as this are usually fairly rare.
What are you actually trying to do that makes you think locating the variable in this way is the answer?
Susan
#4
NKurzman
A Guy on the Net
  • Total Posts : 16141
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: How to access the program space variable? 2018/03/08 20:11:04 (permalink)
0
Sometimes context is the key to the answer.
#5
Jump to:
© 2018 APG vNext Commercial Version 4.5