You are on page 1of 3

1

CQI BIL 1 2019


Number Questions
1. List differences of microcontrollers and microprocessors.
2. Explain the TRIS, PORT and LAT configuration below;
TRISCbits.RC5=0;
TRISB = 0;
LATB = 0xFF;
TRISC = 255;
TRISD = 0200;
LATD = 0b10000000;

3. Write a program using C language for odd number of LEDs at PortB (using LEDs in Figure 1)
every 1 second using Delay function below.
void Delay(unsigned int ms)
{
unsigned char i;
while(ms){
ms--;
i=122;
while(i) i--;
}

Figure 1
4. PIC 18F452 has ability for external as well as internal clock source but we are using Timer0
with internal clock (Timer mode). Calculate the time delay of 1 sec using 20MHz crystal
oscillator with PIC microcontroller to make circular right shift at PortB (using LEDs, refer
Figure 1).
5. Initialize C program to generate to generate PWM based on information given below:
a) XTAL=4MHz, 1kHz PWM frequency, 1:4 prescaler, 50% duty cycle.
2

b) XTAL=4MHz, 1kHz PWM frequency, 1:4 prescaler, 20% duty cycle.


c) XTAL=8MHz, 5kHz PWM frequency, 1:16 prescaler, 20% duty cycle.
d) XTAL=8MHz, 5kHz PWM frequency, 1:4 prescaler, 20% duty cycle.
6. Refer to Figure 2 below for connection of the motor. Write a C program to make the motor
moves clockwise with 70% duty cycle continuously.

Figure 2
7. A varying signal of 0-5V is applied in the AN0 pin of PIC18F4550 and the analog value is
converted to the corresponding digital value. Write a C program for the ADC. (remarks:
The analog voltage is generated and varied using a potentiometer. Refer Figure 3)

Figure 3: ADC interfacing – PIC18F4550


3

You might also like