Lecture 4 Flashcards
1
Q
use What gate to set bits
A
Or gate and use 1
2
Q
use What gate to clears bits
A
And gate and use 0
3
Q
use What gate to toggle bits
A
Use xor gate and use 1
4
Q
Write a program to compute 1 + 2 + 3 + … + n and save the sum at 0x11 and 0x10.
A
DCOUNT EQU 10 ACOUNT EQU 0C MOVLW DCOUNT MOVWF ACOUNT, f CLRW LOOP ADDWF ACOUNT, w DECFSZ ACOUNT, f GOTO LOOP MOVWF 11 MOVWF 10
5
Q
Write a program to do the NOP instruction 50000 times.
A
DCOUNT1 EQU 100 DCOUNT2 EQU 500 ACOUNT1 EQU 0C ACOUNT2 EQU 0D MOVLW DCOUNT1 MOVWF ACOUNT1 LOOP1 MOVLW DCOUNT2 MOVWF ACOUNT2 LOOP2 NOP DECFSZ ACOUNT2,1 GOTO LOOP2 DECFSZ ACOUNT1,1 GOTO LOOP1