Message from C, C++ talks

June 2019

— One more question, It's based on Embedded C perspective

— What does actually happen when we declare a variable as static volatile unsigned char TMR0.

— This is declared inside a header file. Why the combination of static and volatile keyword.

— What context is the variable declared in?

— 

It's actually in the header file for PIC microcontroller, here the TMR0 is a timer zero register inside microcontroller. when we include this header file we can use this keyword.

— Static volatile unsigned char TMR0 0x01;
static volatile unsigned char PCL 0x02;

— This is the real complete line at that file. Actually operator will write the value we given to the variable TMR0 inside the address 0x01 and same for PCL.

Message permanent page

— The static keyword means that the variable can only be "seen" inside the file it is declared

— But why these variables inside header file is declared as static volatile ...

— Guys

— I got one problem

— I got project of Student record system

— And it executes in right way

— But

— It exports database file