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.

[51] What is xdata and pdata in keil c programming

Status
Not open for further replies.

Rk_on_edaboard

Junior Member level 3
Junior Member level 3
Joined
Apr 5, 2013
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,452
Hi,
I am in very confusion.
Please tell me when to use xdata, pdata in keil.
I searched on the internet but not getting satisfaction.
I am creating program in that i need 100 unsigned character variables.
Can i use xdata for storing these 100 variables?
If yes then how? I am using 89s52 microcontroller.
Is the 89s52 supports xdata,pdata.
Please provide any sample program.
 

pdata
The pdata memory type may be used to declare variables only. You may not declare pdata functions. This memory is indirectly accessed using 8-bit addresses and is one 256-byte page of external data RAM of the 8051. The amount of pdata is limited in size (to 256 bytes).

Variables declared pdata are located in the PDATA memory class.

Declare pdata variables as follows:

Code:
unsigned char pdata variable;
xdata
The xdata memory type may be used to declare variables only. You may not declare xdata functions. This memory is indirectly accessed using 16-bit addresses and is the external data RAM of the 8051. The amount of xdata is limited in size (to 64K or less).

Variables declared xdata are located in the XDATA memory class.

Declare xdata variables as follows:

Code:
unsigned char xdata variable;

Links:
https://www.keil.com/support/man/docs/c51/c51_le_xdata.htm
https://www.keil.com/support/man/docs/c51/c51_le_pdata.htm
 
Thanks embpic for ur valuable reply.
Please tell me one more thing that you said external data ram means interface another ram ic to microcontroller OR microcontroller itself external data ram.
I am using microcontroller at89s52 is this ic supports for xdata and pdata?
 
Last edited:

Thanks embpic for ur valuable reply.
Please tell me one more thing that you said external data ram means interface another ram ic to microcontroller OR microcontroller itself external data ram.
I am using microcontroller at89s52 is this ic supports for xdata and pdata?

yes 89s52 supports xdata on external ram
if you use xdata you have only two free port (port 3 ,4)
port 1,2 are for data and address buses
 
No no..
you can use any ports. External RAM means controller itself's have RAM rather than 128 bytes.
 
That means we can use more than 256 bytes ram of 89s52?
If yes then how?
 

Unfortunately some previous suggestions are misleading.

AT89S52 has only 256 Bytes of built-in RAM. It will be accessed as data and idata respectively. Some X51 chips have additional internal RAM that can be used as xdata memory, but not AT89S52. If 256 Bytes aren't enough, you have to connect external memory through the databus ports as explained in post #4.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top