Relative memory speed (20x2)

Trying to get my head around where best to locate IO storage buffers and tables for a 20x2 application. At present I am reading from one device (SERIN) into scratchpad, processing data and then placing it into RAM for output (SEROUT) to another device. I think that RAM and Flash are different terms for the same thing.

The application is going to get a lot more complicated and use of HSERIN on a third channel is becoming more likely. I want to more carefully map memory allocation and make best use of RAM and Scratchpad memory types. So the question is - what is the difference between these two (RAM and Scratchpad) if any: In speed terms are they the same?

My thanks.

PS. I do have the reference spec PIC18(L)F1XK22 in front of me but precision, rather than brevity, is it's strong point. Also there is the little matter of the Picaxe interpretation in the way.
 

hippy

Ex-Staff (retired)
'RAM' and 'scratchpad' are similar things; both are Random Access Memory, neither being Flash.

Each is similar but separate, accessed in different ways and with different primary uses.

RAM is accessed by the 'bptr' variable, PEEK and POKE commands, and this is the area that 'b0' and other variables are stored within.

Scratchpad is accessed by the 'ptr' variable, GET and PUT commands, and this is the area used as a serial background receive buffer and/or as the memory accessed by an I2C master when used as an I2C slave.
 
Thanks, I should not have used the term Flash. The attachment is useful. Can I assume that the two RAM areas have the same access speed.

My Thanks.
 

hippy

Ex-Staff (retired)
I don't know if anyone has measured it but I would expect the access speeds to be comparable.

Should be easy enough to do comparative tests but be careful not to misinterpret code alignment effects and similar as differences in access speed.
 

westaust55

Moderator
RAM includes the general RAM memory area of which the predefined variables are a part and for X2 parts scratchpad memory would I perceive all operate at the same speed to access and store data.

EEPROM and Flash memory (FLASH holds the users program and TABLE Memory) are accessed by indirect methods via several SFR locations which would therefore have some overhead to set up the address and place the data for writing or reading the data.
The advantage of EEPROM and TABLE memory is that the contents are retained when power is removed from the PICAXE chip.

Like hippy I am not aware of any speed tests having been undertaken to compare relative speeds and there are underlying issues in such test due to the manner the users BASIC program is stored and retrieved/interpreted for execution.
 
Last edited:
Top