Download as pdf or txt
Download as pdf or txt
You are on page 1of 85

Microprocessor and

Interfacing

Ch3_lec1_
Introduction to
microchip micro-
controllers (PIC18FX)
Kassahun Tamir 1
Outline
 Introduction
 Architecture of 18F micro-controller
 Memory Organization
 Oscillator Configuration
 I/O Ports
 Interrupts
 Timers
 PWM
 ADC
 Comparators
 Instruction sets Kassahun Tamir 2
Introduction
 Micro-controllers (8051, PIC, ARM)
 PIC – Peripheral Interface Controller
 PIC families include 10xxx, 12xxx,
14xxx, 16xxx, 17xxx, and 18xxx
 8-bit MCUs
✗ PIC10, PIC12, PIC16, PIC18
 16-bit MCUs
✗ PIC24
 32-bit MCUs
✗ PIC32 Kassahun Tamir 3
Introduction
 PIC families come in 18 to 80 pin packages.

Kassahun Tamir 4
Architecture of 18F micro-controller
 It is an 8-bit Micro-controller
 It has 16-bits Instruction sets
 256 byte of EPROM
 2 KB SRAM
 32 KB Flash Memory
 It operates at 48 MHz Crystal Oscillator
 It has a 10-bit A/D Converter
 It supports Instruction Pipelining
 It is implemented with nanoWatt Technology (low power
consumption) Kassahun Tamir 5
Architecture of 18F micro-controller
 RISC architecture
 On-chip program ROM, data RAM, data EEPROM, timers,
ADC, USART, and I/O Ports
✗ ROM, data RAM, data EEPROM, and I/O ports sizes
varies within PIC18 family
 Priority levels for interrupts

Kassahun Tamir 6
Architecture of 18F

Kassahun Tamir 7
Architecture of 18F

Kassahun Tamir 8
Memory Organization

ROM – program or code ROM
–PIC18 can have up to 2 megabytes (2M) of ROM

UV-EPROM for program memory– must have special
eraser/programmer (burner ~20 minutes to erase)

Flash memory - PIC18F458 use for program
development, can be reprogrammed again and again

OTP Version - PIC16C452 use for final production
version, one time programmable (ROM)

EEPROM – electrically erasable PROM, additional
“permanent” memory Kassahun Tamir 9
Memory Organization

Data Memory and Program
Memory are separated
(Harvard Architecture)


Separation of Data memory
and Program memory makes possible the simultaneous
access of data and instruction

Data memory registers are used as general purpose
registers or special function registers (SFR)
Kassahun Tamir 10
Memory Organization- Data Memory

It consists of General Purpose Registers (GPR = RAM) and
Special Function Registers (SFRs). Both are referred to as
Data Registers or File Registers

Each location is 8-bit wide

PIC-18 has 4KB Data Memory

Data Memory is Divided into Banks and each Bank has
256 bytes (16 banks)

General purpose registers are used to hold dynamic data

Special function registers are used to control the
Operation of PeripheralKassahun
functions.
Tamir
Only one bank is active
11
at a time.
Oscillator Configuration
Primary clock source of the micro-controller can be from
 An external oscillator or

 The built-in oscillator

Kassahun Tamir 12
Oscillator Configuration—Internal
Internal oscillator:
 If we do not do anything about choosing oscillator, the
internal oscillator with 4MHz will be selected by default
 We can select any frequency up to a maximum of 8 MHZ
 Why would anyone want to use less than 8 MHZ, as we
prefer the fastest?
✗ Power consumption
✗ Synchronization
 We can select any frequency up to 8 MHZ by configuring
the the 4,5,6 bits of OSCCON register
Kassahun Tamir 13
Oscillator Configuration
 Example 1:
i. Create an 8 MHz frequency using the internal oscillator

Kassahun Tamir 14
Oscillator Configuration—Internal
 Configure the OSCCON register as:

Kassahun Tamir 15
Oscillator Configuration
 Example 1:
i. Choosing frequency from the internal oscillator (8MHZ)
OSCCONbits.IDLEN = 0; // sleep mode after SLEEP instn
OSCCONbits.IRCF = 0b111; // Internal RC Freq. 8MHZ
OSCCONbits.OCS = 0b10; // internal Oscillator
Note:
1. Other bits are status bits and are read-only.
2. If we do not configure the OSCCON register and do not
have external oscillator, 4MHz internal clock is generated
by default.
Kassahun Tamir 16
Oscillator Configuration—External
 PIC18F2455/2550/4455/4550 devices can be operated in twelve
