Tutorial 2
Tutorial 2
Tutorial 2
Tutorial 2
Question 1 (14 pts)
movlw b’11110000’
movwf trisb
7. What is the binary content of the status register after executing this
instruction?
CLRF STATUS
movlw 2fh
addlw 55
C: DC: Z:
1
Microcontrollers and Microprocessor Technology
Question 2 (3 pts)
Three microcontrollers (A, B & C) have maximum clock speeds 10MHz, 20MHz,
24MHz respectively. Microcontroller A divides its clock by 4 to give one machine
cycle, microcontroller B by 8, and microcontroller C by 12. Microcontrollers A & C
take 2 machine cycles to perform an instruction, while microcontroller B takes
three cycles. Place the microcontrollers in order of the speed in which they can
perform that instruction?
Question 3 (2 pts)
How long does it take to execute the following instructions on a PIC 16F84A
running at a clock of 8 MHz?
goto L2
L1 movwf var1
btfss var1,0
L2 sublw 10
Question 4 (2 pts)
In the following code, explain what each instruction does and give the content of
the registers involved after the execution of the said line of codes. Calculate the
total tome of execution if the controller frequency is 4MHz
2
Microcontrollers and Microprocessor Technology
Question 6
In the following code, calculate the total tome of execution if the controller
frequency is 20MHz
COUNT1 equ 08h ; timing for the Delay1 and the Delay2
COUNT2 equ 09h
COUNT3 equ 01h
COUNT4 equ 02h
Start
movlw b'10001111'
movwf PORTD
movlw b'111110'
movwf PORTA
movlw b'1'
3
Microcontrollers and Microprocessor Technology
movwf PORTB
movlw b'11000111'
movwf PORTC
movlw b'10100'
movwf PORTB
movlw b'1011111'
movwf PORTD
movlw b'0'
movwf PORTA
movlw b'0'
movwf PORTC
Goto Start
end