Skip to main content

Posts

Showing posts from April, 2016

Interrupts vs. Polling

Interrupts vs. Polling Polling:  In the Polling method, the microcontroller must "access by himself" the device and “ask” for the information it needs for processing. In fact, we see that in the Polling method the external devices are not independent systems; they depend on the microcontroller, and only the micro is entitled to obtain access to the information it needs Interrupts: Interrupts are the signal to the microcontroller or processor to mark the event that requires immediate attention. An interrupt is “requesting" the processor to stop to perform the current program and to “make time” to execute a special code(interrupt code). Whenever any device needs its interrupt service, the device notifies the microcontroller by sending it an interrupt signal. Upon receiving an interrupt signal, the microcontroller program_counter will go to the Interrupt vector table in that it will fetch the ISR address (interrupt service routine) and it will execute the ISR

Storage Classes in C programming

C has a concept of 'Storage classes' which are used to define the scope (visibility) and a lifetime of variables and functions.And storage class determines how long it stays in existence.In c-programming, 4 type of storage class is there. So what Storage Classes are available? 1.auto 2.static 3.extern 4.register 1.Auto - storage class Auto is the default storage class for local variables.         {             int Count;             auto int Month;         } The example above defines two variables with the same storage class. auto can only be used within (inside) functions, i.e. local variables.Local variables is stored in stack memory. 2.static - Storage Class Notes: For some reason, static has different meanings in different contexts. When specified on a function declaration, it makes the function local to the file. When specified with a variable inside a function, it allows the variable to retain its value between calls to the function. See static v

Volatile

Volatile Keyword is important keyword in c programing language.  volatile   keyword is one type of qualifier in c programming languages. But, when it comes to writing code especially in Embedded programming the use of “volatile” keyword is very often.Volatile Keyword in Embedded System. But now the question is, What is it (volatile)? What it does? Why do we need it? Does my program/code really need this keyword? All these and more I will cover in this article. What does volatile mean? Ok, let’s find out the meaning of volatile in dictionary. VOLATILE means: – UNSTABLE, UNPREDICTABLE…etc. So, the basic meaning of volatile is we can’t predict what is going to happen next. Now, What is the significance of volatile keyword? The significance of volatile keyword in programming language is to inform/tell the compiler not to pre-predict/assume/believe/presume the value of the particular variable which has been declared as volatile.