distinct oscillator modes, selected by the configuration register,
CONFIG1H. These are:
1. Crystal/Resonator Low Speed < 4MHZ
2. XTPLL Crystal/Resonator with PLL enabled

Medium to higher speed


3.HS High-Speed Crystal/Resonator > 4MHZ ; upto 48 MHZ
4.HSPLL High-Speed Crystal/Resonator with PLL enabled
5. EC External Clock with FOSC/4 output External Clock for
6. ECIO External Clock with I/O on RA6 (Synchronization)
7. ECPLL External Clock with PLL enabled and FOSC/4 output on RA6
Kassahun Tamir 17
Oscillator Configuration—External
 PIC18F2455/2550/4455/4550 devices can be operated in twelve
distinct oscillator modes, selected by the configuration register
CONFIG1H. These are:
8. ECPIO External Clock with PLL enabled, I/O on RA6
9. INTHS Internal Oscillator used as microcontroller clock source, HS
Oscillator used as USB clock source
10. INTXT Internal Oscillator used as microcontroller clock source, XT
Oscillator used as USB clock source For USB Module
11.INTIO Internal Oscillator used as microcontroller clock source, EC
Oscillator used as USB clock source, digital I/O on RA6
12.INTCKO Internal Oscillator used as microcontroller clock source, EC
Oscillator used as USB clock source, FOSC/4 output on RA6
Kassahun Tamir 18
Oscillator Configuration—External

Kassahun Tamir 19
Oscillator Configuration
 In basic programming (In HS, HSPLL, XT and XTPLL
Oscillator modes) a crystal or ceramic resonator is
connected to the OSC1 and OSC2 pins to establish
oscillation.

Kassahun Tamir 20
Oscillator Configuration—External
 Configure the CONFIG1L and CONFIG1H registers to choose the
mode. The CONFIG1H configuration register is at address
300001H and is used to select the micro-controller clock sources.

Kassahun Tamir 21
Oscillator Configuration
 Example 2:
i. Using an external HS Oscillator of 20MHz, we can create
a system clock of 5MHz.

Kassahun Tamir 22
Oscillator Configuration—External
 Configure the CONFIG1L register:

Kassahun Tamir 23
Oscillator Configuration—External
 Configure the CONFIG1H register:

Kassahun Tamir 24
Oscillator Configuration
 Example 2:
i. Using an external HS oscillator of 20MHz, we can create a
system clock of 5MHz
CONFIG1Lbits.CPUDIV = 0b11// div. an HS input clock by 4
// the remaining bits of CONFIG1L register are set to their
default values, then CONFIG1L = 0b00011000
CONFIG1Hbits.IESO = 1; // internal external switch over
CONFIG1Hbits.FCMEN = 1; // if ext. src. fails switch to
// internal clock
CONFIG1Hbits.FOSC = 0b1100 // HS Oscillator (HS)
Kassahun Tamir 25
I/O Ports
 Port Registers
✗ PORTA → 6/7 pins

✗ PORTB → 8 pins

✗ PORTC → 8 pins

✗ PORTD → 8 pins

✗ PORTE → 3 pins Kassahun Tamir 26


I/O Ports – TRISx Registers
 Configuring all pins of a port at once
✗ TRISx → Register for the direction of ports
—0 → O/P
—1 → I/P
✗ Example: Configuring PORTA

To make PORTA an output port To make PORTA an input port


TRISA = 0X00 or TRISA = 0XFF or
TRISA = 0b0000000 or TRISA = 0b11111111 or
TRISA = 0 or TRISA = 1 or
TRISA = 00h or Kassahun Tamir
TRISA = 0FFh or 27
I/O Ports – TRISx Registers
 Configuring individual pins of a port separately
✗ TRISx → Register for the direction of ports
—0 → O/P
—1 → I/P
✗ Example: Configuring pin 0 of PORTA
To make pin 0 of PORTA an o/p To make pin 0 of PORTA an
pin i/p pin
TRISAbits.TRISA0 = 0 or TRISAbits.TRISA0 = 1 or

TRISAbits.RA0 = 0 TRISAbits.RA0 = 1
Kassahun Tamir 28
I/O Ports – PORTx Registers
 After we configure the ports, we write to(if it is an
output port) or read from(if it is an input port) ports.
✗ PORTx → Register used to write and read
✗ Example: Reading from and writing to all pins of
PORTA at once

