Skip to main content
Tweeted twitter.com/StackElectronix/status/1148607820083990528

What the real concept Concept of Staticthe static keyword infrom the perspective of Embeddedembedded C. See below code

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a picPIC microcontroller header file. The @ operator is used to store the PORTB value inside the address 0x060x06, which is a register inside the PIC controller that represents PORTB. Up to this sidepoint, I hadhave a clear idea.

This line is declared as a global variable inside a header file (*.h.h). So, from what I came to know inabout the C language, a "Static Global Variable" cannot be"static global variable" is not visible to any other file - or, simply "Static Global Variables, static global variables /functions" functions cannot be used outside of the current file.

Then, how can this keyword PORTB isbe visible to my main source file and many other header files which I created manually?

On my main source file, I only addadded the header file #include pic.h Does this have something to do with my question?

What the real concept of Static keyword in perspective of Embedded C. See below code

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a pic microcontroller header file. @ operator is used to store the PORTB value inside the address 0x06, which is a register inside PIC controller that represents PORTB. Up to this side, I had clear idea.

This line is declared as global variable inside a header file (*.h). So what I came to know in C language a "Static Global Variable" cannot be visible to any other file or simply "Static Global Variables/functions" cannot be used outside current file.

Then, how this keyword PORTB is visible to my main source file and many other header files which I created manually?

On my main source file, I only add the header file #include pic.h Does this have something to do with my question?

Concept of the static keyword from the perspective of embedded C

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a PIC microcontroller header file. The @ operator is used to store the PORTB value inside the address 0x06, which is a register inside the PIC controller that represents PORTB. Up to this point, I have a clear idea.

This line is declared as a global variable inside a header file (.h). So, from what I came to know about the C language, a "static global variable" is not visible to any other file - or, simply, static global variables / functions cannot be used outside of the current file.

Then, how can this keyword PORTB be visible to my main source file and many other header files which I created manually?

On my main source file, I only added the header file #include pic.h Does this have something to do with my question?

Became Hot Network Question
Formatting edit
Source Link
winny
  • 16.8k
  • 6
  • 50
  • 71
static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a pic microcontroller header file. @ operator is used to store the PORTB value inside the address 0x06, which is a register inside PIC controller that represents PORTB. Up to this side, I had clear idea.

This line is declared as global variable inside a header file (*.h). So what I came to know in C language a "Static Global Variable" cannot be visible to any other file or simply "Static Global Variables/functions "functions" cannot be used outside current file.

Then, Howhow this Keywordkeyword PORTB is visible to my main source file and many other header files which I created manually?

On my main source file, I only add the header file #include pic.h Does this have something to do with my question?

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a pic microcontroller header file. @ operator is used to store the PORTB value inside the address 0x06, which is a register inside PIC controller that represents PORTB. Up to this side, I had clear idea.

This line is declared as global variable inside a header file (*.h). So what I came to know in C language a "Static Global Variable" cannot be visible to any other file or simply "Static Global Variables/functions " cannot be used outside current file.

Then, How this Keyword PORTB is visible to my main source file and many other header files which I created manually?

On my main source file, I only add the header file #include pic.h Does this have something to do with my question?

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a pic microcontroller header file. @ operator is used to store the PORTB value inside the address 0x06, which is a register inside PIC controller that represents PORTB. Up to this side, I had clear idea.

This line is declared as global variable inside a header file (*.h). So what I came to know in C language a "Static Global Variable" cannot be visible to any other file or simply "Static Global Variables/functions" cannot be used outside current file.

Then, how this keyword PORTB is visible to my main source file and many other header files which I created manually?

On my main source file, I only add the header file #include pic.h Does this have something to do with my question?

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a pic microcontroller header file. @ operator is used to store the PORTB value inside the address 0x06, which is a register inside PIC controller that representrepresents PORTB. Up to this side, I had clear idea.

This line is declared as global variable inside a header file (*.h). So what I came to know in C language a "Static Global Variable" cannot be visible to any other file or simply "Static Global Variables/functions " cannot be used outside current file.

Then how, How this Keyword PORTBPORTB is visible to my main source file and many other header filefiles which I created manually.?

On my main source file, I only add the header file #include <picpic.h>h. Does this have something to do with my question?

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a pic microcontroller header file. @ operator is used to store the PORTB value inside the address 0x06, which is a register inside PIC controller that represent PORTB. Up to this side I had clear idea.

This line is declared as global variable inside a header file (*.h). So what I came to know in C language a "Static Global Variable" cannot be visible to any other file or simply "Static Global Variables/functions " cannot be used outside current file.

Then how this Keyword PORTB is visible to my main source file and many other header file which I created manually. On my main source file I only add the header file #include <pic.h>. Does this have something to do with my question?

static volatile unsigned char   PORTB   @ 0x06;

This is a line of code in a pic microcontroller header file. @ operator is used to store the PORTB value inside the address 0x06, which is a register inside PIC controller that represents PORTB. Up to this side, I had clear idea.

This line is declared as global variable inside a header file (*.h). So what I came to know in C language a "Static Global Variable" cannot be visible to any other file or simply "Static Global Variables/functions " cannot be used outside current file.

Then, How this Keyword PORTB is visible to my main source file and many other header files which I created manually?

On my main source file, I only add the header file #include pic.h Does this have something to do with my question?

fix formatting
Source Link
Dave Tweed
  • 178.3k
  • 17
  • 242
  • 418
Loading
Source Link
Loading