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.

How to create stack pointer with 89S8252 and EEPROM...?

Status
Not open for further replies.

elchula

Member level 3
Joined
Mar 16, 2005
Messages
66
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,846
89s8252 eeprom access

I must use EEPROM into 89S8252, but I don't know to use stack pointer (stack operation is written by C language), and my purpose is : write a hex file to EEPROM and then I can read data from EEPROM (by stack method) to export to any ports...
 

89s8252 eeprom

Why do you need stackpointer manupilation for writing.Stack pointer for only for call,push and pop operations. After the reset stack pointer default 20H adresses.Stack pointer must be in internal memory.

MOV SP,#40H

After this instruction stack pointer is 40H.
 

The answer to your need lies in using a Data-Pointer (DPTR) this is a two byte register in which you load the address from where you need the data to be read.

Load the higher and lower registers of DPTR with the starting address of the EPROM then use the instruction MOVX @A+DPTR,..... to keep on reading the whole data from it and do what is required.

As said already the Stack Pointer on the other hand is used to push and pop the values of the registers onto the stack (memory defined to be stack by initializing the Stack pointer to that location to be more precise) which will be changed in the function like say the Accumulator or PSW etc.

~Kalyan.
 

Hi,

You don't need stack pointer to access EEPROM, internal RAM or some other uC resource.

You need to manipulate with stack for function arguments passing.

And to keep ACC, PSW and used variables in interrupt services routines if you don't use register bank switch.
 

First U may write it

WMCON DATA 096H
MOV SP,#60H




WRITE_EEPROM:
ORL WMCON,#08
ORL WMCON,#10H
MOV DPTR,#0000H
MOV A,#41H
MOVX @DPTR,A

LOOP312:
MOV A,#02H
ANL A,WMCON
CJNE A,#02,LOOP312
ANL WMCON,#0E7H
RET






READ_PUSH_EEPROM:
ORL WMCON,#08H
MOV DPTR,#0000H
MOVX A,@DPTR
MOV R0,A
XRL WMCON,#08H
RET


SORRY I HAVE NO IDEA WITH "C"


THANKS
MASUD
http://geocities.com/matrixele/mypage
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top