To set all PORTA pins to 0 To set all PORTA pins to 1


PORTA = 0X00 or PORTA = 0XFF or
PORTA = 0b0000000 or PORTA = 0b11111111 or
PORTA = 0 or PORTA = 1 or
PORTA = 00h or Kassahun Tamir
PORTA = 0FFh or 29
I/O Ports – PORTx Registers
 After we configure the ports, we write to(if it is an
output port) or read from(if it is an input port) ports.
✗ PORTx → Register used to write and read
✗ Example: Reading from and writing to individual
pins of PORTA separately

To set pin 0 of PORTA to 0 To set pin 0 of PORTA to 1


PORTAbits.RA0 = 0 or PORTAbits.RA0 = 1 or

PORTAbits.PORTA0 = 0 PORTAbits.PORTA0 = 1
Kassahun Tamir 30
I/O Ports – LATx Registers
 Read-Modify-Write Problems: The actual physical state
(voltage level) of a pin may be different from the value written
to PORTx register in certain instances.
 For example:
1.When the output pin is connected to high inductance or
capacitance loads.
2.When the output pin is connected to LEDs without current
limiting resistors.
3.When the output pin drives a transistor without base
resistor.
4.When the output pin is shorted to ground.
If a high value capacitor is connected to a pin, it will take some
time to charge the capacitorKassahun
when Tamir the pin is set to HIGH. 31
I/O Ports – LATx Registers
 Example: - We’re going to run the following instructions
PORTB.B0 = 1;
PORTB.B1 = 1;
 Assume that the PORTB is initially set to zero, and that all
pins are set to output. Let's say we connect a discharged
capacitor to RB0 pin.

Kassahun Tamir 32
I/O Ports – LATx Registers
PORTB.B0 = 1;
PORTB.B1 = 1;

Kassahun Tamir 33
I/O Ports – LATx Registers
PORTB.B0 = 1;
PORTB.B1 = 1;


Our intention was to read the value
as it was, 0b00000001, and change
it to 0b00000011. Alas, the read
value is 0b00000000. If we
proceed, the modified value will be
0b00000010.

To correct the problem in the code,
insert a delay after each PORTB.Bx
= 1 line, or modify the entire
PORTB register in a single line
PORTB = 0b00000011. Kassahun Tamir 34
I/O Ports – LATx Registers

Using LATB Register


LATB.B0 = 1;
LATB.B1 = 1;

Kassahun Tamir 35
I/O Ports – LATx Registers

Using LATB Register


LATB.B0 = 1;
LATB.B1 = 1;

We didn’t read from the pins directly.

Take away:

You can use either PORTx or LATx


Registers to write to the pins, they
serve us the same purpose.
However, if we have to read the
previous action and modify its
content, write through LATx. Kassahun Tamir 36
I/O Ports - Example
 Suppose a push button is interfaced with the first pin of
PORTB of PIC18F4550, and three LEDs with the first three pins
of PORTA. Write all the register configurations so that the
LEDs git lit whenever the push button is pushed.

Kassahun Tamir 37
Interrupts - definition

 Interrupts are mechanisms which enable instant


responses to events such as counter overflow, pin
change, data received, etc.
 In normal mode, micro-controller executes the main
program as long as there are no occurrences that
would cause an interrupt
 Upon interrupt, MC stops the execution of main
program and starts the special part of the program
(ISR) which will analyze and handle the interrupt.

Kassahun Tamir 38
Interrupts – Polling vs Interrupt

 Polling:
✗ PIC continuously monitors the status of each device
✗ Each device get the attention of the CPU as the same level of
priority
✗ Wastes MC time by polling devices that do not need service
 Interrupt:
✗ Devices get the attention of the CPU only when it needs a
service
✗ Can service many devices with different level of priorities

Kassahun Tamir 39
Interrupts – ISR and IVT
 Interrupt Service Routine (ISR):
✗ When an interrupt is invoked the MC runs the Interrupt
Service Routine (ISR)

 Interrupt Vector Table (IVT):


✗ Interrupt Vector Table holds the address of ISRs

Power-on Reset 0000h

High priority interrupt 0008h

Low priority interrupt 0018h

Kassahun Tamir 40
Interrupts - Steps of Execution

 Upon activation of interrupt the micro-controller:


