Wednesday, February 22, 2012

ET1010 MICROCONTROLLER APPLICATIONS

Sample End-of-module Quiz


Sample Quiz Questions – C6 Timer

Q1. Which of the following applications requires timing?
a. A lamp that switches on automatically when it is dark and human is detected.
b. Zebra crossing lights that blink at a fixed rate.
c. A set of corridor lights that can be switched on/off by switches at both ends of the corridor.
d. A fan that turns on automatically when the room temperature is above a preset threshold.

Q2. What is the difference between a timer and a counter?
a. A timer is clocked by a clock signal that has a fixed and known period.
b. A counter is clocked by a clock signal that has a fixed and known period.
c. A timer can count events occurring at irregular intervals.
d. A counter has more bits than a timer.

Q3. If the clock signal reaching a 16-bit timer is Fosc/4 = 12 MHz, how long does it take for the timer to count from 0 to 65535 and then roll over? [working: 65536 /12 x 10^6 = 5.4613ms]
a. 0.1 second
b. 1.3981 second
c. 5.4613 ms
d. 1.3653 ms

Q4. Which of the following is NOT a feature of one of PIC18F4550’s timers?
a. Selectable 8-/16-bit timer/counter operation.
b. Selectable pre-scalar value.
c. Interrupt on overflow.
d. Selectable up / down counting.

Q5. How much delay is introduced by Delay10KTCYx(120) if fosc = 48 MHz? [working: ( 120 x 10000 x 4 x 1/48 )us = 100000us = 0.1s]
a. 0.1 s
b. 0.01 s
c. 0.001 s
d. 0.1 ms

Q6. What does the following C-code do?
          while(PORTBbits.RB0 == 1); // active low switch at RB0
          Delay10KTCYx(120);
          PORTDbits.RD0 = 1; // active high LED at RD0
a. Switch on LED sometime after switch is pressed.
b. Switch off LED sometime after switch is pressed.
c. Switch on LED sometime after switch is released.
d. Switch off LED sometime after switch is released.

Q7. Which of the following statements on the Timer0 registers is FALSE?
a. TMR0H should be written to before TMR0L.
b. TMR0H should be read before TMR0L.
c. TMR0H:TMR0L together forms a 16-bit timer/counter.
d. Timer overflow causes TMR0IF bit of the INTCON register to be set.

Q8. Which of the following statements on the Timer0 registers is FALSE?
a. To turn on Timer 0, set TMR0ON bit of the T0CON register.
b. To configure Timer0 as a 16-bit timer/counter, set T08BIT bit of the T0CON register.
c. To use the internal clock (Fosc/4 from the XTAL oscillator), clear T0CS bit of the T0CON register.
d. To bypass the pre-scalar, set PSA bit of the T0CON register.

Q9. Assuming the crystal oscillator with Fosc = 48 MHz is used as the clock source and a pre-scale value of 256 is used, how long does it take for Timer0 to count from 0x0000 to 0xFFFF and roll over?
[working: Period = 1 / ( Fosc/4/pre-scale )
Time = 65536 x period]
a. 1/12 us
b. 5.4613 ms
c. 1.3981 s
d. 0.1 s

Q10. If Timer0 counts up by one every 2.667 us, how long does it take to count from 28036 to 65535 and roll over?
a. 0.1 s
b. 1.3981 s
c. 5.4613 ms
d. 1/12 us

Q11. If Timer0 counts up by one every 2 us, where should the 16-bit timer start counting from, if exactly 0.1 second is to elapse by the time it overflows?
a. 50000
b. 15436
c. 15536
d. 15636

Q12. Arrange in order the steps to add a delay using Timer0:

       O Write an appropriate “starting count” value to TMR0H:TMR0L.
       [] Wait for the timer to overflow i.e. TMR01F to become 1.
       ∇ Use T0CON to configure and turn on the timer.

a. [] ∇ O
b. O [] ∇
c. ∇ O []
d. ∇ [] O

Q13. Which of the following is NOT a valid method to lengthen the delay that Timer0 can produce?
a. Use Timer0 as 16-bit, instead of 8-bit.
b. Use a higher frequency crystal.
c. Use a bigger pre-scale value.
d. Use external clock and apply a slow clock at T0CK1.

Q14. Since the Delay functions can also be used to introduce a delay, why should the PIC Timer be used?
a. Timer can be used with interrupt, so the PIC can do other things while waiting for the time to pass.
b. Using Timer is easier than calling a delay function.
c. If Timer is not used, it is wasted.
d. Timer that uses internal clock becomes an event counter.

