Professional Documents
Culture Documents
INTEGRATION
2.1 PIC 16F877A SPECIFICATIONS
The pulses from oscillator are internally divided to four signals called
Q1, Q2, Q3, and Q4.
2) Decode
The CPU determines the operation to carry out as
described by the instruction.
3) Execution
The operation is executed during the execution phase.
2.2.1 CLOCK CYCLE (CONTINUED …..)
Executing an instruction takes 2 machine cycles:
Two-stage pipelining:
It is known as flushing
VSS – ground
2.3 OSCILLATORS
The main oscillator in PIC microcontrollers:
i. crystal oscillator ii. RC oscillator iii. external clock
RAM
o can be read and written
o volatile memory
powered
o dynamic RAM – it is refreshed periodically to keep the
information stored
ROM
o can be read
o non-volatile memory
2.4 MEMORY ORGANIZATION
(CONTINUED …..)
EEPROM
o non-volatile memory
o can be read and written electrically (seldom rewritten)
o per byte erase capabilities (slower)
Flash
o specialized version of EEPROM
o block-wise erasable (faster)
2.4.1 PROGRAM MEMORY
A memory that contains the program (which we had
written), after we've burned it
Has 4 pages
Has 4 banks
SFRs are registers located in the data memory with specific information or
control functions for the microcontroller or its peripherals can be read and
written
PCL
OPTION
INTCON
PORTA
PORTB
TRISA
TRISB
TMR0
2.5.1 THE STATUS REGISTER
Z: Zero indicator.
Z = 1 (indicates arithmetic or logic operation was zero)
Z = 0 (otherwise)
C: Carry bit.
C = 1 when there is carry over between bits 7 and 8 in binary addition.
C = 0 (otherwise)
*The state is reverse for a subtraction operation (borrowing)
The register file can be accessed either directly, or indirectly, through the File Select
Register (FSR).
To clear register located at 0x20 (Bank0)
Exercise:
Initialize PORT B0, B1, B2, and B3 as output
while PORT B4, B5, B6, and B7 as input
2.7 PROGRAM STRUCTURE
2.7.1 Instruction set
1. movf h’25’, w
to W (Working
register)
? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ?
3. movlw h’CF’
movlw opcode
? ? ? ? ? ? ? ? ? ? ? ? ? ?
literal ‘CF’
2.7 PROGRAM STRUCTURE
(CONTINUED …..)
2.7.2 Instruction description
3. Assume that STATUS register has a value of 0x1F , what is the state of the status
bits after executing the following instructions
QUESTIONS:
4. How could you bring pin RA1 High, then pulse RA0 four
times and then RA1 is to go Low again? Your solution
should include the setting for TRISA.
5.Translate the PIC instruction 0x19C4 to assembly language.
THANK YOU