2. electronic circuits that can be programmed to
carry out a vast range of tasks.
family of specialized microcontroller chips
produced by MicrochipTechnology in
Chandler,Arizona.
a processor with built in memory and RAM
and you can use it to control your projects.
3.
4. Memory unit
Central Processing Unit
Bus
Input-output unit
Serial communication
Timer unit
Watchdog
Analog to Digital Converter (ADC)
Program
5. Microcontroller differs from a microprocessor in
many ways. First and the most important is its
functionality. In order for a microprocessor to be
used, other components such as memory, or
components for receiving and sending data
must be added to it. In short that means that
microprocessor is the very heart of the
computer. On the other hand, microcontroller is
designed to be all of that in one. No other
external components are needed for its
application because all necessary peripherals are
already built into it.
6. Morse code keyers
Robots
Data logging instruments
Phone dialers
Clocks and timers
Much, much more
7. The PIC
PIC16F84A
A breadboard
A set of resistors, capacitors and LEDs
A power supply
5V DC source
A PIC Programmer
MPLAB or another platform
8.
9.
10. Contains the arithmetic logic unit
Bit # 0 – 2
Reset status of the PIC
Bit # 3 and 4
Bank selection bits
Bit # 5 and 6
Direct and indirect addressing – bit # 7
11. Low level programming language for a
computer or other programmable device
specific to a particular computer architecture
12.
13. The PIC family has a very short range of
instructions with just only 35 instructions.
All instructions have just about the same
format. First comes the name of the
instructions.Then, comes the instructions
fields.The fields may be none, one or two,
according to the instruction.
The instruction could be filled with file
register (f), a bit address (b), constant data(k),
or destination selection (d).
14. General purpose registers in which you can
put any value that you wish.
15. The most basic operations that needs to be done will
be the value loading.These operations have to do
with loading a binary, decimal or hexadecimal value
on theW register or to a register.
Declaring number base in loading a value:
Binary
▪ b’01010010’
Decimal
▪ D’35’
Hexadecimal
▪ 0x1F
▪ 4fh
16. movlw k
Loads literal value k to the W register
movwf f
Moves the value from W register to file register f
movf f,d
Loads a value from the file register f. If destination
d is equal to 0 the result is stored in the W
register, if d is equal to 1 the result will stored back
to the file register f.
17. bsf f , b
Bit b in the file register f is Set(1).
bcf f , b
Bit b in the file register f is Cleared(0).
btfss f , b
If the bit 'b' in file register 'f' is 1, then the following instructions is not
executed. If the bit is 0, the instructions is executed normally.
btfsc f , b
If the bit 'b' in file register 'f' is 0, then the following instructions is not
executed. If the bit is 1, the instructions is executed normally.
swapf f , d
The upper and lower nibbles of file register 'f' are exchanged. If d is 0
the result is stored in theW register, if d is 1 the result is stored back to
the file register 'f'.
18. GOTO k
Send program flow directly to a program line or label.
CALL k
Send program flow directly to a program line or label. A RETURN instruction
will send the program flow back to the position where the CALL was made.
RETURN
This instruction will send the program flow to the last position, usually, this is
done by a previous CALL instruction
RETLW k
This instruction will send the program flow to the last position, usually, this is
done by a previous CALL instruction.Also, the W register will get the value k
on return.
RETFIE
This is a RETurn From Interrupt instruction.This instruction will send the
program flow back to the position where the last interrupt occurred and
caused the program flow to go to the interrupt vector (0x04h).
19. RLF f , d
Rotate Left through carry.The bits are rotated one position left
through the Carry. If d is 0 the result is stored in the W register, if d is 1
the result is stored back to the file register 'f'.
RRF f , d
Rotate Right through carry.The bits are rotated one position right
through the Carry. If d is 0 the result is stored in the W register, if d is 1
the result is stored back to the file register 'f'.
INCF f , d
The contents of register 'f' are increased by 1. If d is 0 the result is
stored in theW register, if d is 1 the result is stored back to the file
register 'f'.
DECF f , d
The contents of register 'f' are decreased by 1. If d is 0 the result is
stored in theW register, if d is 1 the result is stored back to the file
register 'f'.
20. INCFSZ f , d
The contents of register 'f' are increased by 1. If d is 0 the result
is stored in the W register, if d is 1 the result is stored back to the
file register 'f'. If the result is '0', the very next instruction is not
executed.
DECFSZ f , d
The contents of register 'f' are decreased by 1. If d is 0 the result
is stored in the W register, if d is 1 the result is stored back to the
file register 'f'. If the result is '0', the very next instruction and is
not executed.
CLRF f
The register 'f' is cleared.
CLRW
The working register W is cleared.
21. ADDLW k
Add the content of W register with a literal value and store the result in theW
register
ADDWF f , d
Add the content of W register with the content of a file register 'f'. If d is 0 the
result is stored in the W register, if d is 1 the result is stored back to the file
register 'f'.
SUBLW k
Subtract the content ofW register from a literal value and store the result in
theW register.
SUBWF f , d
Subtract the content ofW register from the content of a file register 'f'. If d is 0
the result is stored in theW register, if d is 1 the result is stored back to the file
register 'f'.
COMF f , d
The contents of the file register 'f' are complemented. If d is 0 the result is
stored in theW register, if d is 1 the result is stored back to the file register 'f'.
22. ANDLW k
Logic AND between the contents ofW and the literal value k.
The results is stored back to W.
ANDWF f , d
Logic AND between the content ofW register with the content
of a file register 'f'. If d is 0 the result is stored in theW register, if
d is 1 the result is stored back to the file register 'f'.
IORLW k
Logic OR between the contents ofW and the literal value k.The
results is stored back toW.
IORWF f , d
Logic OR between the content ofW register from the content of
a file register 'f'. If d is 0 the result is stored in the W register, if d
is 1 the result is stored back to the file register 'f'.
23. XORLW k
Logic EXCLUSIVE OR between the contents ofW
and the literal value k.The results is stored back to
W.
XORWF f , d
Logic EXCLUSIVE OR between the content ofW
register from the content of a file register 'f'. If d is
0 the result is stored in theW register, if d is 1 the
result is stored back to the file register 'f'.
24. NOP
This instructions is the No Operations instructions
and does nothing at all.
CLRWDT
This instructions will reset theWatchdogTimer
SLEEP
This instructions will put the chip into Sleep mode
25. All these instructions set the Z flag of the
status register if their result is zero.
Otherwise, the Z flag is cleared.