PDA

View Full Version : On-Chip RAM



DaveC3
- 26th July 2008, 19:22
I have a 18F2515 it has no EEPROM but has 3K of RAM. I know how to read and write to EEPROM using "DATA" and "EEPROM" statements. I can not find anything on accessing the on-chip RAM.

1. Can you write to RAM at Program time?
2. How do you write and read the RAM while running the program.

Thanks

Dave

skimask
- 26th July 2008, 19:30
I have a 18F2515 it has no EEPROM but has 3K of RAM. I know how to read and write to EEPROM using "DATA" and "EEPROM" statements. I can not find anything on accessing the on-chip RAM.
1. Can you write to RAM at Program time?
2. How do you write and read the RAM while running the program.
Thanks
Dave

On chip ram is variable space, i.e.
my_variable var byte[2000]

There's your 2000 bytes of on chip ram right there...Use it as you please...

DaveC3
- 26th July 2008, 20:12
Thanks Skimask

skimask
- 26th July 2008, 23:19
Thanks Skimask
Take note that unless you have a look at your .LST file, you'll never really know how much extra 'ram' is available.
When I'm writing a program, I set up a rather large array, i.e. emptyspace var byte[3900], and when it fails to compile because it can't fit the 'emptyspace' variable, I turn down the number a bit until it fits.
Helps me keep tabs on how much memory (ram in this case) I'm using so I know how many other useless 'features' I can add to whatever I'm working on.

Kamikaze47
- 27th July 2008, 12:43
I have a 18F2515 it has no EEPROM but has 3K of RAM. I know how to read and write to EEPROM using "DATA" and "EEPROM" statements. I can not find anything on accessing the on-chip RAM.

1. Can you write to RAM at Program time?
2. How do you write and read the RAM while running the program.

Thanks

Dave

Keep in mind however, that the RAM is volatile, so will get wiped when the PIC is powered down. Thus the reason for EEPROM.

sayzer
- 28th July 2008, 07:41
One more thing to add....

EEPROM has much longer life time compared to the RAM.

If you keep writing to RAM , how frequent is the question there, then you will end up with a dead RAM in much shorter time as if you used EEPROM.

Darrel Taylor
- 28th July 2008, 08:34
Uht-oh,

I know dyslexia is for numbers, but I think I read that backwards. :eek:
<br>

sayzer
- 28th July 2008, 08:43
Uht-oh,

I know dyslexia is for numbers, but I think I read that backwards. :eek:
<br>


Dyslexia manifests primarily as a difficulty with written language, particularly with reading and spelling. It is separate and distinct from reading difficulties resulting from other causes, such as a non-neurological deficiency with vision or hearing, or from poor or inadequate reading instruction. Evidence also suggests that dyslexia results from differences in how the brain processes written and/or spoken language.

Dyslexia is most commonly characterized by difficulties with learning how to decode words, to spell, and to read accurately and fluently. Dyslexia also makes mathematics more difficult as people with dyslexia might mix numbers up. Dyslexic individuals often have difficulty "breaking the code" of sound-letter association (the alphabetic principle), and they may also reverse or transpose letters when writing or confuse letters such as b, d, p, q, especially in childhood. However, dyslexia is not a visual problem that involves reading letters or words backwards or upside down, nor are such reversals a defining characteristic of dyslexia.


And, to whom did you address DT?

Darrel Taylor
- 28th July 2008, 08:52
And, to whom did you address DT?

You, of course.

I know you know this. Something just got crossed when you were typing it.

Just re-read post #6. You'll get it. :D
<br>

sayzer
- 28th July 2008, 09:06
You, of course.

I know you know this. Something just got crossed when you were typing it.

Just re-read post #6. You'll get it. :D
<br>

If you are pointing to EEPROM and RAM life, I referred to datasheet stating
"
-100,000 write Flash endurance,
-1,000,000 write EEPROM endurance

"

Thus, EEPROM has longer life then RAM.

If the way I understand it is wrong, please correct me.

Darrel Taylor
- 28th July 2008, 09:47
RAM is commonly refered to as "General Purpose Registers".
That's the area where all the variables are placed.

Theoretically, you can read or write to RAM every microsecond until the end of time (or the end of the chip, which ever comes first).

The Flash area is where the program is stored. And the EEPROM is just a place to store periodically changing values that retain their data when power is removed.

RAM loses it's data when power is removed.

hth,

sayzer
- 28th July 2008, 10:01
RAM is commonly refered to as "General Purpose Registers".
That's the area where all the variables are placed.

Theoretically, you can read or write to RAM every microsecond until the end of time (or the end of the chip, which ever comes first).

The Flash area is where the program is stored. And the EEPROM is just a place to store periodically changing values that retain their data when power is removed.

RAM loses it's data when power is removed.

hth,


Thanks DT.

In that case, when we use WRITECODE command, are we using up flash life?

Our friend did not mention losing data.
Thus, I wanted to add something for his consideration.


:)

Darrel Taylor
- 28th July 2008, 10:16
In that case, when we use WRITECODE command, are we using up flash life?

Now you got it.

And WRITE uses EEPROM life.


Thus, I wanted to add something for his consideration. :)

It worked! :)
<br>