Q15. The steps to measure the width of a pulse are given below. Arrange them in order:
          O Configure and turn on the Timer.
          [] When a high to low transition occurs, stop Timer from counting further.
          ∇ When a low to high transition occurs, reset Timer to count from 0.
          * The final count multiplied by the clock period gives the elapsed time.

a. O ∇ [] *
b. ∇ O [] *
c. O [] ∇ *
d. [] ∇ O *

Q16. When timer is used to measure elapsed time and TMR0L and TMR0H have been read (into the variables TempLow and TempHigh respectively), what command is needed to compute the time elapsed in us, given that the timer counts up by one every 2.67 us?
a. Elapsed_Time = TempHigh + TempLow;
b. Elapsed_Time = TempHigh + TempLow * 256;
c. Elapsed_Time = TempHigh * 256 + TempLow;
d. Elapsed_Time = (TempHigh * 256 + TempLow) * 2.67;

Q17. Which of the following registers is NOT associated with Timer2 operation?
a. TMR2
b. PR2
c. T2CON
d. TRISD

Q18. A 50% duty cycle PWM waveform with high voltage of 5V and low voltage of 0V is similar to a DC voltage of
a. 5V
b. 2V
c. 2.5V
d. 0V

Q19. The formula to compute the PWM period is
          PWM period = ( PR2 + 1 ) x 4 x N x Tosc
What is the significance of N?
a. It is the Timer2 pre-scalar value of 1, 4 or 16, as specified in the T2CON register.
b. It is the number of timers used.
c. It is the duty cycle.
d. It is the number of bits in Timer2.

Q20. To generate a 50% duty cycle PWM with period specified using a PR2 value of 200, what should be the value of the CCPR1L register?
a. 200
b. 100
c. 50
d. 25

Sample Quiz Questions – C7 Interrupt

Q21. The two methods a micro-controller can respond to events are:
a. polling and interrupt
b. polling and capture
c. compare and interrupt
d. capture and compare

Q22. Which of the following is NOT true for polling?
a. Peripherals are checked in sequence to see if attention is needed.
b. The micro-controller can waste considerable time checking inactive peripherals.
c. Priority can be assigned, so that half-way serving a low-priority peripheral, the micro-controller can respond to a higher-priority peripheral requiring attention.
d. The micro-controller is kept busy.

Q23. What does this C statement do: while (PORTBbits.RB0 == 0); ?
a. It waits for RB0 to become 0.
b. It waits for RB0 to become 1.
c. It makes RB0 logic 0.
d. It makes RB0 logic 1.

Q24. What does this C statement do: while (INTCONbits.TMR0IF == 0); ?
a. It waits for Timer0 to reach the maximum count.
b. It waits for Timer0 to start counting.
c. It waits for Timer0 to roll over.
d. It waits for Timer0 to stop counting.

Q25. Which of the following is NOT an advantage of interrupt over polling?
a. Interrupt frees micro-controller from constantly checking inactive peripherals.
b. Interrupt allows priority to be assigned to peripherals.
c. A high-priority peripheral device can receive attention even when the micro-controlling is serving a lower-priority peripheral.
d. Peripherals are served in a “round-robin” fashion when interrupt is used.

Q26. What is the purpose of the code “INTCONbits.GIE = 1;” ?
a. To enable Timer0 interrupt.
b. To enable INT0 external hardware interrupt.
c. To use priority in interrupt.
d. To enable interrupt globally.

Sample Quiz Questions – C7 Interrupt

Q27. Which bits of the INTCON register must be set/cleared to enable Timer0 interrupt?
a. GIE = 0, TMR0IE = 0
b. GIE = 0, TMR0IE = 1
c. GIE = 1, TMR0IE = 0
d. GIE = 1, TMR0IE = 1

Q28. Which of the following conditions is NOT required for Timer0 overflow to be serviced by an interrupt service routine?
a. Global Interrupt Enable bit must be set.
b. Timer0 Interrupt Enable bit must be set.
c. Timer0 Overflow (Interrupt) Flag bit must be set.
d. Interrupt priority must be used.

Q29. What is an interrupt vector?
a. It is a location where the code to service an interrupt is stored.
b. It is the same as the interrupt service routine.
c. It is a location where the hardware to service an interrupt is stored.
d. It is a location where the code to service a reset is stored.

Q30. What is the significance of the GOTO statement in the code segment below?

#pragma code high_vector = 0x0008
void my_hi_priority_intr_vec (void)
{ _asm GOTO my_Timer0_isr _endasm }

