Keywords used in 8051 programming

idrbur

Joined Jan 11, 2018
43
I'm new to embedded programming and for a project of mine i need to program a 8051 microcontroller which is wirelessly controlled so i need to know almost all important keywords and their uses and syntax . I know C programming already.
Plzz help
Thankyou

be80be

Joined Jul 5, 2008
2,069

Parth786

Joined Jun 19, 2017
642
i need to know almost all important keywords and their uses and syntax . I know C programming already.
Programming in embedded C is not too different from standard c programming. In embedded programming you need header file for your micro-controller. Embedded C uses most of the syntax of standard C, You can also use same [main() function, variable , datatype declaration, if, else if ,switch case statement , while loop, for loop, functions, arrays pointer strings, structures , etc] like you used in standard C programming.

Just look at this program. you will get more idea about embedded c programming

C:
#include <REG51.h> /* header file */

#define LED_ON 1        /* LED ON */
#define LED_OFF 0       /* LED OFF */

/* LED connected to port P1 of pin 7 */
sbit LED = P1^7;

/* This is delay function */
void Delay (unsigned int count)
{
unsigned int i;
for  (i = 0; i < count; i++)
{
}
}

void main(void)
{
LED = LED_OFF;          /* LED OFF */

while (1)
{
LED = LED_ON;        /* Turn ON LED */
Delay(37000);        /* Wait  */
LED = LED_OFF;      /* turn off LED */
Delay(18500);        /* wait  */
}
}
I have change only header file, all the things are same as you do in standard c programming