1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Question about variable definitions

Discussion in 'Embedded' started by Julia, Nov 12, 2003.

  1. Julia

    Julia Guest


    I'm a VC++ programmer doing my first bit of embedded development in C
    for a 80C52 compatible chip. I have the use of some API's and
    included is an .h file containing the following typedefs:

    typedef unsigned char data Ucd;
    typedef unsigned char idata Uci;
    typedef unsigned char pdata Ucp;
    typedef unsigned char xdata Ucx;
    typedef unsigned char code Ucr;
    typedef unsigned char Uc;

    Code samples available to me use Ucr as a parameter type for a
    function if the data being passed is a "string" rather than a
    variable. I understand vaguely that different data may be stored in
    different memory spaces, but I guess I need to know the following:

    1) Is there a good book, document, web-site, or what ever that will
    help me understand the basic concept of why these typedefs are needed
    2) Do I need to use these typedefs or can I simply use unsigned char?
    3) If there is a choice as to whether or not these typedefs are
    required, what are the advantages/disadvantages, etc. of using them

    Many thanks in advance for any help with this.
    Julia, Nov 12, 2003
    1. Advertisements

  2. Julia

    moocowmoo Guest

    I hope that you'll find this link useful
    moocowmoo, Nov 12, 2003
    1. Advertisements

  3. Julia

    MArk Guest

    Hi, Julia.
    I'd suggest you download .pdf datasheet of part you are using (ie. Atmel
    from manufacturer's site and learn about memory organisation in
    Of course you can use unsigned char.
    The only advantage of typedefs is you don't have to write "unsigned char
    which is 18 characters instead you write "Ucd" and that is 3 characters.
    When you
    have functions with a lot of arguments it becomes pretty large with unsigned
    char data ....
    MArk, Nov 13, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.