a. When the micro-controller is reset, it is made to execute the function “my_Timer0_isr”.
b. When a low priority Timer0 interrupt occurs, the micro-controller is made to “branch” to the function “my_Timer0_isr”.
c. When a high priority Timer0 interrupt occurs, the micro-controller is made to “branch” to the function “my_Timer0_isr”.
d. When the micro-controller is shutting down, it is made to execute the function “my_Timer0_isr”.

Q31. What is an interrupt service routine?
a. It is a function called by the main program when polling is required.
b. It is a function that serves a peripheral that interrupts the micro-controller.
c. It is a hardware peripheral dedicated to interrupt handling.
d. It is a function that is invoked every time a port pin changes state.

Q32. Why must interrupt be re-enabled at the end of the interrupt service routine?
a. So that a high priority event can interrupt a routine serving a low priority event.
b. So that further interrupt will be disabled.
c. So that further interrupt will be allowed to happen.
d. So that a low priority event can interrupt a routine serving a high priority event.

Q33. The micro-controller is executing statement_2 in a while(1) loop when Timer0
overflows and interrupts the controller. Which statement is executing next
when the controller is done with statement_2?
a. Statement_1 in the while loop.
b. Statement_2 in the while loop.
c. The GOTO statement at the interrupt vector.
d. The first line of the interrupt service routine.

Q34. The INT0 external hardware interrupt, by default, responds to
a. a low to high transition at the RB0 pin.
b. a high to low transition at the RB0 pin.
c. both a high to low and a low to high transition at the RB0 pin.
d. a change in the state of any PORTB pin.

Q35. Which bits of the INTCON register must be set/cleared to enable INT0
interrupt?
a. GIE = 0, INT0IE = 0
b. GIE = 0, INT0IE = 1
c. GIE = 1, INT0IE = 0
d. GIE = 1, INT0IE = 1

Q36. Which of the following conditions is NOT required for INT0 external interrupt
to be serviced by an interrupt service routine?
a. Global Interrupt Enable bit must be set.
b. INT0 Interrupt Enable bit must be set.
c. INT0 (Interrupt) Flag bit must be set.
d. Interrupt priority must be used.

Q37. What happens when INTEDG0 in the INTCON2 register is set?
a. INT0 interrupt occurs when there is no change in the state of RB0 pin.
b. INT0 interrupt occurs when there is a falling edge at RB0.
c. INT0 interrupt occurs when there is a rising edge at RB0.
d. INT0 interrupt will become disabled.

Q38. Given the following ISR, which interrupt(s) is/are used in the micro-controller
application?

          #pragma interrupt my_isr
          void my_isr (void)
          {
          if (TMR0IF == 1)
          my_Timer0_isr;
          if (INT0IF == 1)
          my_INT0_isr;
          }

a. Only Timer0 overflow interrupt.
b. Only INT0 external hardware interrupt.
c. Both Timer0 and INT0 interrupts.
d. None of the above.

Q39. What happens when IPEN (Interrupt Priority Enable) is set?
a. Those interrupt sources with the corresponding IP (Interrupt Priority) bits set (to 1) will become high-priority interrupts.
b. Those interrupt sources with the corresponding IP (Interrupt Priority) bits cleared (to 0) will become high-priority interrupts.
c. Those interrupt sources with the corresponding IP (Interrupt Priority) bits set (to 1) will become low-priority interrupts.
d. Only low priority interrupt can be used.

Q40. Which of the following on interrupt priority is NOT true?
a. A high priority interrupt can interrupt a low priority interrupt.
b. A low priority interrupt can interrupt a high priority interrupt.
c. By default, all interrupt are high priority.
d. When priority is enabled, some interrupts can be made high priority while
others, low priority.

Sample Quiz Questions – C8 Serial Comm.

Q41. The advantage of serial transfer over parallel transfer is
a. Less wire is required when serial data transfer is used.
b. More wire is required when serial data transfer is used.
c. Serial data transfer is faster.
d. Serial data transfer is slower.

Q42. A parallel-in-serial-out shift register
a. converts serial data to parallel data.
b. converts parallel data to serial data.
c. checks the integrity of parallel data.
d. allows a character byte to be framed with start and stop bits.

Q43. When is a modem required for serial communication?
a. When the serial data is to be transferred over short distance.
b. When the serial data is to be transferred between computers.
c. When the serial data is to be transferred over the telephone line.
d. When the serial data is to be transferred between micro-controllers.

