cancel
Showing results for 
Search instead for 
Did you mean: 

READ and Write from RAM and Flash

kebap
Associate II
Posted on March 10, 2006 at 13:36

READ and Write from RAM and Flash

4 REPLIES 4
rtarrant
Associate II
Posted on May 17, 2011 at 12:06

How do I do this in PSDSoft Express?

How do I erase the Flash in PSDSoft Express?

I am jumping two pins together to erase the flash memory, when the pins are equal, then i want the flash to erase.

kebap
Associate II
Posted on May 17, 2011 at 12:06

I am working the first time with the upsd3254A and I can't understand how to read and write data from the Flash.

Has anybody some easy examples for me, how I could do this.

It would be really helpful!

I have the same problem with the SRAM.

I don't really understand the text in the datasheet about the Flash and the SRAM.

I hope somebody could helb me!

regards Xaver

rk1
Associate II
Posted on May 17, 2011 at 12:06

hi,

this is simple:

- set the adress-ranges for the flash-sectors/sram in PSDflash.

(i.e. for SRAM: 0x000 ... 0x1FFF)

- read SRAM:

MOV DPTR,#0000h ;read 1st byte in SRAM

MOV A,@DPTR

MOV DPTR,#1234h ;read byte at address 1234h from SRAM

MOV A,@DPTR

- write SRAM:

MOV DPTR,#1234h ;

MOV @DPTR,A

- read flash: exactly like SRAM

- write flash: this is a bit more complicated (but also completely described in the datasheet)

wek2
Associate II
Posted on May 17, 2011 at 12:06

Quote:

On 09-05-2005 at 20:23, Anonymous wrote:

hi,

this is simple:

- set the adress-ranges for the flash-sectors/sram in PSDflash.

(i.e. for SRAM: 0x000 ... 0x1FFF)

- read SRAM:

MOV DPTR,#0000h ;read 1st byte in SRAM

MOV A,@DPTR

MOV DPTR,#1234h ;read byte at address 1234h from SRAM

MOV A,@DPTR

- write SRAM:

MOV DPTR,#1234h ;

MOV @DPTR,A

- read flash: exactly like SRAM

- write flash: this is a bit more complicated (but also completely described in the datasheet)

You surely can't MOV A,@DPTR and similar.

The flash and SRAM act as an external memory with a conventional 8051. It's mapping depending on the DPLD (defined as ''address-range'' in PSDSoftExpress) and the status of VM register (it's default state after reset defined by the setting in PSDSoftExpress as ''Main/Secondary mamory will reside... program/data space'' in the ''Define PSD and MCU/DSP'' step; runtime modified by writing into VM register in the register space).

So you can have mapped the primary/secondary flash and SRAM as program memory only, both program and data memory and data memory only. The rules to access them are - again - the same as with conventional 8051 and appropriately mapped external memory. If the memory is accessible as program memory, you can't write, only read using the MOVC A,@A+DPTR and MOVC A,@A+PC commands (and of course run program from it)(see any 8051 reference book, or the ''bible'') . To read from data memory mapped flash/sram, use MOVX A,@DPTR or MOVX A,@Rn commands. Writing to SRAM is using MOVX @DPTR,A or MOVX @Rn,A; but - as correctly said above - writing to FLASH is more complicated, search for IAP in this forum.

Jan Waclawek