keil c _ embedded c programming tutorial_ pointers _ 8051 micro controller projects avr pic projects...
TRANSCRIPT
Home Forum Tutorials Downloads LCD Pinouts Jet Engine Games Project Demos More
Saturday, 5 November 2011 12:16
Trending Topics
DC-DC switching converters
automatic answering machine
audio transmitter digital
sections modern technologies
Ethernet Data Acquisition and
Control System book setting time members only
Digital signal transmission by
FM GPRS based home
automation system Artificial
neural networks winavr gcc
tutorial I2C eeprom addressing
adc nr Labview Advancedprogramming c language i2c
tutorial Digital electronics
more tags
Online
Guests: 67, Members: 1 ...
Afnan viewing
chatbox_menu.php
most ever online: 182184
(Members: , Guests: 182184)
on 06 Aug : 11:07
Members: 32533
Newest member: bagsdlt
keil C Programming Tutorial: Pointers
►Pointers in Keil C
Pointers in keil C is are similar to that of standard C and can perform all the operations that are available in standard C.
In addition, keil C extends the operatability of pointers to match with the 8051 Controller architecture. Keil C provides
two different types of pointers:
Generic Pointers1.
Memory-Specific Pointers2.
►Generic Pointers:
Generic Pointers are declared same as standard C Pointers as shown below:
CODE:
char *ptr; //Character Pointer
int *num; //Integer Pointer
Generic pointers are always stored using three bytes. The first byte is the memory type, the second byte is the
high-order byte of the offset, and the third byte is the low-order byte of the offset. Generic pointers maybe used to
access any variable regardless of its location.
►Memory-Specific Pointers:
Memory specific pointers are defined along with memory type to which the pointer refers to, for example:
CODE:
char data *c;
//Pointer to character stored in Data memory
char xdata *c1;
//Pointer to character stored in External Data Memory.
char code *c2;
//Pointer to character stored in Code memory
As Memory-Specific pointers are defined with a memory type at compile time, so memory type byte as required for
generic pointers is not needed. Memory-Specific pointers can be stored using 1 byte (for idata, data, bdata and pdata
pointers) or 2 bytes (for code and xdata pointers).
The Code generated by keil C compiler for memory-specific pointer executes mroe quickly than the equivalent codegenerated for a generic pointer. This is because the memory area accessed by the pointer is known at the compile timerather at run-time. The compiler can use this information to optimize memory access. So If execution speed is yourpriority then it is recommended to use memory-specific pointers.
Generic pointers and Memory-Specific pointers can be declared with memory area in which they are to be stored. For
example:
CODE:
//Generic Pointer
char * idata ptr;
//character pointer stored in data memory
int * xdata ptr1;
//Integer pointer stored in external data memory
//Memory Specific pointer
char idata * xdata ptr2;
//Pointer to character stored in Internal Data memory
//and pointer is going to be stored in External data memory
int xdata * data ptr3;
//Pointer to character stored in External Data memory
//and pointer is going to be stored in data memory
◄ Previous Page | Next Page ►
Support Rickey's World
$ 5.00 Custom
Name & Comments!
Welcome
Username:
Password:
Login
Remember me
[ Signup ]
[ Forgot password? ]
[ Resend Activation Email ]
Chatbox
sks | 05 Nov : 09:51
Hi Everybody,
Good morning
sks
jeeson | 05 Nov : 07:30
@boots
hi
Coitsu | 04 Nov : 22:05
Hi, i've recently posted a reply in
my "home automation against
earthquakes using pic and sensors"
if some1 can help me
Anonymous | 04 Nov : 21:39
hi ajay! i have tested rc5 remote in
p89v51rd2 and 89s52. working. i
need some modification so that the
output is not latched ie. output is
high, as long as i keep the buttons
pressed
sks | 04 Nov : 18:29
Hi all
Good evening
sks
Anonymous | 04 Nov : 07:45
hi
aniket.hello | 03 Nov : 08:10
hello ajay...plz reply to my forum....
m already late to submit my
project....
eng11 | 03 Nov : 06:01
Thanks Ajay and Majoka for the info
i will wait to see if he reply to your
message
and thanks again guys
Digital Humiditiy Sensor designed for automotive, RH&T, calibrated, highest performance www.sensirion.com/humidity
Embedded Developer Find Compare Buy Processors & Tools Parametric Database, Ordering Info www.embeddeddeveloper.com
Embedded Tools for ARM IDE, compiler, debugger, emulator flash programmer, phototype boards www.armkits.com
Ads by Google
C Programming
Embedded Systems
Microcontroller C
Courses inEngineeringWide range of coursesn Engineering Meet
Greenwich Uni forSpot Admnsuniv-of-greenwich.study-uk.in
temperaturesensorsdifferent temperaturesensors for solar- and
heating systems.www.resol.de
TemperatureControllersSearch Thousands ofCatalogs for
AutomaticTemperature Control
Systemwww.globalspec.comDigital CircuitDesignRead the LatestElectronics Design
News & Daily Updatesfrom EW-www.ElectronicsWeekly.com
Buy Mobile PhonesOnlineGenuine Products withManufacturer
Warranty. Free NextDay Delivery.www.Saholic.com
…
Navigation Translate
Keil C / Embedded C Programming tutorial: Pointers : 8051 Microcontr... http://www.8051projects.net/keil-c-programming-tutorial/pointers.php
1 of 2 05-11-2011 12:16
ravi111 | 02 Nov : 20:31
hello sir
i want information about how to
make modern treadmill.
aniket.hello | 02 Nov : 19:19
heya.....plz reply on my forum
in project green bee....
View all posts (25403)
Link to Us!
Put this button on your website to
link with us!
Info Panel
© 2010 Rickey's World
Navigation Translate Recommended
Keil C / Embedded C Programming tutorial: Pointers : 8051 Microcontr... http://www.8051projects.net/keil-c-programming-tutorial/pointers.php
2 of 2 05-11-2011 12:16