24052-microcontroller.pdf-1411210674

Upload: anney-revathi

Post on 05-Jul-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    1/27

    1 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    RANGANATHAN POLYTECHNIC COLLEGE

    DEPARTMENT OF ECE&EEE

    24052-MICROCONTROLLER

    ONE MARK QUESTION BANK

    UNIT – I

    ARCHITECTURE & INSTRUCTION SET OF 8051

    1. Define microcontroller. (Board exam)

    Microcontroller is a complete microcomputer on a chip.

    It is a digital IC fabricated by using VLSI technology.

    It contains serial and parallel I/O ports, RAM and ROM types of memory,timer/counters, interrupt controls etc.

    2. What are the advantages of microcontroller? As the peripherals are integrated into a single chip, the overall system cost is very

    low. The product is of a small size as compared to the microprocessor based system and

    is thus very handy. Easy to troubleshoot. More reliable. All these features are available in a 40 pin package as in an 8 bit processor.

    3. What are the Features of microcontroller?

    8 bit CPU. On chip oscillator and clock circuitry. 32 I/O lines. 64 Kbyte address space for external data memory. 64Kbyte address space for external program memory.

    4. What are the Disadvantages of microcontroller?

    Learn large instruction set. Limited calculation procedure. Fixed programming technique to control machine.

    5. What are the Applications of microcontroller?

    Small business system. Office automation. Entertainment. Traffic control.

    6. Write short notes on 8051.

    The microcontroller 8051 is a second generation 8-bit microcontroller. It is a singlechip 40 pin DIP IC. It provides more powerful architecture, more powerful instruction set. Itoperates +5V dc supply.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    2/27

    2 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    7. Define program status word (PSW). (Board exam)

    It is one of the special function register.

    This register contains program status information.

    It is a bit and byte addressable register.

    D7 D6 D5 D4 D3 D2 D1 D0

    8. Define stack pointer.

    This register is an 8-bit register. The stack may reside anywhere in on-chip RAM. It isincremented before data is stored during PUSH and CALL executions. it is decremented afterdata is retrieve from memory during POP and RET execution. After, the stack pointer isinitialized to 07H.this causes the stack begins at location 08H.

    9. Define data pointer. (Board exam)

    It is a 16 bit register. This register contains a higher byte (DPH) and lower byte (DPL) 8 bit registers.

    It may be manipulated as a 16 bit register or as two 8 bit registers.

    10. Define serial data buffer.

    The serial data buffer contains two independent registers of a transmit buffer registerand a receive buffer register.when data is moved to SBUF,it goes to transmit buffer,where it

    is held for serial communication.when data is moved from SBUF ,it comes from the receive buffer.

    11. Define timer registers/How many timer/counters are placed in 8051. (Board exam)

    Microcontroller 8051 has two 16-bit timer/counter registers.

    They are timer 0 and timer 1.

    They are specified as two Register pairs (TH0, TL0) and (TH1, TL1).

    12. Define control registers.

    The special function registers IP, IE, TMOD, TCON, SCON and PCON containcontrol and status information for interrupts,timer/counters and serial port.so,these registersare called control registers.

    13. Write about oscillator.

    This circuit generates the basic timing clock signal for the operation of the circuitusing crystal oscillator.

    14. Write about internal RAM and ROM capacity of 8051. (Board exam)

    Data memory-internal RAM (256 Bytes). External RAM (64Kbytes). Program memory-internal ROM (4Kbytes), external ROM (64Kbytss).

    CY AC F0 RS1 RS0 OV -- P

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    3/27

    3 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    15. Define program counter of 8051. (Board exam)

    The program instruction bytes fetched from locations in memory that areaddressed by the program counter.

    The pc is automatically incremented after every instruction byte is fetched andmay also be altered by certain instructions.

    16. Classify types of I/O ports in 8051. (Board exam)8051 contains 4 I/O ports. Each port has 8 I/O lines. All ports are bi-directional. They

    are

    port 0 port 1 port 2 port 3.

    17. Define timer.

    The counter is programmed to count the internal clock pulses, and then it is known astimer.

    18. Write about 8051 timer functions.

    In the timer function, the register is incremented every machine cycle. That means intimer operation it counts the machine cycles. Since a machine cycle consists of 12 oscillator

    periods, the count rate is 1/12 of oscillator frequency.

    19. Define counter.

    The counter is programmed to count the external clock pulses, then it is known a

    counter.

    20. Write about 8051 counter functions.

    In the counter function, the register is incremented in response to 1 to 0 transition atits corresponding external input pin T0 or T1.since it takes at least 2 machine cycles (24oscillator periods) to recognize a 1 to transition. The maximum count rate is 1/24 of theoscillator frequency (fosc/24).

    21. How many clock cycles and states are placed in one machine cycle? (Board exam)

    In 8085 1 machine cycle consists 6 states, each state having 2 clock cycles. Thereforeone machine cycle consists of 12 clock cycles.

    22. Define clock cycle. (Board exam)

    The square wave generated by the clock sources are called as clock cycles.

    23. Define machine cycle of 8051. (Board exam)

    Certain numbers of clock cycles are required to execute an instruction. These clockcycles are called as machine cycle. One machine cycle of 8051 is made up of six states.

    24. Define state. (Board exam)

    A state is the time interval required for the discrete operations of the microcontrollersuch as fetching an opcode, decoding an opcode or writing a data byte to memory. Each stateconsists of two oscillator pulses (clock cycles).

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    4/27

    4 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    25. Define instruction cycle. (Board exam)

    The time required to fetch and execute an instruction is called as instruction cycle.

    Instruction cycle = fetch cycle + execute cycle.

    26. How many instructions in 8051 microcontroller? (Board exam)

    The 8051 instruction set includes 111 instructions, 49 of which are single byte, 45 two byte and 17 three byte instructions.

    27. Classify the instruction set of 8051. (Board exam)

    Data transfer instructions Arithmetic instructions Logical instructions Control transfer instructions Bit manipulation instructions.

    28. Classify the three types of data transfer instructions in 8051.

    i.General purpose instructions.

    ii.Accumulator specific instructions and

    iii.Address specific data transfer instructions.

    29. Write the types of general purpose data transfer instructions.

    MOV instructions

    PUSH Instructions

    POP instructions

    30. Write the types of accumulator specific data transfer instructions.

    The accumulator specific data transfer instructions move data into and out of theaccumulator. There are four types of instructions,

    i).XCH, ii).XCHD, iii).MOVX, iv).MOVC.

    31. Write the types of address specific data transfer instructions.

    This instruction is used to load 16-bits of address/data into the data pointer.

    MOV DPTR,#address.

    32. Write some byte level data transfer instructions.

    The data transfer instructions moves data from source operand to destination operand.Actually the copy of the data is moved from one place to another place.

    Ex: MOV A,Rn

    The content of the register Rn is copied into the Accumulator.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    5/27

    5 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    MOV Rn, #data

    The content of the second byte of the instruction is copied into the Register Rn.

    33. Write some bit level instructions (Board exam)

    MOV C, bit

    The content of the directly addressed bit is copied into the carry flag.

    MOV bit, C

    The content of the carry bit is copied into the directly addressed bit.

    34. Define addition with examples.

    ADD: This type of instruction adds the content of the accumulator to the content ofsource operand and puts the result in accumulator.

    ADD A, Rn

    The content of register Rn is added with the content of Accumulator and the result is stored inthe accumulator.

    ADD A, #data

    The content of second byte of the instruction is added with the content of accumulator and theresult is stored in accumulator.

    35. Define addition with Carry. Give some Examples.

    This type of instruction adds the content of accumulator and the content of Carry flagwith the content of source operand and puts the result in the accumulator.

    Ex: ADDC A, Rn

    The content of register Rn and the content of carry flag, both are added with thecontent of Accumulator, and the result is stored in accumulator.

    36. Define SUBB with examples

    SUBB(Subtraction with borrow): This type of instructions subtracts the content ofsecond source operand and the content of Carry flag from the content of accumulator. Storedresult in the accumulator.

    Ex: SUBB A, Rn

    The content of register Rn and the content of carry flag both are subtracted from thecontent of accumulator and the result is stored in the accumulator.

    37. Define increment and decrement with example

    INC: This type of instruction adds one to the content of source operand, and puts theresult in the same operand.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    6/27

    6 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    Ex: INC A

    The content of accumulator is increment by one.

    DEC: This type of Instructions subtracts one from the content of source operand andstores the result in same operand.

    Ex: DEC Rn

    The content of Rn is decremented by one.

    38. Define Multiplication with Example.

    MUL instruction performs an unsigned multiplication of the A register by the Bregister ,and produces a double byte result .ACC receives the low order byte,and B receivesthe higher order byte.

    Ex:MUL AB

    The content of Accumulator is multiplied with the content of B register .After multiplicationlower order result stored in Accumulator, higher order result is stored in B register.

    39. Define division with example.

    DIV instruction performs an unsigned division of the register A and B register. Afterdivision quotient is stored in A register and the remainder is stored in B register.

    Ex:DIV AB

    The content of Accumulator is divided by content of B register .After division, the quotient isstored in A register and remainder is stored in B register.

    40. Draw the table to show the flags are affected during the execution of arithmeticinstructions.

    S.NO INSTRUCTIONS FLAG

    1. 2. 3.4.5.6.

    ADDADDCSUBBMULDIVDA

    CY

    OV

    AC

    XXX00X

    XXXXX--

    XXX------

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    7/27

    7 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    41. Write short notes on overflow problem.

    If the result of operations is too large then an overflow has occurred. The programmerhas to monitor the overflow flag while operating the signed numbers.

    In the 8 bit signed number operation, the OV is set for following two conditions:

    i.A carry from D6 to D7 bit, but no carry from D7 bit.

    ii.A carry from D7(cy=1),but no carry from D6 to D7 bit.

    (if there is a carry both from D6 to D7 bit and from D7 out(cy=1),then OV = 0 (overflowwill not set)).

    42. Classify the two types of logical instructions.

    The microcontroller 8051 performs basic logic operations on both bit and byteoperands. It is classified in to two types,

    I. single operand instruction,

    II. Two operand instruction.

    43. Write about single operand instructions.

    CLR instructions set Acc, Carry flag or any directly addressable bit to zero. SETB instructions sets carry flag or directly addressable bit to 1. CPL instruction is used to complement the content of Acc without affecting

    any flags, Carry flag or directly addressable bit location.

    RL,RLC,RR,RRC and SWAP are the five rotate instructions that can be performed on Acc.RL rotates left,RR rotates right,RLC rotates left throughcarry,RRC rotates right through carry and SWAP rotates left through four

    bits.

    44. Write about two operand instructions.

    ANL (AND Logic) instructions perform bit level and byte level AND logicfunctions. The result is returned to the first operand.

    ORL (OR Logic) instructions perform bit level and byte level OR logic

    functions. The result is returned to the first operand. XRL (Ex-OR logic) instructions perform byte level Exclusive OR logicfunction. The result is returned to the first operand.

    45. Give some example for byte level logical instructions.

    ANL A,Rn; the content of register Rn is logically ANDed with the content ofaccumulator, and the result is stored in Accumulator.

    ORL A, direct: the content of directly specified location is logically OR ed with thecontent of Accumulator, and the result is stored in accumulator.

    XRL A,@Ri: the content of memory location addressed by register Ri is logicallyExclusive OR ed with the content of accumulator, and the result is stored in Accumulator.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    8/27

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    9/27

    9 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    II.unconditional jump.

    53. Define unconditional jump instructions with example.

    This type of instruction does not depend on any specific condition.

    Ex: AJMP addr11;

    LJMP addr 16;

    SJMP rel; JMP@A+DPTR.

    54. Define conditional jump instructions and classify their types.

    Conditional jumps perform a jump upon a specific condition .if the mentionedcondition is true, the control will jump to the target address; otherwise it will execute theinstructions continuously. The destination will be within the 256 byte range (-128D to +127D).

    Conditional jump instructions are two types ,

    I.bit level,II.byte level logical instructions.

    55.Give some example for byte level unconditional jump instructions.

    JZ rel,

    JNZ rel,

    CJNE A,direct,rel,

    CJNE A,#data,rel,

    CJNE Rn,#data,rel,

    CJNE @Ri,#data,rel.

    56. Give some examples for bit level jump instructions.

    JC rel,

    JNC rel,

    JB bit,rel,

    JBC bit,rel,JNB bit,rel.

    57. Write short notes on CALL instruction Classify their types.

    The call instruction replaces the contents of the program counter with a new programaddress that causes the program execution to begin at the code located at the new address.During the execution of call instructions the control is transferred from main program tosubroutine or from one subroutine to another subroutine.

    58. Define ACALL.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    10/27

    10 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    ACALL address 11 (absolute call): ACALL is a two byte instruction .ACALLinstruction is only used for handling subroutines. These instruction increments the programscounter twice. The subroutine called must therefore to start within the same 2k block ofmemory.

    59. Define LCALL.

    LCALL address 16 (long call): LCALL is a 3 byte instruction. The call instructionsare generally used for handling subroutines and interrupts. These instructions increments

    program counter by 3. The subroutine may begin anywhere in the full 64K byte of memoryaddress space.

    60. Classify the types of return instructions, write short note to each. (Board exam)

    There are 2 types of return instructions, they are RET, RETI.

    RET: The RET is a return from subroutine instruction.

    RETI: The RETI is a return from an interrupt service subroutine instruction.

    During the execution of both instructions, the high and low bytes of the pc are successivelyPOP from the stack ,and decrementing the stack pointer by 2.

    61. Differentiate RET and RETI instruction. (Board exam)

    The only difference between RET and RETI is that RETI tells the interrupt controlsystem that the interrupt in progress is done. If there is no interrupt in progress at the timeRETI is executed, then the RETI is functionally identical to RET.

    62. Write short notes on time delay routine.

    Delay routines are subroutines used for maintaining the timing of various operationsin microcontroller. In control applications ,certain equipment is need to be ON/OFF after aspecific time delay .In some applications ,certain operation has to be repeated after aspecified time period .In such cases delay routines are used.

    63. How is internal RAM classified? (Board exam)

    The 128 bytes Internal RAM classified into,

    Register bank area, Bit and byte addressable area, Byte addressable area.

    64. How many I/O ports placed in microcontroller 8051? (Board exam)

    3 I/O ports.

    65. How many SFR‘s are placed in microcontroller 8051. (Board exam)

    21 special function 8 bit registers. Among them

    11 – Byte and bit addressable registers10 – Only byte addressable registers.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    11/27

    11 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    66. What is the purpose of SFRs? (Board exam)

    SFRs used to done some special functions in 8051, this registers are called specialfunction registers. Eg.SCON,PCON etc.,

    67. What is the use of EA pin. (Board exam)

    D7 D6 D5 D4 D3 D2 D1 D0

    EA X X ES ET1 EX1 ET0 EX0

    EA-Disable all interrupts. If EA=0, no interrupts will be acknowledged.

    If EA=1, each interrupt source is individually disabled by its corresponding

    bit.

    68. How is the internal RAM is classified. (Board exam)

    Register bank area (0-31)

    Bit and byte addressable locations (32-47)

    Only byte addressable locations (48-127)

    69. Mention the three different address spaces of 8051. (Board exam)

    ROM (program memory) area.

    RAM (128 bytes data memory) area.

    Special function registers (upper 128 bytes of RAM) area.

    70. How many register banks are placed in internal RAM? (Board exam)

    4 Register banks (Bank 0, 1, 2, 3).

    71. How many bit addressable locations are placed in internal RAM? (Board exam)

    128 bit addressable locations in internal RAM. (00-7F)

    72. What is the use of carry flag? (Board exam)

    In an arithmetic operation when a carry is generated, the carry flag is set,otherwise reset.

    The carry flag also serves as a borrow flag for subtraction.

    73. Where is the stack memory placed in 8051? (Board exam)

    Stack may reside anywhere in the on-chip RAM memory area.

    74. Which port is used for alternate input and output functions? (Board exam)

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    12/27

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    13/27

    13 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    UNIT – II

    PROGRAMMING EXAMPLES

    1. List the addressing modes of 8051. (Board exam)

    Immediate addressing mode. Direct addressing mode.

    Indirect addressing mode

    Register addressing mode.

    Index addressing mode.

    2. Write the example for immediate addressing mode.

    MOV A ,#64; this instruction loads the accumulator with the hexadecimal data of 64H.

    3. Write the example for register addressing mode.

    MOV A, R3; This instruction moves the data from register R3 into accumulator.

    4. Write the example for direct addressing mode.

    MOV DIRECT,A;this instruction moves the content of accumulator to direct addressdirectly.

    MOVA, DIRECT: This instruction copies the content of directly specified location toaccumulator.

    5. Write the example for indirect addressing mode.

    MOV @Ri,A;this instruction moves the content of ACC to the memory location specified bythe register R1.

    6. Write example for index addressing mode.

    MOVC A, @A+DPTR; the content of program memory ,which address is specified by thesum of the contents of the registers A and DPTR is moved into Accumulator.

    7. Define Assembler. (Board exam)

    An assembler is basically translator.

    It translates the assembly language program in to machine language program.

    8. Classify the types of assembler.

    Manual assembler Macro assembler, Cross assembler,

    One pass assembler, Two pass assembler.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    14/27

    14 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    9. Define assembler directive.

    Assembler directives are some instructions in the assembly language program, whichare not a part of processor instruction set. The assembler directives allow as to control the

    way in which a program assembles and lists. They will not create any executable machinelanguage codes. The assembler directives also called pseudo – operations.

    10. Give some examples for AD (Assembler directives). (Board exam)

    DB;EQU;END;Label;Comment.

    11. Mention the different fields in assembly language instructions. (Board exam)

    An assembly language instructions consists of 4 fields,

    They are [Label:] mnemonic [operands] [; comment]

    Brackets indicate that a field is optional.

    12. What is operand field? (Board exam)

    The operand field, if required, must follow the operation field, and must be preceded by at least one white space character.

    The operand field may contain a symbol, an expression or a combination ofsymbols and expressions separated by commas.

    13. What are the fields used in assembly language instructions as optional? (Boardexam)

    Label,operants,comment fields are optional in assembly language instructions.

    14. What are the instructions used to access the external RAM? (Board exam)

    MOVX A,@DPTR MOVX @DPTR, A, MOVX A,@Ri,

    MOVX@Ri,A.

    15. How can you perform Multiplication with Example. (Board exam)

    MUL instruction performs an unsigned multiplication of the A register by the Bregister, and produces a double byte result .ACC receives the low order byte, and Breceives the higher order byte.

    Ex:MUL AB

    The content of Accumulator is multiplied with the content of B register .After

    multiplication lower order result stored in Accumulator, higher order result is storedin B register.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    15/27

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    16/27

    16 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    P3.5 T1 – external timer 1 input

    P3.6 WR – external memory write pulse

    P3.7 RD – external memory read pulse.

    7. Specify byte addresses of 8051 I/O ports. (Board exam)

    NAME FUNCTION BYTE ADDRESS BIT ADDRESSESMSB – LSB

    P0P1P2P3

    input/output port 0latchinput/output port 1latchinput/output port 2latchinput/output port 3latch

    80H90HA0H0B0H

    87H – 80H97H – 90HA7H – A0HB7H – B0H

    8. How is internal RAM classified?

    The 128 bytes Internal RAM classified into,

    Register bank area,

    Bit and byte addressable area,

    Byte addressable area.

    9. Specify the address range of bit addressable locations of internal RAM area.

    The address range of bit addressable locations of internal RAM area is 00 – 7FH.

    10. What type of addressing is used for accessing bit addressable internal RAM?

    The bit addresses of internal RAM can be accessed only by using direct addressing.

    11. What will happen during the execution of MOV P2.0, C instruction?

    Moves the data placed in carry flag to port P2.0.

    12. What are the registers used for timer/counter operations?

    TMOD – timer/counter mode control register,TCON – timer/counter control register.

    TH0,TL0

    TH1,TL1

    13. What is the use of GATE bit in TMOD register? (Board exam)

    Timer/counter gating control .when GATE =1, timer/counter “X” is enabledonly while INTX pin is high (hardware control) and TRX (in TCON register)is set.

    When GATE =0, TIMER/COUNTER “X” will run only w hile TRX =1(software control).

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    17/27

    17 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    14. How many bit addressable locations are placed in internal RAM? (Board exam)

    128 bit addressable locations in internal RAM. (00-7F)

    15. Mention the SFRs used in Timer operation. (Board exam)

    TMOD,TCON,TH0,TL0,TH1,TL1

    16. What is the function of c/t bit in TMOD register? (Board exam)

    C/T: countr/timer operation bit.

    This Bit=0 – Timer operation.

    Bit= 1 – counter operation

    17. State the function of M1, M0 bits in TMOD register. (Board exam)

    M1, M0 – bits are mode selector bits.

    M1 M0 Operating modes

    0 0 Mode 0-13bit timer.

    0 1 Mode1-16 bit timer /counter.

    1 0 Mode 2-8 bit auto reload timer/counter.

    1 1 Mode 3-split timer.

    18. What is the function of TF0 bit in TCON register? (Board exam)

    TF0-Timer 0 overflow flag bit.

    Set by hardware on timer/counter overflow.

    Cleared by hardware when processor vectors to its interrupt routine.

    19. State the use of T0 pin of 8051. (Board exam)

    T0-Timer/counter 0 external input pin.

    UNIT – IV

    INTERRUPT AND SERIAL COMMUNICATION

    1. Classify the types of serial port operating modes and their baud rates. (Board exam)

    Modes Baud rate

    Mode 0-shift registers Fosc/12Mode 1-8 bit UART variable

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    18/27

    18 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    Mode 2-9 bit UART Fosc/64 or Fosc/32

    Mode 3- 9 bit UART variable

    2. Classify the types of interrupts, priority levels and their vector addresses in 8051.(Board exam)

    The microcontroller 8051 provides 5 interrupt sources. They are

    Interrupts Priority level vector address

    external interrupt 0 (IE0) highest 0003H

    timer interrupt 0 (TF0) . 000BH

    external interrupt 1 (IE1) . 0013H

    timer interrupt 1 (TF1) . 001BH

    serial port interrupt (TI+RI). Lowest 0023H

    3. Write IE register format.

    D7 D6 D5 D4 D3 D2 D1 D0

    EA X X ES ET1 EX1 ET0 EX0

    4. Write IP register format.

    D7 D6 D5 D4 D3 D2 D1 D0

    X X X PS PT1 PX1 PT0 PX0

    5. Write SCON register format.

    D7 D6 D5 D4 D3 D2 D1 D0

    SM0 SM1 SM2 REN TB8 RB8 TI RI

    6. Write PCON register format.

    D7 D6 D5 D4 D3 D2 D1 D0

    SMOD -- -- -- GF1 GF0 PD IDL

    7. What is the difference between mode 2 and mode 3 in serial communication?

    Only one difference between mode 2 and mode 3 are mode 2 is fixed baud rate andmode 3 is variable baud rate.

    8. What are the registers used for serial communication in 8051?

    SCON – serial port control register

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    19/27

    19 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    PCON – power control register.

    9. Specify the baud rate of serial communication in mode 2.

    The baud rate is programmable to either Fosc/32 or Fosc/64.

    10. What is the use of RS 232? (Board exam)

    It is used for serial communication.

    It is a protocol standard as well as electrical standard.

    11. Why drivers are used in between RS 232 and microcontroller? (Board exam)

    Line drivers are (voltage converter) used to convert RS232„s signals to TTL voltagelevels, that will be acceptable to the 8051‟s TXD and RXD pins.

    12. What are the SFR registers used in interrupt operations?

    The TCON, IP and IE special function registers are used for executing interrupts inmicrocontroller 8051.

    13. What are the different classifications of serial communication?

    i. synchronous data transfer,

    ii. asynchronous data transfer.

    14. Write about synchronous and asynchronous data transfer.

    In synchronous data transfer a block of data is transferred at a time. In asynchronous

    data transfer only one byte of data transfer at a time.

    15. Specify some special IC chips used for serial communication.

    UART – Universal asynchronous receiver transmitter.

    USART – Universal synchronous - asynchronous receiver transmitter.

    16. Classify the types of serial communication based on direction of communication .

    i. simplex communication

    ii. Half duplex communication

    iii. Full duplex communication.

    17. Define simplex, half duplex, full duplex communication.

    Simplex – if the data transmission takes place only in one direction. Ex:Radio/TV station Transmission

    Half duplex - if the data transmission is in one direction at a time. Ex: Walkytalky

    Full duplex – if the data transmission takes place on both the direction at atime or simultaneously. Ex: Mobile phone

    18. Define protocol.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    20/27

    20 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    The data to be transmitted are all 0s and 1s, it is difficult to find out where the byte ofdata starts and ends. Therefore, a set of rules called as protocol.

    19. Define framing.

    The start bit indicates the beginning of a byte and stop bit indicate the end of that byte. That is the actual data is placed in between start and stop bit. This procedure is called asframing.

    20. Define baud rate.

    The rate of data transfer is specified in terms of bits per second (bps).This rate iscalled as baud rate.

    21. Define band rate.

    The band rate is defined as the number of signal changes per second.

    22. What is the use of start and stop bit?

    To identify the beginning and end of a byte of data, we have add the start bit and stop bit with the byte of data to be transmitted.

    23. What is RS - 232? (Board exam)

    RS232C is a serial interface standard.

    It is developed by Electronic Industries Association (EIA).this standarddescribes the functions of 25 signals and handshake pins for serial datatransfer.

    24. What is MAX232?

    MAX 232 is a voltage converter. It converts from RS232 voltage levels to TTLvoltage levels and viseversa.one advantage of MAX232 chip is that it uses +5v power supply.So a single power supply can be used to power both 8051 and MAX 232.

    25. What do you mean by software generated interrupt?

    If an interrupt lag is set 1 by the software program instruction, an interrupt isgenerated and executed in a similar way the hardware generated interrupts are handled. Sincethis generated by the software, it is called a software generated interrupt.

    26. Define interrupt handler.

    The program flow is always sequential. But the interrupts can stop the normal program flow, execute a subroutine and then resume the normal program flow. Thissubroutine called an interrupt handler.

    27. What is the use of IP, IE register in 8051?

    The programmer can control the interrupts by altering the control bits in the interruptenable register (IE), and interrupt priority register (IP).

    28. How will you double the baud rate in 8051? (Board exam) The SMOD bit in PCON is used to set the baud rate of serial communication.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    21/27

    21 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    It is double baud rate bit.

    When SMOD bit is set to 1, the baud rate is doubled, when the serial port isused in either mode 1, 2, 3.

    29. What is the function of SMOD in PCON register? (Board exam)

    The SMOD bit in PCON is used to set the baud rate of serial communication.

    It is double baud rate bit.

    When SMOD bit is set to 1, the baud rate is doubled, when the serial port isused in either mode 1, 2, 3.

    30. What is the function of REN bit in SCON register? (Board exam)

    REN- Enable serial reception.

    It is set /cleared by software to enable/disable reception.

    31. How many timer/counters are placed in 8051? (Board exam)

    Microcontroller 8051 has two 16-bit timer/counter registers.

    They are timer 0 and timer 1.

    They are specified as two Register pairs (TH0, TL0) and (TH1, TL1).

    32. Define 8051 timer functions. (Board exam)

    In the timer function, the register is incremented every machine cycle.

    That means in timer operation it counts the machine cycles.

    Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12of oscillator frequency.

    33. Define 8051 counter functions. (Board exam)

    The counter is programmed to count the external clock pulses, and then it isknown a counter.

    In the counter function, the register is incremented in response to 1 to 0transitions at its corresponding external input pin T0 or T1.

    Since it takes at least 2 machine cycles (24 oscillator periods) to recognize a 1to transition. The maximum count rate is 1/24 of the oscillator frequency(fosc/24).

    34. What is the difference between mode 2 and mode 3 of serial communication? (Boardexam)

    Mode 2 & 3 are used for same operation but baud rate is varied. Mode2 – 9 bit UART (fixed baud rate) Mode 3 – 9 bit UART (Variable baud rate)

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    22/27

    22 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    35. How is the serial transmission is initiated in 8051? (Board exam)

    The transmission is initiated by any instruction that uses SBUF as adestination register.

    Ex.MOV SBUF, A

    36. What are the conditions required for initiating a serial reception? (Board exam)

    Reception is initiated in Mode 0 by the condition RI = 0 and REN = 1. In other modes it is initiated by the incoming start bit, if REN = 1.

    37. What are the registers used for serial communication? (Board exam)

    SCON, PCON, TMOD, TH1, TL1, TH0, TL0, SBUF.

    38. Specify the baud rate of serial communication in mode 2. (Board exam)

    The baud rate in Mode 2 depends on the value of SMOD in special functionregister in PCON.

    If SMOD = 0, the baud rate is fosc/64. If SMOD = 1, the baud rate is fosc/32.

    Mode 2 baud rate = 2 SMOD X (oscillator frequency)

    64

    39. What is interrupt signal? (Board exam)

    Interrupts are control signals, used for getting immediate attention ofmicrocontroller.

    When an interrupt occurs, the microcontroller stops the execution of main program and its control is immediately transferred to its corresponding servicesubroutine.

    40. What are the SFRs used in interrupt operations? (Board exam)

    IE, IP, SCON, TCON.

    41. Write the pindetails of RS232. (Board exam)

    Pin number Description1 Protective ground

    2 Transmitted data(TxD)3 Received data(RxD)4

    Request to send(RTS)

    5 Clear to send6 Data set ready7 Signal ground8 Data carrier detect

    9/10 Reserved for data testing11 Unassigned12 Secondary datacarrier detect

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    23/27

    23 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    13 Secondary clear to send14 Secondary transmitted data15 Transmit signal element timing16 Secondary received data17 Receive signal element timing18 Unassigned19 Secondary request to send

    20 Data terminal ready21 Signal quality detector22 Ring indicator23 Data signal rate select24 Transmit signal element timing

    25

    Unassigned

    UNIT – V

    INTERFACING TECHNIQUES

    1. Define peripheral. (Board exam)

    The microcontroller accepts data from input devices (keyboard, switches) thenit processes the data as per the instructions received from the memory unit.

    After processing the data, it sends the result to the output devices (LEDdisplay, LCD, printers).

    These input and output devices are called peripherals.

    2. Define interfacing. (Board exam)

    Designing logic circuits and writing instructions to enable themicrocontroller/microprocessor to communicate with these peripherals is called interfacing.

    3. What is the use of 8255?

    8255 – is a programmable peripheral interface. It is used to perform a variety ofinput/output functions in a microcomputer system. The 8255 interfaces themicroprocessor/microcontroller on one side with peripherals on the other side.

    4. Mention the ports placed in 8255. (Board exam)

    The 8255 consists of two 8 bit ports of port A and port B, and two 4 bit ports of port Cupper and port C lower. The ports are grouped as Group A and Group B.Group A consists of

    port A (PA0 – PA7) and port C upper (PC7 – PC4).Group B consists of port B (PB7 – PB0)and port C lower (PC3 – PC0).

    5. Define control word.

    The control section of 8255 has an 8 bit register called control register. An 8 bit binary word present in the control register is called control word.

    6. State the modes of operation of 8255. (Board exam)

    The operation of 8255 can be classified into two modes. They are Bit set/Reset modeand I/O mode.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    24/27

    24 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    7. How is the I/O mode of 8255 classified? (Board exam)

    The I/O mode is further classified into 3 modes. They are

    Mode 0 - simple I/O port

    Mode 1 – Strobe I/O port (hand shake I/O port)

    Mode 2 – Bidirectional I/O port

    8. What is relay? (Board exam)

    A relay is an electrically controllable switch widely used in industrial controls,automobiles and appliances. It allows the isolation of two separate sections of a system withtwo different voltage sources.

    9. Mention the 3 important components of electromagnetic relay. (Board exam)

    The electromagnetic relays have 3 components: coil, spring and contacts.

    10. Define opto isolator. (Board exam)

    Opto isolator is otherwise called opto coupler. It isolates two part of a system.

    11. Define transducers (sensors). (Board exam)

    Transducers convert physical data such as temperature, light intensity, flow and speedto electrical signals. Depending on the transducers, the output maybe in the form of voltage,current, resistance or capacitance.

    12. How is the output voltage of LM 34 varied? (Board exam)

    The sensors of LM 34 series are precision integrated circuit temperature sensorswhose output voltage is linearly proportional to the Fahrenheit temperature. Its output isvaried to 10mV for each degree of Fahrenheit temperature.

    13. How is the output voltage of LM 35 varied? (Board exam)

    LM 35 series sensors are precision integrated circuit temperature sensors, whoseoutput voltage is linearly proportional to the Celsius temperature, Its output is varied to10mV for each degree of centigrade temperature.

    14. What is signal conditioning?

    Signal conditioning is widely used for data acquisition. The most common transducers produce an output in the form of voltage, current, charge, capacitance and resistance. Thesesignals are converted into voltage, in order to send input to an A – to – D converter. Thisconversion is commonly called signal conditioning.

    15. Define ADC. (Board exam)

    Analog to digital converters are most widely used devices for data acquisition. Digitalcomputers use binary values, but in the physical world everything is analog.ADC is used toconvert these analog values into digital.

    16. Mention the ports placed in group A and group B of 8255.

    Group A-port A and port C upper (PC7-PC4). Group B-port B and port C lower (PC3-PC0).

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    25/27

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    26/27

    26 | p r e p a r e d b y K . S h a n m u g a p r i y a & R . S i v a k u m a r / L e c t u r e r ( M C )

    27. What is the use of RTC? (Board exam)The real time clock (RTC) is a widely used device that provides accurate time and

    date for many applications. The RTC chip in IBMPC provides time components of hour,minute, and second, in addition to the date/calendar components of year, month and day. Ituses an internal battery, which keeps the time and date even when the power is off.

    28. Mention the capacity of nonvolatile RAM placed inside of DS 12887. (Board exam)The DS 12887 has a total of 128 bytes of nonvolatile RAM. It uses 14 bytes of RAM

    for clock/calendar and control registers, and the other 114 bytes of RAM for general purposedata storage.

    29. What is key bounce?One of the most common problems with a single switch is keybounce.key bounce

    refers to the fact that when the contacts of a mechanical switch is closed, they bounce for a

    short time before staying together.

    30. Define conversion time of ADC.The conversion time of ADC is defined as the time it takes the ADC to convert the

    analog input to digital number.

    31. What is the use of IC 8253? (Board exam)

    IC 8253 is a programmable counter /timer It generate accurate time delays

    It can be used for applications such as real time clock, an event counter, squarewave generator.

    32. Which mode of IC 8253 is called as software triggered strobe? (Board exam)

    Mode 4

    33. List the operating modes of IC 8253. (Board exam)

    Mode 0 (interrupt on terminal count) Mode 1 (programmable monoshot) Mode 2 (rate generator) Mode 3 (square wave generator) Mode 4 (software triggered strobe) Mode 5 (hardware triggered strobe)

    34. How many counters placed in 8253? (Board exam)

    3 counters (16 bit presettable down counters)

    35. Draw the diagram for relay interface with 8051.

  • 8/16/2019 24052-Microcontroller.pdf-1411210674

    27/27