Overview of Microcontroller – 8051

26 02 2010

In this post i have given only links. i found those links to be more informative.

Wiki page

8052.com

8051_tutorial

In next upcoming post we can see some examples program for 89c51 in Keil software





Overview of Microprocessor – 8085 (useful links)

11 01 2010

In this post i have given only links. i found those links to be more informative.

Wikipedia Link

Good Link for all processor details Link for all processor main menu

Document in under this link explains the basic of the 8085 microprocessor.

8085 questions & answer Links

  1. Wiki Answers
  2. Interview Questions

I have not gone through all the questions, but if you have any doubts or information to share please comment it, we can discuss it.

back to Topics to be discussed





Answers for Basic ‘C’ interview questions part 1

5 01 2010

question can be found in this link

1, what is qualifiers?

Qualifiers defines the property of the variable. Two qualifiers are const and volatile. The const type qualifier declares an object to be nonmodifiable. The volatile type qualifier declares an item whose value can legitimately be changed by something beyond the control of the program in which it appears, such as a concurrently executing thread / interrupt routine.

2, What is storage class? explain with example

The storage class determines the part of memory where storage is allocated for an object (particularly variables and functions) and how long the storage allocation continues to exist. In C program, there are four storage classes: automatic, register, external and static.

Auto

  • They are declared at the start of a program’s block such as in the curly braces ( { } ).  Memory is allocated automatically upon entry to a block and freed automatically upon exit from the block.
  • The scope of automatic variables is local to the block in which they are declared, including any blocks nested within that block. For these reasons, they are also called local variables.
  • Automatic variables may be specified upon declaration to be of storage class auto.  However, it is not required to use the keyword auto because by default, storage class within a block is auto.

Register

  • Automatic variables are allocated in the main memory of the processor; accessing these memory location for computation will take long time.
  • when we required to optimize the execution time, move the critical variable to processor register. this can be done by using the register key word.
  • when storage class is register, compiler is instructed to allocate a register for this variable.
  • scope of the register variable is same as auto variable.

NOTE: Allocation of register is not guaranteed always, it depends on number register available in processor and number register used for manipulation. if you define 4 variable as register storage class and and processor has only 2 register for variable allocation, then compiler will allocate 2 variable in registers and treat the remaining 2 variable as auto variable. therefore usage of register keyword should should be justified and cross checked with disassembly weather register is allocated or not.

Extern

  • For using the external global variable from other files extern keyword is used.
  • any file can access this global variable and lifetime over entire program run.

Static

  • static variable have lifetime over entire program run.
  • scope of this variable is limited based on the place of declaration.
  • if static variable is defined in a file and not inside any function, then scope of the variable is limited within that file.
  • if static variable is defined inside a function, then the scope of the variable is limited within that function.
  • we can use this variable any file and any function indirectly by accessing through pointer.

3, Explain about preprocessor?

The C preprocessor is the preprocessor for the C programming language. In many C implementations, it is a separate program invoked by the compiler as the first part of translation. The preprocessor handles directives for source file inclusion (#include), macro definitions (#define), conditional inclusion (#if), user defined compilation error and warning(#error) and compiler specific preprocessor(#pragma).

see more in wiki link

4, Write a macro with two argument A, B. where A is byte and B specifies a bit position of the byte. macro should clear the particular bit position in the given byte?

see comments section in previous post

5, Write prototype for a function pointer and array of function pointers?

see comments section in previous post

6, Explain the following definition?

char   c;
char  *pc;
const char  *pcc;
char const  *pcc2;
char * const   cpc;
const char * const   cpcc;

see comments section in previous post

7, What is dangling pointers?

see comments section in previous post

see wiki link

8, What is wild pointers?

Wild pointers are created by omitting necessary initialization prior to first use. Thus, strictly speaking, every pointer in programming languages which do not enforce initialization begins as a wild pointer. This most often occurs due to jumping over the initialization, not by omitting it. Most compilers are able to warn about this.

{

int* a;

/* a is wild pointer, it is not initialized and it may have some garbage value*/

}

correct way is

{

int* a = NULL;

}

9, Explain different memory section in processor?

See post related to memory segment

10, Explain dynamic allocation memory?

see comments section in previous post

11, In which memory section dynamically allocated memory is located?

see comments section in previous post

12, what are possible problem in dynamic memory allocation?

see comments section in previous post





Basic ‘C’ interview questions

22 12 2009

what is qualifiers?

What is storage class? explain with example

Explain about preprocessor?

Write a macro with two argument A, B. where A is byte and B specifies a bit position of the byte. macro should clear the particular bit position in the given byte?

Write prototype for a function pointer and array of function pointers?

Explain the following definition?

char   c;
char  *pc;
const char  *pcc;
char const  *pcc2;
char * const   cpc;
const char * const   cpcc;

What is dangling pointers?

What is wild pointers?

Explain different memory section in processor?

Explain dynamic allocation memory?

In which memory section dynamically allocated memory is located?

what are possible problem in dynamic memory allocation?

i will give the answer for this questions later. I request you to give the answers, so that we can discuss answers here.

Answers can be found in this link