Sunteți pe pagina 1din 4

National Institute of Technology, Raipur CG-492010 Code: ET20514

B. Tech. (Fifth Semester) Examination, Nov-2017


Branch: Electronics & Telecommunication Engineering
Subject: Microcontroller and Embedded systems (MES)

Max Marks: 70
Time: Three Hours Min Pass Marks: 25

UNIT I

Q1. (a) What are the advantages of 8051 over general purpose microprocessor? (2)

(b) Explain machine cycle in 8051 microcontroller? How many bytes space and machine
cycles are required for MUL AB and MOV direct, direct instructions? (1+2)

(c) Of the 128 bytes of RAM in the 8051 C, how many bytes are bit addressable? List
them.
(2)
Q2. Explain in detail the functionality of the following pins of 8051 C:

(iv) RXD and TXD (v) PORT0


(i) RST (ii) XTAL1 & XTAL2 (iii) ALE/

(vi) / (vii) . (7)
Or
Q3. (a) Why are the following instructions invalid in 8051 C? MOV R2, DPTR, MOV R4,
R7, ADD R4, A.
(b) For an 8051 system of 20 MHz, find how long it takes to execute each of the following
instructions

(i) XRL direct, #data (ii) DJNZ R2, target (iii) DEC R3.

(c) In 8051 C, if bank 1 registers are being used, the default value of stack pointer
cannot be used. Why? (3+3+1)

UNIT II

Q4. (a) Discuss with examples the different addressing modes in 8051 microcontroller. (4)

(b) Define Unpacked and Packed BCD numbers. Explain the execution of DA A
instruction in 8051 C with the following three examples
(i) 95H+82H (ii) 89H + 44H (iii) 18H +28H. (1+2)
Q5. (a) Give the bit address assigned to the flag bit CY, P, AC, OV in 8051 C.
(b) Write an assembly program for 8051 C to create a new array by removing only
those integers that are not perfectly divisible by 4 from an array, starting from 31H. Location
30H contains number of terms of this array. The new array is to be created from the location
60H. At return, the accumulator should indicate number of terms found. Original locations
with digits not divisible by 4 should be replaced by FFH (Explain each step of your program).
(1+6)
National Institute of Technology, Raipur CG-492010 Code: ET20514
B. Tech. (Fifth Semester) Examination, Nov-2017
Branch: Electronics & Telecommunication Engineering
Subject: Microcontroller and Embedded systems (MES)

Or
Q6. (a) How can we perform arithmetic addition between 2 bits stored in directly
addressable bit locations 78H and 79H in 8051 C?
(b) Write an assembly program for 8051 C to find the smallest from N unsigned
integers. Assume the values of N to be available in the internal data memory location 30H.
The array starts form location 31H. Store the minimum integer in R4. (3+4)

UNIT III

Q7. Draw a circuit in which 7 LEDs are connected to PORTB of PIC 18C, with a 4 MHz
crystal oscillator and a RESET switch. Write a program for LED chaser i.e. blinking only
one LED at a time for ever. In the program call a delay of 10 ms without using timer between
each LED on operation. (1+4+2)

Q8. (a) Write a program to load PORTB SFR with 55 H and complement PORTB, 70 times
for PIC 18 C. (4)

(b) Find the size of delay in the following program of PIC 18 C, if crystal frequency is
12 MHz. Also debug the code and write it in correct form. (2+1)

MYREG EQU 0x08


ORG 0
BACK MOVLW 0x55
MOVWF PORTB
CALL DELAY
MOVLW 0xAA
MOVWF PORTB
CALL DELAY
GOTO BACK
ORG 300
DELAY MOVLW 0xFA
MOVWF MYREG
AGAIN NOP
NOP
NOP
DECF MYREG F
BNZ AGAIN
RETURN

