Professional Documents
Culture Documents
MOKHTAR NIBOUCHE
MOKHTAR.NIBOUCHE@UWE.AC.UK
ROOM 2N36
DEPARTMENT OF ENGINEERING DESIGN AND
MATHEMATICS
FACULTY OF ENVIRONMENT AND TECHNOLOGY
UNIVERSITY OF THE WEST OF ENGLAND
Learning Outcomes
2
Microcontrollers featuring a
Harvard architecture have
two different busses. As such,
the CPU can read an
instruction and access data
memory at the same time.
One is 8 bits wide and
connects the CPU to a
memory unit (RAM).
The other bus consists of 12, 14 or 16 lines and connects the
CPU to a different memory unit (ROM).
The Harvard architecture is in general more complex
Introduction
7
d is the destination
d = 0 for destination W (Accumulator or Working Register)
d = 1 for destination f
13 10 9 7 6 0
OPCODE b f(File)
b is a 3-bit address
f is a 7-bit file register address
Examples: BCF f, b ; Bit clear f
BSF f, b ; Bit set f
Format
13
bit 7 IRP: register Bank Select bit (used for indirect addressing).
bit 6-5 RP1-RP0 :Register Bank Select bits (used for direct addressing).
bit 4 TO : Time-out bit
bit 3 PD : Power down bit
bit 2 Z: Zero bit
bit 1 DC: Digit carry/borrow bit (ADDWF, ADDLW, SUBLW, SUBWF)
bit 0 C: Carry/borrow bit (ADDWF, ADDLW, SUBLW, SUBWF)
Status Register
17
; SETUP ; MAIN
include"P16F877.INC" start movlw 0
movwf PORTD
TIMREG EQU H'0020' loop incf PORTD,F
delval EQU H'0005' call delay
nop
; PORT SETUP goto loop
Banksel TRISD
clrf PORTD ; DELAY SUBROUTINE
banksel PORTD delay movlw delval
movwf TIMREG
time decfsz TIMREG,F
goto time
return
end
Further Reading
24