This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can we use pointers in Keil.

Hi all,
i dont know that much about keil, and i want to know wether we can use pointers in keil like in C? If yes then how??
Thanking you.

Parents
  • "i dont know that much about keil"

    So start by reading he uVision Getting Started Guide, and working through the example projects in it.

    This will give you a proper introduction to the tools, how they work, and how to use them - rather than just jumping-in blindly at the deep end.
    (The uVision Getting Started Guide is available on the 'Books' tab in the 'Project' Window; The 'Books' window is also available via the 'Help' menu; failing all that, search for GS51.PDF in your Keil folder)

    "i want to know wether we can use pointers in keil like in C"

    Assuming you already know 'C', then all the specific details of the Keil implementation - and their language extensions to suit the particular target processor - can be found in the compiler Manual

Reply
  • "i dont know that much about keil"

    So start by reading he uVision Getting Started Guide, and working through the example projects in it.

    This will give you a proper introduction to the tools, how they work, and how to use them - rather than just jumping-in blindly at the deep end.
    (The uVision Getting Started Guide is available on the 'Books' tab in the 'Project' Window; The 'Books' window is also available via the 'Help' menu; failing all that, search for GS51.PDF in your Keil folder)

    "i want to know wether we can use pointers in keil like in C"

    Assuming you already know 'C', then all the specific details of the Keil implementation - and their language extensions to suit the particular target processor - can be found in the compiler Manual

Children
  • Yes, you can use pointers, just as per the ANSI spec.

    The C language specification makes the assumption that the CPU has only one address space. The 8051 has several different addresses spaces. In addition to the "generic" pointers that can point to any memory space, Keil C51 has extensions that allow you to declare memory-space-specific pointers that are more efficient than the "generic" pointers.

    Details are in the manual, as was mentioned above.

  • I have the various forms of pointers defined this way (examples)

                                                // pointer in data in
    #define U8DI  unsigned char   idata * data  // data       idata
    #define U8DX  unsigned char   xdata * data  // data       xdata

    Erik

  • "Keil C51 has extensions that allow you to declare memory-space-specific pointers"

    and also has extensions that allow you to specify which memory area is to be used by a variable definition.

    With pointers, you can use both of these extensions simulataneously: one to specify in which memory area the pointer value is stored, and another to specify in which memory area the "pointed-to" location lies!

    Yes, you guessed it: full details are in the Manual!