✗ Finishes executing the current instruction
✗ Stores the next instruction address (PC) and the current
status in the Stack
✗ Jumps to the interrupt vector table to get the address of
ISR
✗ Jumps to the ISR
✗ Executes all the instructions in the ISR
✗ Upon exiting the ISR, restores the PC and the status, from
the Stack
✗ Continue executing the main program in sequence
Kassahun Tamir 41
Interrupts - sources

 External hardware interrupts:


✗ Pins RB0 (INT0), RB1 (INT1), RB2 (INT2)

 Peripherals:
✗ Timers: Timer0, Timer1, Timer2
✗ ADC
✗ Serial Communication
 Software Interrupts:
✗ Comes from a program that is being executed by a micro-
controller
Kassahun Tamir 42
Interrupts – Enabling and Disabling
 When the PIC is powered on (resets):
✗ All interrupts are masked (disabled)
✗ The default ISR address is 0008h
✔ No interrupt priorities for interrupt

Kassahun Tamir 43
Interrupts – Registers
 Configuration and functioning of interrupts are done with the
help of the following registers:
✗ RCON: Reset Control Register
✗ INTCON: Interrupt Control Register
✗ INTCON2: Interrupt Control Register 2
✗ INTCON3: Interrupt Control Register 3
✗ PIR1, PIR2: Peripheral Interrupt Request Registers
✗ PIE1, PIE2: Peripheral Interrupt Enable Registers
✗ IPR1, IPR2: Peripheral Interrupt Priority Registers
 The main functionality of these registers is to store
configuration bits for each interrupt.
Kassahun Tamir 44
Interrupts – Bites Types in Registers
 The previously stated registers have three types of bits within.
 In general, interrupt sources have three bits to control their
operation. They are:
✗ Enable bit:
✔ That allows program execution to branch to the interrupt
vector address when the flag bit is set
✗ Priority bit:
✔ To select high priority or low priority
✗ Flag bit:
✔ To indicate that an interrupt event occurred

Kassahun Tamir 45
Interrupts – RCON: Reset Control Registers

Kassahun Tamir 46
Interrupts – Interrupt Control Registers

Kassahun Tamir 47
Interrupts – Peripheral Interrupt Request Registers

Kassahun Tamir 48
Interrupts – Peripheral Interrupt Enable Registers

Kassahun Tamir 49
Interrupts – Peripheral Interrupt Priority Registers

Kassahun Tamir 50
Interrupt - Example

Example 1:
✗ Whenever there is an interrupt at RB0
✗ Lit LEDs connected to RA0, RA1, and
RA2

Kassahun Tamir 51
Timers – what for

 Used to measure the time or generate the accurate time delay.


 What if we want to cool off a motor for some time after every
two hours of running!
 We can create delays without using Timers: by running loops
for as long as we want. However, we cannot do anything in
parallel at that moment, as the CPU is busy executing useless
instruction.
 For this very purpose we have three timers in PIC18Fxx.
✗ Timer0 (8 bit timer)
✗ Timer1 (16 bit timer)
✗ Timer2 (8 bit timer) Kassahun Tamir 52
Timers - How
 Create a 1ms delay using Timer0 with the following features
