Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/22/00 13:19
Read: times


 
#2811 - RE: Usage of 'idata' and 'bdata'
Larry,
(For those of you who know, I am not going to discuss PDATA)
Idata, data, xdata, and code refer to where the memory is more than type.

Code is where your program is stored and is read only.
example
code char mystring[] = 'Hello World';
would place the null terminated string
Hello World in rom for access.

Data refers to the area of ram that occupies the first 128 bytes of ram internal to the 8051.
example
data char myvariable;
saves space for one byte of ram
called myvariable in the first 128 bytes internal to the 8051.

The 8052 and many variants offer another 128 bytes of ram space above the original 128 bytes. This space can only be accessed indirectly and is thus called IDATA.
example
idata char myvariable;
saves space for one byte of indirectly addressable ram internal to the 8051.

BDATA is a very powerful data area.
It consists of 16 bytes of data space starting at 20H in the first 128 bytes of internal ram. The power here is that you can use this area bytewise or bitwise. You can declare bit flags in this area or characters if you choose.
example
bdata char myvariable;
declares space for 1 byte of bit addressable space.
bit myvariable;
will declare space for only one bit and is great when you need a flag.

Creating variables is easy enough, the important question is what are your program needs? How fast must you access the variables? How many variables will you have?
Answering these questions and a few others will help you decide "where" you want your variables.

Allen


List of 3 messages in thread
TopicAuthorDate
Usage of 'idata' and 'bdata'            01/01/70 00:00      
RE: Usage of 'idata' and 'bdata'            01/01/70 00:00      
RE: Usage of 'idata' and 'bdata'            01/01/70 00:00      

Back to Subject List