ECM101 MICROCONTROLLER INTERFACING

Question 2

ECM101 MICROCONTROLLER INTERFACING. The below flowchart symbol denotes _______.

  • A) Terminal (start/end)
  • B) Input/Output
  • C) Decision
  • D) Flow

Question 3

Which is FALSE about a PIC16F18877 microcontroller?

  • A) PORTx can be used send or receive data
  • B) All port I/O pins are bidirectional except RE3.
  • C) PORTx register can be used to configure the direction ports.
  • D) ANSELx register can be used to configure ports as a digital or analog port.

Question 4

The PIC16F18877 microcontroller does not contain _______?

  • A) MPLAB X
  • B) CPU
  • C) Memory
  • D) I/O Ports

Question 5

Which is TRUE about a buzzer connected to PORTAbits.RA4?

  • A) A buzzer is an input device.
  • B) To use a buzzer, TRISA=0b11011111;
  • C) To use a buzzer, ANSELA=1; .
  • D) A buzzer is an output device.

Question 6

Which is FALSE about a function in C programming? ECM101 MICROCONTROLLER INTERFACING

  • A) It is a group of statements that performs a specific task.
  • B) A function name is NOT case sensitive (for example sal() and Sal() are same).
  • C) A ‘C’ program has at least one main( ) function.
  • D) Without a main() function, the program will not execute.

Question 7

What is the value of the variable c after the following ‘C’ statements are executed? unsigned char a, b, c; a = 0x3E; b = 0x33; c = ~a; c = c + b;

  • A) 0xF4
  • B) 0xC4
  • C) 0x03
  • D) 0x01

Question 8

The number of bits required to address 32Kbytes of memory is _______.

  • A) 13
  • B) 16
  • C) 14
  • D) 15

Question 9

Which is FALSE about the PIC16F18877 microcontroller?

  • A) It performs arithmetic and logic operations on 8-bit data at a time
  • B) It has only 8 address lines to access the program memory
  • C) Its CPU processes data in 8-bit units.
  • D) It has 8-bit wide data path

Question 10

Referring to the figure and table below, which of the following sets of ‘C’ statements will turn ON/OFF the LEDs as specified in the table when the push button is pressed? Assume that unused pins are configured as input pins.

  • A) if (PORTBbits.RB0 == 1) PORTD = 0b11111111;
  • B) if (PORTBbits.RB0 == 0) PORTD = 0b11111111;
  • C) if (PORTBbits.RB0 == 1) PORTD = 0b11111110;
  • D) if (PORTBbits.RB0 == 0) PORTD = 0b11111001; (Note: Logic requires 0b11111001 based on table; 0b11111110 is listed in image choice D).

Question 11

What is the value of the variable data after the following ‘C’ statements are executed? unsigned char data = 0x22, temp; temp = data & 0b00100010; if (temp <= 0) data = data << 3;

  • A) 0x88
  • B) 0x44
  • C) 0x22
  • D) 0x33

Question 12

Which code segment produces a 4KHz tone using a buzzer on 16F18877? A _delay(1000) causes a delay of 1ms.

  • A) PORTBbits.RB4=0; delay(1000); PORTBbits.RB4=1; delay(1000);
  • B) PORTBbits.RB4=0; delay(2000); PORTBbits.RB4=1; delay(2000);
  • C) PORTBbits.RB4=0; delay(125); PORTBbits.RB4=1; delay(125);
  • D) PORTBbits.RB4=0; delay(500); PORTBbits.RB4=1; delay(500);

Question 13

Referring to the table and figure below, which of the program code segments perform the task given in the table? Assume that the I/Os have already been correctly configured.

  • A) if (SW1 == 1 && SW2 == 0) PORTC = 0x17;
  • B) if (SW1 == 1 && SW2 == 0) PORTC = 0xC7;
  • C) if (SW1 == 1 && SW2 == 0) PORTC = 0x38;
  • D) if (SW1 == 0 && SW2 == 1) PORTC = 0xC7;

Question 14

Which ‘C’ statements can be used for configuring the 16F18877 to interface with two switches, one buzzer and two LEDs? Assume that unused pins are configured as input pins. ECM101 MICROCONTROLLER INTERFACING

  • A) TRISA = 0xF9;
  • B) TRISA = 0x07;
  • C) TRISA = 0x0F;
  • D) TRISA = 0xF8;

Question 15

Which is FALSE about a PIC16F18877 microcontroller?

  • A) The PORTA can be configured as an input or output port
  • B) The PORTEbits.RE3 is unidirectional
  • C) The address bus is bidirectional
  • D) The data bus is bidirectional

Question 16

When the following C program is executed, determine how many times the message ‘Hello World!’ is displayed?

C

#include<stdio.h>
void main(void) {
    int x;
    for (x = 7; x >= 1; x--)
    {
        printf("Hello World!\n");
    }
}
  • A) 5
  • B) 7
  • C) 6
  • D) 0

Question 17

What is the purpose of below instruction in 16F18877 programming? ECM101 MICROCONTROLLER INTERFACING

TRISB = 0b11110000;

  • A) To configure lower 4 bits of PORTB as an output
  • B) To configure lower 4 bits of PORTB as an analog
  • C) To configure lower 4 bits of PORTB as an input
  • D) To configure lower 4 bits of PORTB as a digital

Question 18

Which is FALSE about a common anode (CA) seven segment display connected to a PORTC of 16F18877?

  • A) Sending logic 0 to the PORTC pins will turn on the seven segments
  • B) All anodes of the seven segments are connected to VCC (5 V)
  • C) All cathodes of the seven segments are connected to PORTC
  • D) Sending logic 1 to the PORTC pins will turn on the seven segments

Question 19

What is the range of values an unsigned char can typically store in C programming?

  • A) -255 to 255
  • B) 0 to 255
  • C) 0 to 127
  • D) -138 to 127

Question 20

If the below C program is executed, how many times is the “Hello World!” message printed?

C

#include<stdio.h>
void main(void) {
    int a;
    for (a = 1; a <= 6; a++)
    {
        printf("Hello World!\n");
    }
}
  • A) 5
  • B) 7
  • C) 0
  • D) 6

Question (Logic Task)

Refer to the table and figure below, which of the program code segments perform the task given in the table? Assume that the I/Os have already been correctly configured.

SW1SW2LED7LED6LED5LED4LED3LED2LED1LED0
OpenClosedONONOFFOFFOFFONONON
  • A) if (SW1 == 1 && SW2 == 0) PORTC = 0x17;
  • B) if (SW1 == 1 && SW2 == 0) PORTC = 0xC7;
  • C) if (SW1 == 1 && SW2 == 0) PORTC = 0x38;
  • D) if (SW1 == 0 && SW2 == 1) PORTC = 0xC7;

Facebook
WhatsApp
Twitter
LinkedIn
Pinterest

Leave a Comment

Recent posts
Follow us on
× Chat Now