✗ Oscillator Frequency (fosc) = 20MHz
✗ Prescalar = 64
➔fout = (fosc/4)/prescalar //
➔Tout = 1/fout = 1/[(fosc/4)/prescalar] = (4*64/20MHz)
***This is the time for one period (12.8 µs)
➔1ms = 10-3sec = count*(4*64/20MHz)
➔count =(10-3sec*20MHz/(4*64)=(5000/(64)=78.125=78
➔RegValue = 256-78 =178
Kassahun Tamir 53
Timers – How (Formula)
 Or we can derive this general formula:
✗ fosc = Oscillator frequency = 20MHZ
✗ fout = output frequency or system
frequency

Kassahun Tamir 54
Timers - How

 If Timer0 is set us an 8-bit timer, we can count from 0 all the


way to 255, but we want to get the interrupt flag bit enabled
after 78 counts. To this end, we can set the register to 178
(calculated as 256-78) and start counting from there. When the
counter rolls over to 0 after 255, the total count is 78.
 We write an ISR (Interrupt Service Routine) to handle when the
interrupt flag is set.

Kassahun Tamir 55
Timers - Registers

Steps we follow:
1.Calculate the Timer Count for the required delay
2.Set the Prescalar bits in TxCON as per the delay calculation
1.Clear the PSA bits for using the prescalar
2.Select the Clock Source Internal/External using TOCS bit
3.Load the timer value into TMR0 register
4.Enable the Timer0 Interrupt by setting TMR0IE bit
5.Enable the Global and Peripheral interrupts by setting GIE and
PIE bits.
Kassahun Tamir 56
Timers - Example

Kassahun Tamir 57
Timers - Example

Kassahun Tamir 58
Timers - Example

1.TMR0L // counter register


TMR0L = 0b10110010 // 178
2.INTCON // interrupt when the counter register overflows
GIE = 1;// Enable global interrupt
PEIE = 1;// Enable peripheral interrupt
TMR0IE = 1;// Enable TMR0 interrupt
3.T0CON // TMR0 control register
T0CON = 0b11010101

Kassahun Tamir 59
Timers - Registers
Timer Size Control Register Count Register
TIMER0 16-bit T0CON TMR0H,TMR0L
TIMER1 16-bit T1CON TMR1H,TMR1L
TIMER2 8-bit T2CON TMR2

TIMER3 16-bit T3CON TMR3H, TMR3L

 Registers affected by Timers

Kassahun Tamir 60
PWM
 If we need to take an analog input, we can get the real-time
analog data from a sensor, and then using an analog-to-digital
converter (ADC), convert it to digital data for a microcontroller.
 But what if we need to control an analog device from our
microcontroller?
 Some microcontrollers have an onboard digital-to-analog
converter (DAC) to output a true analog signal in order to
control analog devices, and we can even use an external DAC.
 We achieve the functionality of a DAC using PWM
 PWM or Pulse Width Modulation is a technique used to
Kassahun Tamir 61
control analog devices, using a digital signal.
PWM – Duty Cycle
 When the signal is high, we call this "on time".

 To describe the amount of "on time" , we use the concept of


duty cycle. Duty cycle is measured in percentage.

 The percentage duty cycle specifically describes the


percentage of time a digital signal is on over an interval or
period of time.

Kassahun Tamir 62
PWM – Duty Cycle

Kassahun Tamir 63
PWM - Application
 DC motor speed control

 DC motor speed and direction of rotation are dictated by the


voltage applied—change or reverse the polarity of the voltage
and the motor will respond in a similar fashion.

 The control works by switching the power supplied to the


motor ON and OFF very rapidly.

 We know that the fan will not instantly achieve the max speed
the moment we turn it on and neither will it immediately
come to a halt as we turnKassahun
it off.Tamir 64
PWM – The Module in PIC18F4550

Timer2 is the only source for PMW


✗ We need to turn it on
✗ Used to select the prescalar

Kassahun Tamir 65
PWM – The Module in PIC18F4550

CCP-Capture, Compare,
and PWM Module

Kassahun Tamir 66
PWM – Example
 Example: Generate a pulse width frequency of 500Hz, using
fosc of 4MHz, prescalar 1:16, and duty cycle of 25%. (In
practice the duty cycle is the one we modify to increase or
decrease the “On Time”.In other words to increase or decrease
the speed of a DC motor if we’re working with a motor.)
 Solution: - Configure all the requisites first
TRISCbits.RC2 = 0; // Make PORTC an o/p port, where
CCP1 is multiplexed with others.
T2CONbits.T2CKPS1 = 1; // We do not care about
T2CKPS0
T2CONbits.TMR2ON = 1; // Since we’re working on
TMR2
Kassahun Tamir 67
PWM – Example
 Example: Generate a pulse width frequency of 500Hz, using
fosc of 4MHz, prescalar 1:16, and duty cycle of 25%. (In
practice the duty cycle is the one we modify to increase or
decrease the “On Time”.In other words to increase or decrease
the speed of a DC motor if we’re working with a motor.)
PR2 = fosc/(4*prescalar*fpwm)-1 = 4MHz/(4*16*500) -1 = 124
PR2 = 0b01111100;// or simply PR2 = 124; We do not
modify this once configured.
resolution = (0.25)*(PR2+1)*4 = 125 = 0b0001111101
DC1B0 = resolution&1;// store the 0th bit
DC1B1 = (resolution&2)>>1 // store the 1st bit
CCPR1L = resolution>>2; // store the remaining 8 bits
Kassahun Tamir 68
ADC
 When we interface sensors to the micro-controller, the output
of the sensor many of the times is analog in nature. But
micro-controller processes digital signals.

 Hence we use ADC in between sensors and micro-controllers.


It converts an analog signal into digital and gives it to the
micro-controller.

 There are a large number of applications of ADC like in a


biometric application, Environment monitoring, Gas leakage
detection, etc.

Kassahun Tamir 69
ADC - Conversion
 Digital value = [Analog value/ (Vref+ - Vref-)] * (2^resolution)

 For Vref+ = Vdd, Vref- = Vss and 10 bit resolution

 Digital vaue = [Analog value/ 5*1024]

Kassahun Tamir 70
ADC - Conversion
 For a 10 bit resolution ADC, it is possible to divide up to 1024
(2^10) voltages. So for a 5V reference voltage, the minimum
voltage will be 5/1024 = 4.88mV.
 This means 4.88mV input in the analog pin will be detected as
1 (0b0000000001 in binary) and 9.6mV input will be 2
(0b0000000010 in binary).
 It can’t detect the difference between 1mV and 3mV since
both will be detected as 0, as they are less than 4.88mV.
 Accordingly:
for 0V -> Digital value = 0
for 2.49V -> Digital value = 511 (0b0111111111 in binary)
for 4.99V -> Digital value = 1023 (0b1111111111 in binary)
Kassahun Tamir 71
ADC – In PIC18F4550
 PIC18f4550 has inbuilt 10-bit 13 channel ADC.

✗ 13-channels of ADC are named as AN0-AN12. It means we


can connect 13 different analog sensors at the same time.

 10-bit ADC means:

✗ will give digital count in the range of 0-1023 (2^10).

Kassahun Tamir 72
ADC – In PIC18F4550
 ADCON0: A/D Control Register 0


When we do not use analog inputs, it
is recommended to disable the
ADCON0 register using ADON bit
because it consumes too much power

Kassahun Tamir 73
ADC – In PIC18F4550
 ADCON1: A/D Control Register 1

Kassahun Tamir 74
ADC – In PIC18F4550
 ADCON2: A/D Control Register 2

ADFM = 1: Right Justified: the lower bits in
ADRESL, and the remaining two higher bits
in ADRESSH.


ADFM = 0: Left Justified: the higher bits in
ADRESH, and the remaining two lower bits
in ADRESSL.
ADFM = 1 ADFM = 0
1010111001 = 10 bits 1010111001 = 10 bits
ADRESH = 00000010 ADRESH = 10101110
ADRESSL = 10111001 Kassahun Tamir
ADRESSL = 01000000
75
ADC – In PIC18F4550
 ADRESH (High byte) and ADRESL (Low byte) Registers:
These registers are used in combination to store the
converted 10 bits data i.e. digital data.

int result = ADRESH<<8+ADRESL


* To concatenate the result, shift the value in ADRESH register
by 8 to the left and add it with the value of ADDRESL

Kassahun Tamir 76
ADC – In PIC18F4550
 Example: Assume a potentiometer representing an analog
sensor with a varying signal of 0-5V is applied in the AN0 pin
of PIC18F4550, configure all the control registers.

ADON =1, Go/done = 1, and
CHS3:CHS0 = 1110 → AN0
ADCON0 = 0x03;

Ref vtg is VDD and configure
the pin as an analog pin
ADCON1 = 0x00; //and

Right Justified, 2Tad and
Fosc/16
ADCON2 =0x95; Kassahun Tamir 77
ADC – In PIC18F4550
 Example: Assume a potentiometer representing an analog sensor
with a varying signal of 0-5V is applied in the AN0 pin of
PIC18F4550, configure all the control registers.

Kassahun Tamir 78
Comparators

Analog Comparator is a device which compares two
voltage signals and switches its output to indicate
which one is larger.

The input pins of comparator are multiplexed with I/O
port pins RA0 through RA3 while output pins are
multiplexed with RA4 and RA5.

Kassahun Tamir 79
Comparators

Kassahun Tamir 80
Comparators

Kassahun Tamir 81
Comparators

Kassahun Tamir 82
Instructions Sets

READING ASSIGNMENT

Kassahun Tamir 83
References

PIC18FXX Dasheet

https://electrosome.com/read-modify-write-problem-pic/
#google_vignette (access date: 05/05/2023)

https://download.mikroe.com/documents/compilers/mikroc/
pic/help/rmw.htm
(access date: 05/05/2023)
PWM:

https://www.circuitbread.com/ee-faq/what-is-a-pwm-signal
(access date: 05/05/2023)

https://circuitdigest.com/microcontroller-projects/pic-microc
ontroller-pic16f877a-pwm-tutorial
(access date: 15/05/2023) Kassahun Tamir 84
Questions?

Kassahun Tamir 85

You might also like