Escolar Documentos
Profissional Documentos
Cultura Documentos
What is PIC?
- A family of Harvard architecture microcontrollers
made by Microchip Technology
- erived from the PIC!"#$ originally developed
by %eneral Instrument Microelectronics ivision&
- The name PIC 'as originally an acronym for
(Programmable Intelligent Computer(&
Intro"uction
Harvard Architectures
/ne'er arch&0
1on-2eumann
Architecture
#wo Different Architectures
Harvard Architectures
1on-2eumann Architecture
7e' instructions
/usually > #$0
;.ecutes ! instruction in !
internal cloc* cycle /Tcyc0
Many instructions
/usually ? !$$0
Instruction Cloc'
Instruction Cloc'
Cloc* from the oscillator enters a microcontroller via +5C! pin 'here internal circuit of a
microcontroller divides the cloc* into four even cloc*s D!) D9) D,) and D: 'hich do not
overlap&
These four cloc*s ma*e up one instruction cycle /also called machine cycle0 during 'hich
one instruction is e.ecuted&
Instruction is called from program memory on every D! and is 'ritten in instruction register
on D:&
ecoding and e.ecution of instruction are done bet'een the ne.t D! and D: cycles& +n the
follo'ing diagram 'e can see the relationship bet'een instruction cycle and cloc* of the
oscillator /+5C!0 as 'ell as that of internal cloc*s D!-D:&
Program counter /PC0 holds information about the address of the ne.t instruction&
Pielinin5 in PIC
5tep 96 3sing a PIC device programmer) upload the H;= file into the
PIC& This step is often called ,burning,&
5tep ,6 Insert your PIC into your circuit) po'er up and verify the
program 'or*s as e.pected& This step is often called ,dropping, the
chip& If it isnHt) you must go to 5tep ! and debug your program and
repeat burning and dropping&
PIC16F877A Features
-igh Per.ormance RISC CP/0
Timer96 8-bit timerCcounter 'ith 8-bit period register) pre-scaler and post-scaler
5ynchronous 5erial Port /55P0 'ith 5PIQ /Master mode0 and I9CQ
/MasterC5lave0
Parallel 5lave Port /P5P0 8-bits 'ide) 'ith e.ternal 4) W4 and C5 controls
PIC Periherals% Ports 2Di5ital I1O4
Ports are basically digital IC+ pins 'hich e.ist in all PICs
P+4T. sets their output bit levels or contain their input bit levels
Most pins have 9#mA sourceCsin* thus it can drive <;s directly
PIC Periherals% Analo5ue to Di5ital
Converter
I9C N Inter IC
0&
This ensures that the device does not
continue program e.ecution outside the
valid operation range of the device
Typically used in AC line or large battery
application 'here large loads maybe
s'itched in and cause the device voltage
to temporarily fall belo' the specified
operating minimum
PIC16F877A Instruction !et
9iteral an" Control Instructions
<yte6Oriente" Instructions
<it6Oriente" Instructions
PIC Alications
<; 7lasher
<oop6
bsf P+4TE) $
call elayS#$$ms
bcf P+4TE) $
call elayS#$$ms
goto <oop
PIC Alications
Eutton 4ead
Movl' $
mov'f T4I5) f
bsf T4I5) 9
<oop6
btfsc P+4T) 9
goto light
goto 2oSlight
<ight6
bsf P+4TE)$
goto <oop
2oSlight6
bcf P+4TE)$
goto <oop
$eferences an" Further
$eferences an" Further
$ea"in5s
$ea"in5s
http6CC'''µchip&com
http6CCen&'i*ipedia&orgC'i*iCPICSmicrocontroller