Or
Q9. (a) Write an assembly program for PIC 18 C to create a square wave of 75% duty cycle
in PORTC0. (2)
(b) Assume that bit RB3 is an input of PIC 18 C, it represents the condition of a door
alarm as shown in the Fig. 1. If RB3 goes LOW, it means that the door is open. Write an
assembly program to monitor the RB3 bit continuously, whenever it goes LOW send a HIGH
to LOW pulse to PORT RC5 to turn ON the buzzer. (3)
National Institute of Technology, Raipur CG-492010 Code: ET20514
B. Tech. (Fifth Semester) Examination, Nov-2017
Branch: Electronics & Telecommunication Engineering
Subject: Microcontroller and Embedded systems (MES)

Fig. 1

(c) Explain the role of TRISx and PORTx in I/O operations of PIC 18. (2)

UNIT IV

Q10. (a) What is the difference between RETURN and RETFIE of PIC 18 instruction?
Explain why we cannot use RETURN instead of RETFIE as the last instruction of ISR. (2)
(b) Assuming that clock pulses are fed into pin RA4 of PIC 18 C. Write a program for
COUNTER0 in 16 bit mode to count the pulses and display the states of TMR0L count on
PORTB and TMR0H count on PORTC. Timer control register is shown below. (3)

T0CON

(c) A PIC 18 C is programed for 4 MHz internal RC oscillator. Determine the


conversion time for all options of ADC bits in both ADCON0 and ADCON1 registers

(i) Fosc /2 (ii) Fosc /16 (iii) Fosc /32 (iv) Fosc /64 . (2)

Q11. (a) Evaluate the PIC18 C output for a temperature of 100 degrees. Find the values in
ADC registers of ADRESL and ADRESH. Assume that LM35 is used as a temperature
sensor. (2)
(b) Write an assembly program which uses TIMER0 to generate square wave on pin
RB0, while the data has been transferred from PORTC to PORTD. INTCON register of PIC
18 is shown below. (5)

Or

Q12. (a) Assume that a 16 Hz frequency pulse is connected to input for TIMER0 (pin
T0CLK) of PIC 18C. Write an assembly program to display the counter values of TMR0H
National Institute of Technology, Raipur CG-492010 Code: ET20514
B. Tech. (Fifth Semester) Examination, Nov-2017
Branch: Electronics & Telecommunication Engineering
Subject: Microcontroller and Embedded systems (MES)

and TMR0L on PORTB and PORTD. Set the initial values to 0. Use TIMER0 in 16 bit mode
with positive edge clock. Assume pre-scalar of 1:16. (5)

(b) Assume that XTAL=4 MHz, Determine the value of TMR0L and TMR0H of PIC 18
for generating a square wave of 5KHz. (2)

UNIT V

Q13. Assume that a switch is connected at INT0 (RB0) pin of PIC 18. Every time the switch
is activated (logic High), a DC motor of 1 Amp current rating connected at pin RB1 and RB2
rotates in counter clockwise direction. Assume that when the switch is not activated the DC
motor is rotating in clockwise direction. Draw a circuit diagram for the above situation.
Assume that inputs of motor are connected at RB1 and RB2. Write an assembly program
for performing the above task. (2+5)

Q14. A relay of 12V is connected using a transistor to pin RB0 of PIC 18. A switch SW1 is
connected to RB1, such that when the switch SW1 is not pressed the voltage at pin RB1 is 5V
and vice-versa. Write an assembly program to turn on the relay when the SW1 is pressed
and turn off when SW1 is not pressed. Draw a neat circuit diagram for the above situation.
(5+2)

Or

Q15. Two switches SW1 and SW2 are connected at RB0, RB1 and two LEDs are connected
at pins RA0, RA1 of PIC 18 such that when SW1 and SW2 are not pressed then SW1=0,
SW2=0 . Draw a neat diagram and write an assembly program such that when SW1 =High,
LED at RA0 glows and when SW2 = High, LED at RA2 glows and vice-versa. (2+5)

S-ar putea să vă placă și