Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

IAP on the Philips P89V51RD2

Status
Not open for further replies.

laurah

Newbie level 6
Newbie level 6
Joined
Feb 6, 2010
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,391
Basically, I just want my program to be able to save preferences changes that users make when using the program on the chip. I figured that using IAP to save a few integers would make it possible to recall those integers if there was a power cycle.

I am programming in C on a Keil uVision 3 platform. I understand that to do IAP will require some assembly language. I was hoping that someone might have some simple C code that calls some simple assembly code that can perform Read/Write using IAP.

Thanks
 

Anyone? Please?


laurah said:
Basically, I just want my program to be able to save preferences changes that users make when using the program on the chip. I figured that using IAP to save a few integers would make it possible to recall those integers if there was a power cycle.

I am programming in C on a Keil uVision 3 platform. I understand that to do IAP will require some assembly language. I was hoping that someone might have some simple C code that calls some simple assembly code that can perform Read/Write using IAP.

Thanks
 

laurah said:
Basically, I just want my program to be able to save preferences changes that users make when using the program on the chip. I figured that using IAP to save a few integers would make it possible to recall those integers if there was a power cycle.

I am programming in C on a Keil uVision 3 platform. I understand that to do IAP will require some assembly language. I was hoping that someone might have some simple C code that calls some simple assembly code that can perform Read/Write using IAP.

Thanks
refer http://www.efton.sk/t0t1/p89v51rd2 iap.pdf
 

How to store user defined values into P89v51RD2. please guide me.
 

;http://www.efton.sk/t0t1/p89v51rd2 iap.pdf

;=========================================================================
$MOD52
FCF EQU 0B1h
ORG 0
ljmp Reset
;---- interrupt vectors
;none here
;---- "main"
Reset:
;if we try to rewrite an already programmed byte without previously erasing it, this will fail:
MOV DPTR, #TestArea1
MOV A, #55h
CALL FLASH_PROGRAM_BYTE
;this is how a sector has to be erased prior bytes in it are being rewritten:
MOV DPTR, #TestArea2
CALL FLASH_ERASE_SECTOR
MOV DPTR, #TestArea2
MOV A, #0AAh
CALL FLASH_PROGRAM_BYTE
Stop: SJMP Stop
;---- data area, 128-byte sectors
;make sure that there is no code in the whole sector,
;as upon updating the data the whole sector gets erased
ORG 0080h
TestArea1:
db 0, 0
ORG 0100h
TestArea2:
db 0, 0
;end of TestArea2 at 017F
ORG 0180h
;rest of code may go here
;---- FLASH API - must be located anywhere ABOVE 2000h
ORG 03F00h
;programs a single byte in FLASH
;DPTR=addres, A=content of byte to be programmed
;the position to be programmed must be previously erased
FLASH_PROGRAM_BYTE:
PUSH IE ;DISABLE INTERRUPTS
CLR EA
MOV R1,#02 ;SETUP OPERATION CODE -- write byte
ANL FCF,#0FCh ;enable boot sector - !!! this command MUST be located ABOVE 2000h!!!
CALL 01FF0H ;call to ISP_API (modifies B register but no Rx)
ORL FCF,#001h ;switch back to user FLASH
POP IE
RET
;erases a 128-byte sector in FLASH
;DPTR=address of first byte of sector to be erased
FLASH_ERASE_SECTOR:
PUSH IE ;DISABLE INTERRUPTS
CLR EA
MOV R1,#08 ;SETUP OPERATION CODE -- erase sector
ANL FCF,#0FCh ;enable boot sector - !!! this command MUST be located ABOVE 2000h!!!
CALL 01FF0H ;call to ISP_API (modifies B register but no Rx)
ORL FCF,#001h ;switch back to user FLASH
POP IE
RET
;----- that's all, folks
END
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top