Q44. When a large block of data is to be transferred serially,
a. a modem must be used.
b. synchronous method can be used.
c. a lot of idle time is necessary.
d. full duplex transfer should be used.

Q45. When two devices communicate with each other serially, the communication is
said to be “full duplex” when
a. data can only flow one way.
b. data can only flow from one device to the other, but not vice versa.
c. data can only flow in one direction at any one time.
d. data can flow in both directions at the same time.

Q46. When a character is sent serially
a. the start bit goes out first.
b. the parity bit must be appended.
c. the stop bit goes out first.
d. the character must be framed as 8 bits.

Q47. What is the parity bit for the ASCII ‘A’ i.e. 0b01000001?
a. 1 if even parity is used.
b. 1 if odd parity is used.
c. 1, whether odd or even parity is used.
d. 0, whether odd or even parity is used.

Q48. 9600 bps means
a. 9600 bytes is transferred per second.
b. 9600 bits is transferred per second.
c. 9600 characters is transferred per second.
d. 9600 integers is transferred per second.

Q49. Which of the following on the RS232 interfacing standards is true?
a. A ‘1’ is represented by -3 to -25 V.
b. A ‘1’ is represented by 5 V.
c. A ‘0’ is represented by 0 to -15 V.
d. A ‘0’ is represented by 0 V.

Q50. Why is a voltage converter such as MAX233 required in serial communication?
a. To check for data integrity.
b. To convert TTL voltages to RS232 voltages and vice versa.
c. To automatically insert start and stop bits.
d. To ensure that both sides use the same baud rate.

Q51. When two devices are connected for serial communication,
a. the Tx of one device must be connected to the Rx of the other device.
b. the Tx of one device must be connected to the Tx of the other device.
c. the Rx of both devices must be connected together.
d. MAX232 must be used.

Q52. Which of the following statements on PIC18F4550 USART is NOT true?
a. The SPRG register is used for setting the baud rate.
b. The TXREG register is used to deposit the data to be transmitted.
c. The RCREG register is for receive status and control.
d. The TXSTA register is for transmit status and control.

Q53. Given that Desired Baud Rate = Fosc / [ 64 ( X + 1 ) ], where X is the value
loaded into the SPBRG register, compute X when Fosc = 48 MHz and desired
baud rate = 9,600.
a. 75
b. 76
c. 77
d. 78

Q54. Which of the following is NOT a valid method for increasing the baud rate?
a. Use a higher-frequency crystal.
b. Set bit 2 (i.e. BRGH) of the TXSTA register.
c. Deposit a bigger number in the TXREG.
d. Use a smaller number in the SPBRG register as Baud Rate = Fosc / 16 ( X + 1 ) ].

Q55. Which of the following ensures that the Tx pin is configured as an output pin?
a. TRISCbits.TRISC6 = 0;
b. SPBRG = 77;
c. TXREG = data_out;
d. PIR1bits.TXIF == 1

Q56. Which of the following tells you that a byte has been transmitted serially?
a. TRISCbits.TRISC6 = 0;
b. SPBRG = 77;
c. TXREG = data_out;
d. PIR1bits.TXIF == 1

Q57. Which of the following is used to send out a byte of data serially?
a. TRISCbits.TRISC6 = 0;
b. SPBRG = 77;
c. TXREG = data_out;
d. PIR1bits.TXIF == 1;

Q58. Which of the following ensures that the Rx pin is configured as an input pin?
a. TRISCbits.TRISC7 = 1;
b. SPBRG = 77;
c. data_in = RCREG;
d. PIR1bits.RCIF == 1;

Q59. Which of the following tells you that a byte has been received serially?
a. TRISCbits.TRISC7 = 1;
b. SPBRG = 77;
c. data_in = RCREG;
d. PIR1bits.RCIF == 1;

Q60. Which of the following is used to receive a byte of data serially?
a. TRISCbits.TRISC7 = 1;
b. SPBRG = 77;
c. data_in = RCREG;
d. PIR1bits.RCIF == 1;

3 comments:

  1. Thanks for sharing this useful info. Keep updating same way. Please Visit:

    sccm implementation
    16 bit applications
    application packaging

    ReplyDelete
  2. Thank you for sharing information with us,Learn Microcontrollers and Applications
    with Our Adaptable Online Videos & Course Materials. Sign Up Now!

    ReplyDelete
  3. The E1010 Applications of Micro controller explained in the above blog is quite informative, you can also visit Microcontroller Applications for more information.

    ReplyDelete