Embedded systems interview questions and answers for freshers

          

Embedded systems interview questions and answers for freshers


What is lst file?
How is a program executed’ bit by bit’ or’ byte by byte’?
Explain DB.
What is EQU?
How are labels named in assembly language?
Are all the bits of flag register used in 8051?
Which bit of the flag register is set when output overflows to the sign bit?
Which register bank is used if we use the following instructions?
Issues related to stack and bank 1.
Explain JNC.
Write a program to toggle all bits of P1 every 200ms.
Can port 0 be used as input output port?
Which 2 ports combine to form the 16 bit address for external memory access?
Can single bit of a port be accessed in 8051?
Other than SETB ,CLR are there any single bit instructions?

What is lst file?

• This file is also called as list file.
• It lists the opcodes ,addresses and errors detected by the assembler.
• List file is produced only when indicated by the user.
• It can be accessed by an editor and displayedon monitor screen or printed.
• Progammer uses this file to find the syntax errors and later fix them.

How is a program executed’ bit by bit’ or’ byte by byte’?

EXAMPLE

ADDRESS OPCODE PROGRAM
1   0000 ORG 0H
2   0000 7D25 MOV R5,#25H
3   0002 7F34 MOV R7,#34H
4   0004 2D ADD A, R5
5   0005 END

• A program is always executed byte by byte.
• Firstly,1st opcode 7D is fetched from location 0000 and then the value 25 is fetched from 0001 .
• 25 is then placed in the register R5 and program counter is incremented to point 0002.
• On execution of opcode 7F, value 34 is copied to register R7.
• Then addition of contents of R5 and accumulater takes place.
• Here all the opcodes are 8 bit forming a byte. 

Explain DB.

• DB is called as define byte used as a directive in the assembler.
• It is used to define the 8 bit data in binary ,hexadecimal or decimal formats.
• It is the only directive that can be used to define ASCII strings larger than two characters.
• DB is also used to allocate memory in byte sized chunks.
• The assembler always converts the numbers lnto hexadecimal.

What is EQU?

• EQU is the equate assmbler directive used to define a constant without occupying a memory location.
• It associates a constant value with data label .
• Whenever the label appears in the program ,constant value is subsituted for label.
• Advantage: The constant value occuring at various positions in a program can be changed at once using this directive.
• Syntax: label EQU constant value

How are labels named in assembly language?

• Label name should be unique and must contain alphabetic letters in both uppercase and lowercase.
• 1st letter should always be an alphabetic letter.
• It can also use digits and special characters ?,.,@,_,$.
• Label should not be one of the reserved words in assembly language.
• These labels make the progam much easier to read and maintain.

Are all the bits of flag register used in 8051?

• The flag register also called as the program status word uses only 6 bits.
• The two unused bits are user defineable flags.
• Carry ,auxillary carry ,parity and overflow flags are the conditional flags used in it.
• PSW.1 is a user definable bit and PSW.5 can be used as general purpose bit.
• Rest all flags indicate some or the other condition of an arithematic operation.

Which bit of the flag register is set when output overflows to the sign bit?

• The 2nd bit of the flag register is set when output flows to the sign bit.
• This flag is also called as the overflow flag.
• Here the output of the signed number operation is too large to be accomodated in 7 bits.
• For signed numbers the MSB is used to indicate the whether the number is positive or negative.
• It is only used to detect errors in signed number operations. 

Which register bank is used if we use the following instructions
SETB  PSW.3      A
SETB  PSW.4       B

• Statement A sets 3rd bit of flag register.
• Statement B sets 4th bit of flag register.
• Therefore register bank 3 is initiated .
• It uses memory location 18H to 1FH.
• The register bank is also called as R3.

Issues related to stack and bank 1.

• Bank 1 uses the same RAM space as the stack.
• Stack pointer is incremented or decremented according to the push or pop instruction.
• If the stack pointer is decremented it uses locations 7,6,5… which belongs to register bank 0.
• If a given program uses R1 then stack is provided new memory location.
• The push instruction may also take stack to location 0 i.e.it will run out of space.

Explain JNC.

• It is a command used to jump if no carry occurs after an arithematic operation.
• It is called as jump if no carry( conditional jump instruction).
• Here the carry flag bit in PSW register is used to make decision.
• The processor looks at the carry flag to see if it is raised or not.
• If carry flag is 0 ,CPU fetches instructions from the address of the label.

Write a program to toggle all bits of P1 every 200ms.


                    MOV              A,#55H
AGAIN:       MOV              P1,A
                    ACALL          DELAY
                    CPL               A
                    SJMP            AGAIN

DELAY:
                    MOV              R5,#9
HERE1:     MOV              R4,#242
HERE2:     MOV              R3,#255
HERE3:     DJNZ            R3,HERE3
                    DJNZ            R4,HERE2
                    DJNZ            R5,HERE1
                    RET

• Here the delay produced is 9*255*4MC*90=199,940 micro seconds.
• CPL is used to toggle the bits of P1.
• Short jump is jusd to produce a continuous loop.

Can port 0 be used as input output port?

• Yes, port 0 can be used as input output port.
• Port 0 is an open drain unlike ports 2,3,4.
• To use it as input or output the 10k ohm pull-up resisters are connected to it externally.
• To make port 0 as input port it must be programmed by writing 1 to all bits.
• Example:

MOV  A,#0FFH
MOV  P0,A

Which 2 ports combine to form the 16 bit address for external memory access?

• Port0 and port2 together form the 16 bit address for external memory.
• Port0 uses pins 32 to 39 of 8051 to give the lower address bits(AD0-AD7)
• Port2 uses pins 21 to 28 of 8051 to give the higher address bits(A8-A15)
• This 16 bit address is used to access external memory if attached.
• When connected to external memory they cannot be used as input output ports.

Can single bit of a port be accessed in 8051?

• Yes,8051 has the capability of accessing only single bit of a port.
• Here only single bit is accessed and rest are unaltered.
• SYNTAX: “SETB X. Y”.
• Here X is the port number and y is the desired bit.
• Example: SETB P1.2

Here the second bit of port 1 is set to 1.

Other than SETB ,CLR are there any single bit instructions ?

• There are total 6 single-bit instructions.
• CPL bit : complement the bit (bit= NOT bit).
• JB bit,target: Jump to target if bit equal to 1.
• JNB bit,target: Jump to target if bit is equal to 0.
• JCB bit,target: Jump to target if bit is equal to 1 and then clear bit.

Write your comment - Share Knowledge and Experience

Discussion Board
HELPFULL

very useful for freshers please up load more question and answers

t.gowtham 01-9-2014 08:59 AM

thanks

please upload more que and ans


vivek kumar 12-27-2013 08:50 PM

gud

its gud & helpful.upload more question & ans

madhu 10-23-2013 03:08 AM

Reply

Its useful thanx

Karthick mp 04-16-2013 01:16 AM

fresher embedded engineer

very useful for me

murali 12-24-2012 06:38 AM

 

 

 
 
Home | Want a Job? Submit Key Skills | Employer login | My key skills | About us | Sitemap | Contact us