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

C language

Hi all,

I'm new to this Keil product [µVision]
where can I learn C to write a program in µVision?

regards,
MB

Parents
  • It's basically ANSI/ISO C, with some extensions.

    For one, you must use sbit, sfr, or sfr16 to access bit, byte, or contiguous 2 byte registers in the 8051.

    You can disable integer promotion (a good thing) and enums only require 8 bits if they can fit in 8-bits, 16-bits otherwise.

    Functions are not reentrant by default. You must add the keyword 'reentrant' to functions that recurse or are truly reentrant.

    Interrupt Service Routines are declared as:

    void isrUart(void) interrupt UART_VECT using REG_BANK_1
    {
        // code
    }

    You don't have to specify a register bank and you must #define UART_VECT to match the 8051 UART vector number.

    - Mark

Reply
  • It's basically ANSI/ISO C, with some extensions.

    For one, you must use sbit, sfr, or sfr16 to access bit, byte, or contiguous 2 byte registers in the 8051.

    You can disable integer promotion (a good thing) and enums only require 8 bits if they can fit in 8-bits, 16-bits otherwise.

    Functions are not reentrant by default. You must add the keyword 'reentrant' to functions that recurse or are truly reentrant.

    Interrupt Service Routines are declared as:

    void isrUart(void) interrupt UART_VECT using REG_BANK_1
    {
        // code
    }

    You don't have to specify a register bank and you must #define UART_VECT to match the 8051 UART vector number.

    - Mark

Children
No data