SlideShare una empresa de Scribd logo
PIC18 con CCS
(PIC18F14K50)
Autor: Andrés Raúl Bruno Saravia
Microchip RTC Argentina
PIC18 Arquitectura
PIC18 Arquitectura
Revisión
Revisión
Microchip Familias de MCUs
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 3
3
Familia PIC18
PIC18 Tradicional
PIC18 serie - J
PIC18 serie - K
32KB 128KB
4KB
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 4
4
Tradiciona PIC18
40 MHz, 10 MIPS, 5V
Flash endurance 100k
EEPROM
Características Premium
PIC18 serie K
64MHz, 16 MIPS, 3V
Flash endurance 10k
EEPROM
Menor costo <32KB Flash
PIC18 serie J
40-48 MHz, 10-12 MIPS, 3V
Flash endurance 1k – 10k
Emulate EEPROM
Menor costo >32KB Flash
Program Flash
Tipicamente los productos con mucha memoria tambien tienen muchos pines y perifericos avanzados integrados
Diagrama en Bloques Simplificado
Arquitectura PIC® 8-bit
RAM
Espacio de
Datos
Espacio de
Programa
Tabla de
Acceso
8-bit
8-bit
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 5
5
Peripfericos
Puertos I/O
Memoria
Flash
8-bit CPU
16-bit
Bus de
instrucciones
Bus de datos
8-bit
Mapa de Memoria de Datos
Arquitectura PIC® 8-bit
Memoria de datos
hasta 4k bytes
Dividida en bancos
de 256 byte
Medio Banco 0 y
medio banco 15 son
PIC18F2520/4520
Mapa de Registros
ACCESS RAM
Banco0 GPR
Banco1 GPR
Banco2 GPR
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 6
6
medio banco 15 son
usados para crear
un banco virtual de
acceso directo
ACCESS RAM
ACCESS SFR
ACCESS SFR
Banco15 GPR
Banco13 GPR
Banco14 GPR
* La división 50/50 no se mantiene en
los dispositivos con muchos registros
SFR (Special Function Registers)
Mapa de memoria de Programa
Arquitectura PIC® 8-bit
Hasta 2MB (1M Words)
continuos totalmente
lineal
Memoria de Programa
En el chip
Vector de Reset
Vector de INT de alta prioridad
Vector de INT de baja prioridad
000000h
000008h
000018h
Contador de Programa de 21-bit
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 7
7
1FFFFEh
Memoria de Programa
Sin implementar
(Read as ‘0’)
008000h
007FFEh
Contador de Programa de 21-bit
Stack de 31 niveles
Nivel de Stack 1
Nivel de Stack 2
Nivel de Stack 30
Nivel de Stack 31
Tabla de Lectura
Arquitectura PIC® 8-bit
Memoria de Datos (RAM) Memoria de Programa (Flash)
0x000000
0x000002
0x000004
0x000006
0x000001
0x000003
0x000005
0x000007
0x000
0x001
0x002
0x003
22-bit
Address
00 00 09
TBLPTRU TBLPTRH TBLPTRL
Puntero de Mem. Prog. de 21-bit
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 8
8
2C
2C
TABLAT 0x00000A
0x000008
0x1FFFF4
0x1FFFF6
0x1FFFF8
0x1FFFFA
0x1FFFFC
0x1FFFFE
0x00000B
0x000009
0x1FFFF5
0x1FFFF7
0x1FFFF9
0x1FFFFB
0x1FFFFD
0x1FFFFF
0x005
0x004
0xFFA
0xFFB
0xFFC
0xFFD
0xFFE
0xFFF
8-bit Data
Byte Alto Byte Bajo
Características especiales
Características especiales
Como setear los bits de configuración del PIC®
Como setear los bits de configuración del PIC®
Osciladores
Osciladores
Fuentes de Clock
Primaria
Selección Fija
LP, XT, HS, RC, EC, Int RC Osc
Secundaria
PIC18F: Sistema de Clock
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 11
11
Secundaria
Oscilador Timer1 – Frecuencia fija
Necesario para base de tiempo de RTR
Oscilador Interno RC
INTOSC (8 MHz por default)
4, 2, 1 MHz, 500, 250, 125 y 31 kHz seleccionables
INTRC (31 kHz)
Sistema de Clock PIC18F1XK50
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 12
12
PIC18F1XK50 Opciones del Oscilador para
el USB
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 13
13
PIC18F
Características Especiales
PIC18F
Características Especiales
In-Circuit Serial Programming™
Solo necesita 2 pines para programar al
dispositivo
Conveniente para programar en sistemas
Calibración de datos
Serialización de datos
Suportado por debuggers y
programadores en MPLAB®
Pin
Pin
PP
VPP
DD
VDD
SS
VSS
RB6
RB7
Function
Function
Programming Voltage
Supply Voltage
Ground
Clock Input
Data I/O & Command Input
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 15
15
programadores en MPLAB
ICSP™ Connector
Características Especiales PIC18F
Amplio Voltaje de operación: 2.0V a 5.5V
Memoria de Programa Flash Mejorada con 100,000
ciclos de borrado/escritura
Memoria de Datos EEPROM con 1,000,000 de ciclos
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 16
16
Memoria de Datos EEPROM con 1,000,000 de ciclos
de borrado/escritura
Retención de Datos en Memoria EEPROM Flash/Data
: 100 años típico
Watchdog Timer
Ayuda al software a recuperarse de un mal funcionamiento
Usa un oscilador libre RC en el chip
WDT es borrado por la instrucción CLRWDT
WDT Habilitable (WDTEN) no puede ser borrado por soft
el overflow (desborde) del WDT reetea al chip
Período del timeout programable : 18ms a 3.0s típico
Opera en modo SLEEP; sobre el time out, despierta la CPU.
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 17
17
Opera en modo SLEEP; sobre el time out, despierta la CPU.
Generador de Reset Interno
POR: Power On Reset
con MCLR ataado a VDD, es generado un
pulso de RESET cuando el flanco de
subida a VDD es detectado
PWRT: Power Up Timer
72 ms (nominal)
VDD
MCLR
Circuito
RESET
en CHIP
Reset
Interno
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 18
18
72 ms (nominal)
Desacoplado del BOR
OST: Oscillator Startup Timer
Mantiene en RESET al dispositivo por
1024 cyclos de maquina (TCYs)
Le permite al cristal o al resonador
estabilizarse
Bypaseado en: Two Speed Startup Mode
INTOSC usa un clock para el
procesador no estable
Internal
Reset
VDD
MCLR
POR
PWRT
OST
TPWRT
TOST
Reset Operación
BOR –Brown Out Reset
Cuando el voltaje cae por debajo de un umbral
particular, el dispositivo se pone en RESET
Impide el funcionamiento irregular o inesperado
Elimina la necesidad de un circuito externo BOR
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 19
19
Elimina la necesidad de un circuito externo BOR
PBOR – Programmable Brown Out
Reset
Opción de configuración (fijado en tiempo de
programa)
No puede ser activado/desactivado por software
Cuatro puntos de disparo BVDD seleccionables
2.5V – Mini VDD para OTP MCUs PICmicro®
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 20
20
2.5V – Mini VDD para OTP MCUs PICmicro
2.7V
4.2V
4.5V
Para otros umbrales use un supervisor externo
(MCP1xx, MCP8xx/TCM8xx, or TC12xx)
PBOR – Programmable Brown Out
Reset
Mantiene al MCU PICmicro® MCU en RESET durante ~72ms
despues que VDD supero el nivel de umbral
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 21
21
PLVD – Detector de Bajo Voltaje
Programable
Alerta antes que el
brown out
16 Puntos de
disparo
seleccionables
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 22
22
seleccionables
1.8V hasta 4.5V en
pasos de 0.1 a 0.2V
Entrada analógica
externa
VREF interno
PIC18F Características especiales
Resets
PIC18 RESETS
Power-on Reset (POR)
MCLR Reset durante la operación normal
Programmable Brown-out Reset (BOR)
Watchdog Timer (WDT) Reset (durante la
ejecución )
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 23
23
ejecución )
Instrucción RESET
Reset por Stack Full
Reset por Stack Underflow
Para todos los resets el vector del PC es la
dirección 0
Despues del RESET el PC tiene 0x000000
Los siguientes bits son afectados por el RESET
RCON Register
POR = ‘0’: Power On RESET
BOR = ‘0’ & POR = ‘1’: BOR RESET
TO = ‘0’: WDT RESET
RI = ‘0’: RESET Instrucción
PIC18F Características especiales
RESET Registers
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 24
24
STKPTR Register
STKFUL = ‘1’: Stack over flow RESET
STKUNF = ‘1’: Stack under flow RESET
MCLR RESET ies indicado por:
POR, BOR, TO & RI = ‘1’ y STKFUL & STKUNF = ‘0’
PIC18 Bits de Configuración
PIC18 Bits de Configuración
Que son los bits de Configuración?
Son usados para activar o
no las características
especiales:
Proteccion del Codigo
Watchdog Timer
Reset Vector
High Interrupt Vector
Low Interrupt Vector
16-bit Program Memory
User
Memory
User
Memory
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 26
26
Watchdog Timer
Tipo de Oscilador
Opcion de Debug
Otras…
User Flash
Registros de Configuración
Device ID
Registro CONFIGlocalizado en la
memoria de programa, fuera del area
de ejecución del código
(inicia en @ 0x300000)
User
Memory
User
Memory
Configuration
Configuration
Memory
Memory
Bits de Configuración
PIC18F4520 (4 of 11)
IESO — —
FCMEN FOSC2 FOSC1 FOSC0
— BORV1
— — BOREN1 BOREN0 PWRTEN
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
R/W-0
R/W-0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
bit 7 bit 0
BORV0
CONFIG1H Register
CONFIG2L Register
FOSC3
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 27
27
— BORV1
— — BOREN1 BOREN0 PWRTEN
bit 7 bit 0
BORV0
— WDTPS3
— — WDTPS1 WDTPS0 WDTEN
R/W-0
R/W-0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
bit 7 bit 0
WDTPS2
—
MCLRE — — LPT1OSC PBADEN CCP2MX
R/W-0
R/W-0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
bit 7 bit 0
CONFIG2H Register
CONFIG3H Register
—
Configurations Bits con CCS
Usar directiva #FUSES
#fuses HS,NOWDT
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 28
28
options puede variar segun el dispositivo. Un
listado de las opciones válidas esta en el tope
de cada archivo de cabecera de cada
dispositivo.
PIC18F1x50
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 29
29
PIC18F14K50 Pin Out
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 30
30
USB Fundamentos
Un poco de historia...
USB fue co-desarrollado por un grupo de
compañías….
Compaq
Intel
Microsoft
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 32
32
Microsoft
NEC
…quería hacer mucho mas facil el adicionar/remover
perifericos de la PCs
1998 – USB 1.1
2000 – USB 2.0
2003 – On-the-Go complementa a USB 2.0 (v1.0a)
USB Basico
USB un maestro “Single Master + Multiple Slaves” bus encuestado
constantemente
USB Host Controller (Master)
y Root Hub
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 33
33
Mouse Speakers
Printer
Frame Frame Frame
Start Of Frame Mouse Packets Speakers Packets Printer Packets
Comparación de Buses
1394-Fire Wire
Ethernet
USB 2.0
WiFi (b/g)
Ojo! No tiene que
soportar High-Speed
para ser
USB 2.0 Compatible
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 34
34
1
1 Gb
Gb
480 Mb/s
480 Mb/s
100 Mb/s
100 Mb/s
12 Mb/s
12 Mb/s
1.5 Mb/s
1.5 Mb/s
1 Mb/s
1 Mb/s
500 Kb/s
500 Kb/s
Serial Port
LS-USB
1.5 Mb/s
FS-USB
12 Mb/s
HS-USB
480 Mb/s
USB 1.1
USB 2.0
Parallel Port
CAN
Grandes Mitos
Mito: un Periférico USB Low-Speed puede transferir datos hasta
la velocidad de 187.5 KB/s (1.5 Mbps)
Real: Imposible, por las restricciones de las especificaciones del
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 35
35
USB
8 byte de datos transferidos cada 10 ms
= 800 Bytes/segundo solamente
Siguiente Gran Mito!
Mito: Un periférico USB Full-Speed USB puede transferir datos hasta 1.5
MB/s (12 Mb/s)
Real: Imposible, 1.5 MB/s es el total del ancho de banda del BUS
El ancho de banda se reparte entre todos los periféricos USB
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 36
36
El ancho de banda se reparte entre todos los periféricos USB
El Over head del Protocolo
Las restricciones del Protocolo
La realidad de la transferencia de datos de un único periférico puede
llegar a ~1.0 MB/s en el mejor de los casos
Solo 64 KB/s en la mayoría de los casos
Topología del BUS USB Físico
USB Host Controller
& Root Hub
Hub
Hub
Speaker
Logic
Analyzer
Keyboard
Hub: Carga maxima = 5
Host (Tier 1)
Tier 2
Tier 3 Hub
Hub
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 37
37
Hasta 126 periféricos...
PIC18 USB esta diseñado para
ser periferico. PIC24/PIC32
puede funcionar como Host o
Periférico.
Tier 4
Tier 5
Tier 6
Tier 7
Hub
Hub
Hub
Hub
Hub
Hub
Hub
Hub
Data Logger
Printer
Interfaz Física
~ 5.0 V
~ 3.3 V
VBUS
D+
D-
GND
VBUS
D+
D-
GND
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 38
38
Half Duplex con codificación de datos NRZI
Bus Alimentado para cada dispositivo:
4.40-5.25V
Garantizado 100 mA
500 mA max por medio de negociación
Debe usar alimentación
externa si se necesita
mas de uno
GND
GND
“mini-B”
FS, HS
“B”
FS, HS
Conectores Standard
- USB 2.0 -
“A”
USB Host
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 39
39
FS, HS
Device
FS, HS
Device
Conectores Standard
- Micro-USB -
Objetivo: Define un tamaño más pequeño, conector
compatible con USB 2.0 para dispositivos muy pequeños (es
decir, teléfonos celulares)
Plugs y Receptaculos
Micro-B plug y receptaculo
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 40
40
Micro-B plug y receptaculo
Permitido en productos OTG y on OTG
Micro-A/B receptaculo
Permitido en productos OTG
Micro-A plug
Indicacual es escencialmente el host (OTG)
Endpoints: Source/Destino de datos
USBen un periférico
RAM
Endpoint 1 OUT
RAM
Data Bucket
LED
USB framed data
USB framed data
USB PIC® MCU
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 41
41
RAM
Endpoint 1 IN “Caps-Lock”
 Número máximo de endpoints por dispositivo especificados por el USB
:
− 16 OUT endpoints + 16 IN endpoints = 32 endpoints
− PIC18F87J50, PIC18F4550, PIC24F, PIC32MX soporta hasta 32 endpoints
− PIC18F14K50 soporta hasta 16 endpoints
 EP0 = es el “caño” de comunicación por Default
USB framed data
Clases de Dispositivos USB
Mouse
External
Hard Drive
Floppy
Drive
Data Glove
Ethernet
Adapter
PICkit™ 3
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 42
42
Joystick
MPLAB®
REAL ICE™
in-circuit emulator
Modem
Keyboard
Human Interface Device Class
(HID)
Mass Storage Device
Class (MSD)
Communication Device
Class (CDC)
Custom Class
(Vendor Class)
Muchas mas clases….
PICkit™ 3
Starter Kit
El Proceso de Enumeración
POWERED
Power
(self/bus)
DEFAULT
Bus
reset
Get Device
ATTACHED
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 43
43
DETACHED ADDRESS
Get Device
Descriptor
CONFIGURED
Get
Descriptors
Cable
Connected
SUSPENDED
Auto-Detección: Full-Speed
Peripheral Device
Peripheral Device
Peripheral Device
Peripheral Device
V
V
V
VUSB
USB
USB
USB 3
3
3
3.
.
.
.3
3
3
3 V
V
V
V
Full Speed Identification
D+ line pull-up
USB PIC® MCU
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 44
44
+5V
D+
D-
GND
Transceiver
Transceiver
Transceiver
Transceiver
USB
Connector
D+ line pull-up
1.5 kΩ 5%
Auto-Detección: Low-Speed
Peripheral Device
Peripheral Device
Peripheral Device
Peripheral Device
V
V
V
VUSB
USB
USB
USB 3
3
3
3.
.
.
.3
3
3
3 V
V
V
V
Low Speed Identification
D- line pull-up
USB PIC® MCU
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 45
45
+5V
D+
D-
GND
Transceiver
Transceiver
Transceiver
Transceiver
USB
Connector
D- line pull-up
1.5 kΩ 5%
Resistores Pull-up dentro del chip
Peripheral Device
VUSB 3.3 V
resistores pull-up dentro
del chip!
USB PIC® MCU
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 46
46
+5V
D+
D-
GND
Transceiver
USB
Connector
del chip!
Planeando la Alimentación
- Arquitectura -
“Low Power” alimentado del bus
Hasta 100 mA (1 ‘carga única’) desde el BUS
Function Controller +
Function
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 47
47
Function
Planeando la Alimentación
- Arquitectura -
“High Power”
100-500 mA desde el bus
Debe ser enumerado a low power (100 mA)
Device pide el bMaxPower
Host habilita la configuración deseada solicitando el
Set_Configuration
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 48
48
Set_Configuration
Planeando la Alimentación
- Arquitectura -
“Self Powered” device
Opcionalmente se puede consumir hasta 100 mA del
bus (si es reactivado) + tanto como se encuentra
disponible en su propia fuente
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 49
49
Planeando la Alimentación
- Necesito Autoalimentación? -
Deberá alimentarse al dispositivo
externamente si:
este necesita funcionar sin estar conectado al
BUS
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 50
50
este necesita mas de 500 mA
Este va a estar conectado a una PC con
baterías, o hubs
Planeando la Alimentación
Power from
USB Cable
VDD
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 51
51
≤10µF
Dispositivos alimentado externamente
- Detectando la conexión al USB -
VBUS from
USB Cable VDD
I/O
Self-Powered
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 52
52
Si el dispositivo está autoalimentado,
debe utilizar un pin I / O con tolernacia
5V al detectar una conexión del cable
antes de habilitar el módulo USB y pull-
up en D + y D-. Además, el dispositivo no
debe nunca estar en modo fuente VBUS
Performance
PIC32
High Performance, Pin Compatible to PIC24F
80 MHz, 1.53 DMIPS/MHz
Up to 80 MIPS
64-  100-Pin Packages
Up to 512 KB Flash
Up to 32 KB RAM
USB 2.0 Device, Embedded Host, OTG
~50 USB PIC MCUs
The industry’s strongest
scalable product, family, and
software migration path
Scalable USB
PIC® MCU Portfolio
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 53
53
PIC18F
Small, Low Power, Low Cost
Up to 12 MIPS
18- to 80-Pin Packages
Up to 128KB Flash
Up to 4KB RAM
USB 2.0 Device Support
Migration
PIC24F
Mid-Range, Capacitive-Touch Capable
Up to 16 MIPS
64-, 80-  100-Pin Packages
Up to 256 KB Flash
Up to 16KB RAM
USB 2.0 Device, Embedded Host, OTG
16-bit
8-bit
Performance
32-bit
Control USB with CCS compiler
usb_init()
usb_task()
usb_enumerated()
usb_cdc_kbhit()
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 54
54
usb_cdc_kbhit()
usb_cdc_getc()
usb_cdc_putc(c)
usb_cdc_puts(*str)
Include files:
usb_desc_cdc.h  usb_cdc.h
PICPeriféricos Comunes
PICPeriféricos Comunes
PIC18 Common Peripherals
Puertos I/O
Analog Comparator
Converso Analógico Digital
Timers (0,1,2,3)
CCP como PWM
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 56
56
CCP como PWM
Addressable USART (AUSART)
Puertos I/O
Puertos I/O
Puertos I/O
Hasta 70 pines bidireccionales
Los mismos estan multiplexados con Periféricos
Alta capacidad de Corriente
25mA en modo fuente/sumidero
Manipulación directa de cada bit en un solo
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 58
58
Manipulación directa de cada bit en un solo
ciclo
Diodos de Protección ESD 4kV
Basado sobre el modelo del cuerpo Humano
Despues del reset:
Todos los I/O son entradas (Hi-Z)
Todos los pines con capacidades analógicas
activadas por default
Configurundo los pines como digitales
El método depende del dispositivo específico
Puede escontrarse en el registro ADCON 1
Could be in ADCON1 register
Puede encontrarse en el registro ANSEL
Registro de control (ADCON1)
VCFG1 VCFG0 PCFG3 PCFG2 PCFG1 PCFG0
Port Configuration Bits
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 59
59
Puede encontrarse en el registro ANSEL
1 = Analog; 0 = Digital
ANS7 ANS6 ANS5 ANS4 ANS3 ANS2 ANS1 ANS0
ANS13 ANS12 ANS11 ANS10 ANS9 ANS8
Analog Select Register (ANSEL)
Analog Select High Register (ANSELH)
Control de la dirección I/O
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 60
60
Bit n en el registro de control TRISx controla
la dirección en el Bit n en PORTx
1 = Entrada, 0 = Salida
Entrada Slida de Datos
Registros TRIS, PORT y LAT
0 1 0 1 0 0 1 1
LATx
Lee
PORTx
Lee
LATx
Escribe
PORTx
o LATx
Bus Interno de Datos
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 61
61
0 0 1 1 0 1 0 0
TRISx
PORTx
(I/O Pins)
Dirección de Datos
(1 = IN, 0 = OUT)
Pines son todos entradas
por default
PORTB Opciones
Todos lod pines del PORTB tienen resistores de
PULL UP.
Un bit controla el pull up de todos los pines
INTCON2 Register
R/W-1 R/W-1 R/W-1 R/W-1 U-0 R/W-1 U-0 R/W-1
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 62
62
bit 7 bit 0
bit 7 RBPU: PORTB Pull-up Enable bit
1 = All PORTB Pull-ups are disabled
0 = PORTB Pull-ups are enabled by
individual port latch values
bit 0 RBIP: RB Port Change Interrupt Priority bit
1 = High Priority
0 = Low Priority
Control I/O con CCS
output_a (value)
output_bit (pin, value)
output_high (pin)
output_low (pin)
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 63
63
output_low (pin)
output_toggle(pin)
variable = input (pin)
variable = input_a()
Conversor A/D:
Conversor A/D:
A/D de 10-bit
A/D de 10-bit
Conersor A/D de 10-bit
AN12
AN12
AN10
AN9
AN8
AN7*
AN6*
13:1
Analog
Mux
CHS3:CHS0
ADC
VAIN
10-bit A/D Result Registers
Channel Select
ADRESH ADRESL
In ADCON0 Register
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 65
65
AN5*
AN4
VREF+ / AN3
VREF- / AN2
AN1
AN0
13:1
Analog
Mux
ADC
VCFG1:VCFG0
VDD
VSS
x0
0x
x1
1x
VREF+ VREF-
VREF Select
ADRESH ADRESL
In ADCON1 Register
*AN5-AN7 not available on 28-pin devices
ADC 10-bit
Escalando resultados
•FS = Fondo de
escala
•N-bits, 2N Codigos
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 66
66
•N-bits, 2N Codigos
posibles
•“Tamaño del Bit” o
Paso = VFS/2N
Ejemplo:
10-bits ADC = 210 = 1024 codigos
Escala de valores completa 0 – 5.12 V
Cual es el tamaño de un bit?
ADC 10-bit
Escalando resultados
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 67
67
Respuesta:
Tamaño del Bit = 5.12 / 1024 = 5 mV
ADC Interpretando los resultados
Ejemplo:
8-bits ADC = 28
Escala completa 0 – 5.0 V
1 Bit = 19.53 mV
Calculo del valor si ADRESH = 0xCA
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 68
68
Result = VIN / Tamaño del Bit
VIN = Result * Tamaño del Bit
VIN = 202 * 19.53 mV
VIN = 3.9456 V
Calculo del valor si ADRESH = 0xCA
Tiempo de adquisición
Acquisition Time
10
ADRES
Adquisición de la señal
Acquisition Time Conversion Time
VIN
time
time
VC
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 69
69
Tiempo de adquisición
determinado por la
capacidad CHold y la
Impedancia de fuente
ADC
VSS
10
+
VC
-
Este tiempo le permite cargarse
completamente a CHold
time
CHOLD
V
SOURCE
RS  10kΩ
Ω
Ω
Ω
time
Acquisition Time Acquisition Time
10
ADRES
ADC Conversion
Conversion Time
ADC Result
11 ADC Conversion
VIN
time
VC
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 70
70
time
ADC
VSS
10
+
VC
-
11 ADC Conversion
Clock cycles (TAD)
time
CHOLD
Conversor A/D de 10-bit
Configuración
ADCON0 Register
U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
bit 7 bit 0
bit 5-2 CHS3:CHS0
Analog Channel Select Bits
0000 = Channel 0 (AN0)
bit 1 GO/DONE: A/D Conversion Status bit
1 = A/D Conversion in progress
0 = A/D Idle
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 71
71
0000 =
0001 =
0010 =
0011 =
0100 =
0101 =
0110 =
0111 =
1000 =
1001 =
1010 =
1011 =
1100 =
Channel 0 (AN0)
Channel 1 (AN1)
Channel 2 (AN2)
Channel 3 (AN3)
Channel 4 (AN4)
Channel 5 (AN5)
Channel 6 (AN6)
Channel 7 (AN7)
Channel 8 (AN8)
Channel 9 (AN9)
Channel 10 (AN10)
Channel 11 (AN11)
Channel 12 (AN12)
0 = A/D Idle
bit 0 ADON: A/D On bit
1 = A/D Converter module is enabled
0 = A/D Converter module is disabled
Conversor A/D de 10-bit
Configuración
ADCON1 Register
U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W*
bit 7 bit 0
bit 5 VCFG1: Voltage Reference (VREF-) Configuration bit
1 = VREF- (AN2)
0 = VSS
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 72
72
0 = VSS
bit 4 VCFG0: Voltage Reference (VREF+) Configuration bit
1 = VREF+ (AN3)
0 = VDD
Conversor A/D de 10-bit
Configuración
ADCON1 Register
U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W*
bit 7 bit 0
bit 3-0 PCFG3:PCFG0
A/D Port Configuration Control bits
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 73
73
A = Analog Input
D = Digital I/O
Conversor A/D de 10-bit
Configuración
ADCON2 Register
U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W*
bit 7 bit 0
bit 2-0 ADCS2:ADCS0: A/D Conversion Clock Selection bits
NOTE: This parameter determines the value of TAD: the conversion time per bit.
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 74
74
bit 2-0 ADCS2:ADCS0: A/D Conversion Clock Selection bits
111 = FRC (Clock derived from A/D RC oscillator)
110 = FOSC/64
101 = FOSC/16
100 = FOSC/4
011 = FRC (Clock derived from A/D RC oscillator)
010 = FOSC/32
001 = FOSC/8
000 = FOSC/2
Conversor A/D de 10-bit
Configuración
Seleccionando el clock del A/D
A/D Clock Source (TAD) Maximum Device Frequency
Operation ADCS2:ADCS0 PIC18F4520
2 T 000 2.86 MHz
At FOSC = 4 MHz:
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 75
75
2 TOSC 000 2.86 MHz
4 TOSC 100 5.71 MHz
8 TOSC 001 11.43 MHz
16 TOSC 101 22.86 MHz
32 TOSC 010 40.0 MHz
64 TOSC 110 40.0 MHz
RC x11 *
* The Internal RC has a typical TAD time of 1.2µs
Minimum TAD = 0.7µ
µ
µ
µs See data sheet for official specification.
TOSC = 1/FOSC
= .25 µs
TAD = 4TOSC
= 1 µs
Conversor A/D de 10-bit
Configuración
Calculando el tiempo de adquisición
TACQ = TAMP + TC + TCOFF
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 76
76
TAMP = Amplifier Settling Time
= Tamp internal + Tamp external
TC = Charging Time
= -(CHOLD)·(RIC + RSS + RS)·ln(1/2047)µ
µ
µ
µs
TCOFF = Temperature Coefficient
= (Temp – 25 C)·(0.02µ
µ
µ
µs/ C) for Temp  25 C
= 0 for Temp  25 C
Calculando el tiempo del amplificados
Conversor A/D de 10-bit
Configuración
TAMP = TAMP INT+ TAMP EXT
TAMP INT : Tiempo interno del amplificador. Chequear el data sheet para el
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 77
77
TAMP INT : Tiempo interno del amplificador. Chequear el data sheet para el
dispositivo específico. Para el PIC18F4520, TAMP INT es 0.2 µs.
TAMP EXT: Es el tiempo del amplificador externo. Este es muy importante cuando el
circuito externo acondiciona la señal. Para la placa de micorochip PICDEM2 Plus
es un POTENCIOMETRO, y este número es 0 µs.
TAMP = 0.2 µ
µ
µ
µs
Conversor A/D de 10-bit
Configuración
Calculando el Tiempo de Carga
TC = -(CHOLD)·(RIC + RSS + RS)·ln(1/2047)µ
µ
µ
µs
C = 25pF
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 78
78
CHOLD = 25pF
RIC = 1kΩ
Ω
Ω
Ω
RSS = 2kΩ
Ω
Ω
Ω
RS = 2.5kΩ
Ω
Ω
Ω MAX
Asumiendo que la impedancia máxima es de
2.5kΩ
Ω
Ω
Ω :
TC = 1.05µ
µ
µ
µs
Conversor A/D de 10-bit
Configuración
Calculando el coeficiete de temperatura
TCOFF = (Temp – 25 C)·(0.02µ
µ
µ
µs/ C)
Temp = Temperatura de Operación
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 79
79
Temp = Temperatura de Operación
Valido para Temp.  25 C.
TCOFF = 0 para Temp.  25 C
Usando la máxima temperatura de operación de
85 C para un dispositivo industrial:
TCOFF = 1.2µ
µ
µ
µs
Conversor A/D de 10-bit
Configuración
Calculando el Tiempo de adquisición
TACQ = TAMP + TC + TCOFF
Para Rs = 2.5k Ω
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 80
80
Para Rs = 2.5k Ω
Temp. = 85 C
TAMP = 0.2 µs
TACQ = 0.2 + 1 + 1.2 = 2.4 µs
bit 5-3 ACQT2:ACQT0: A/D Acquisition Time Selection bits
111 = 20 TAD
Conversor A/D de 10-bit
Configuración
ADCON2 Register
U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W*
bit 7 bit 0
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 81
81
110 = 16 TAD
101 = 12 TAD
100 = 8 TAD
011 = 6 TAD
010 = 4 TAD
001 = 2 TAD
000 = 0 TAD
Given:
TACQ = 2.4 µs
TAD = 1 us
Then:
ACQT2:0 = 010 = 4.0 µs
Conversor A/D de 10-bit
Configuración
ADCON2 Register
R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
bit 7 bit 0
bit 7 ADFM: Selecciona el resultado del formato del A/D
1 = Justificado a la derecha
ADRESH ADRESL
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 82
82
0 = Justificado a la izquierda
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
ADRESH ADRESL
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
ADRESH ADRESL
Control ADC con CCS
setup_adc(mode)
setup_adc_ports(value)
set_adc_channel(channel)
read_adc(mode)
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 83
83
read_adc(mode)
adc_done()
#device adc=xx (xx=8,10,12 o16 bits)
Timers
Timers
Timer Comparativa
TIMER 0 TIMERS 1  3 TIMERS 2  4
SIZE OF REGISTER 8-bits or
16-bits
16-bits 8-bits
CLOCK SOURCE
(Internal)
Fosc/4 Fosc/4 Fosc/4
CLOCK SOURCE
(External )
T0CKI pin T13CKI pin or
Timer 1 oscillator
None
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 85
85
(External ) Timer 1 oscillator
(T1OSC)
CLOCK SCALING
AVAILABLE
(Resolution)
Prescaler 8-bits
(1:2


1:256)
Prescaler 2-bits
(1:1, 1:2, 1:4, 1:8)
Prescaler
(1:1,1:4,1:16)
Postscaler
(1:1


1:16)
INTERRUPT EVENT On overflow
FFh


00h
On overflow
FFFFh


0000h
TMR REG matches
PR2
CAN WAKE PIC FROM
SLEEP?
NO YES NO
Timer0
Modo compatible con PIC16
8-bit Timer/Counter
Prescaler Programable de 8 bits
Fuente de clock externa o interna
Interrupción sobre el overflow de FF a 00
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 86
86
Interrupción sobre el overflow de FF a 00
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
TMR0L
8-bit Data Bus
TMR0IF
Timer0
Modo 16-bit
16-bit Timer / Counter
Modo Lectura/Escritura en 16-bit
Interrupción sobre overflow de FFFF a 0000
Same basic features as compatibility mode
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 87
87
Same basic features as compatibility mode
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
High Byte
8-bit Data Bus
TMR0IF
TMR0L
TMR0H
READ
TMR0L
WRITE
TMR0L
Timer0 Operation
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
TMR0IF
TMR0L
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 88
88
T0CON Register
TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
DATA BUS
T08BIT
1 = 8 BIT
0 = 16 BIT
Timer0 Operation
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
High Byte
TMR0IF
TMR0L
TMR0H
READ
TMR0L
WRITE
TMR0L
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 89
89
T0CON Register
TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
DATA BUS
T08BIT
1 = 8 BIT
0 = 16 BIT
Timer0 Operation
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
High Byte
TMR0IF
TMR0L
TMR0H
READ
TMR0L
WRITE
TMR0L
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 90
90
TMR0 Clock Source Select
1 = TOCK1, 0 = Fosc/4
T0CON Register
TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
Timer0 Operation
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
High Byte
TMR0IF
TMR0L
TMR0H
READ
TMR0L
WRITE
TMR0L
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 91
91
Source Edge Select
1 = increment TMR0 on rising edge
0 = increment TMR0 on falling edge
T0CON Register
TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
Timer0 Operation
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
High Byte
TMR0IF
TMR0L
TMR0H
READ
TMR0L
WRITE
TMR0L
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 92
92
T0CON Register
TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
Prescaler Assignment
1= prescaler NOT assigned
0= prescaler IS assigned
Timer0 Operation
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
High Byte
TMR0IF
TMR0L
TMR0H
READ
TMR0L
WRITE
TMR0L
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 93
93
T0CON Register
TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
DATA BUS
Prescaler Rate Select Bits
PS2 PS1 PS0
TMR0
RATE
0 0 0 1:2
0 0 1 1:4
0 1 0 1:8
0 1 1 1:16
1 0 0 1:32
1 0 1 1:64
1 1 0 1:128
1 1 1 1:256
Timer0 Operation
T0SE
T0CKI
FOSC/4
1
0
0
1
Programmable
Prescaler
T0CS
PSA
T0PS2:T0PS0
Clock
Sync
High Byte
TMR0IF
TMR0L
TMR0H
READ
TMR0L
WRITE
TMR0L
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 94
94
T0CON Register
TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
TMR0ON
1 = ON
0 = STOPPED
Timer1 and Timer3
16-bit Timer / Counter
Timer, Synchronous Counter or Asynchronous
Counter
Can operate from separate external crystal
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 95
95
Can operate from separate external crystal
Two read/write 8-bit registers
÷
÷
÷
÷1, ÷
÷
÷
÷2, ÷
÷
÷
÷4, or ÷
÷
÷
÷8 Prescaler
Interrupt on overflow from FFFFh to 0000h
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 96
96
8-bit Data Bus
T1CKPS1: T1CKPS0
TMR1ON
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
T1CON Register
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
1
0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
Timer1 and Timer3
16-bit Read/Write Mode Enable
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 97
97
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
T1CON Register
TMR1L
TMR1H
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
8-bit Data Bus
16-bit Read/Write Mode Enable
1 = Read/Write of Timer
in one operation
0 = Read/Write of Timer
in two 8-bit operations
16-bit Read/Write Mode Enable
1 = Read/Write of Timer
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 98
98
1 = Read/Write of Timer
in one operation
0 = Read/Write of Timer
in two 8-bit operations
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
T1CON Register 8-bit Data Bus
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 99
99
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
T1CON Register
8-bit Data Bus
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
Timer1 Oscillator Enable
1 = T1OSC Enabled
0 = T1OSC off
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
Timer1 Clock Source
1= External Clock
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 100
100
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
T1CON Register
8-bit Data Bus
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
1= External Clock
0 = Fosc/4
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
Timer1 Prescale Select
11 = 1:8
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 101
101
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
T1CON Register
8-bit Data Bus
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
11 = 1:8
10 = 1:4
01 = 1:2
00 = 1:1
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
Timer1 System Clock Status
Read Only Bit
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 102
102
8-bit Data Bus
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
Read Only Bit
1 = Device clock derived from Timer1 OSC
0 = Device clock derived from another source
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
T1CON Register
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
Timer1 External Clock
Synchronization
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 103
103
8-bit Data Bus
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger) High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
Synchronization
Bit only used when TMR1CS = 1
1 = Synchronize external clock input
0 = Do not synchronize
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
T1CON Register
Timer1 and Timer3
1
0
0
1
FOSC/4
T1OSO/
T13CKI
T1OSI
T1OSCEN TMR1CS
Prescaler
1, 2, 4, 8
T1CKPS1: T1CKPS0
Sync
Detect
Sleep Input T1SYNC
TMR1ON
Timer 1 Oscillator
Timer On
1 = Enables Timer
0 = Stops Timer
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 104
104
TMR1L
TMR1IF
Clear Timer 1
(CCP Special Event Trigger)
High Byte
TMR1H
WRITE
TMR1L
READ
TMR1L
T1CON Register
RD16 T1RUN T1OSCEN TMR1CS
TCKPS1:0 TMR1ON
Bit 7 Bit 0
T1SYNC
0 = Stops Timer
8-bit Data Bus
Timer2
8-bit Timer with prescaler and postscaler
Used as PWM time base
TMR2 is readable  writable
TMR2 resets on match with PR2
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 105
105
TMR2 resets on match with PR2
Match with PR2 generates interrupt
Used as baud clock for MSSP (SPI


)
Timer2
T2OUTPS3:T2OUTPS0
T2CON Register
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
bit 7 bit 0
- T2OUTPS3 T2OUTPS2 T2OUTPS1 T2OUTPS0 TMR2ON T2CKPS1 T2CKPS0
TMR2 Postscale Value
Selection Bits
00 = 1:1
01 = 1:4
1x = 1:16
0000 = 1:1
0001 = 1:2
1111 = 1:16
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 106
106
1:1, 1:4, 1:16
Prescaler
1:1 to 1:16
Postscaler
TMR2 PR2
Comparator
FOSC/4
T2CKPS1:T2CKPS0
T2OUTPS3:T2OUTPS0
TMR2IF
Timer 2 Output
(To PWM or MSSP)
8-bit Data Bus
Reset TMR2/PR2 Match
TMR2 Prescale Value
Selection Bits
1x = 1:16
1111 = 1:16
Control Timers con CCS
setup_timer_x(mode)
set_timerx(value).
value=get_timerx.
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 107
107
PIC18 Interrupts
PIC18 Interrupts
Definición
Interrupción
PIC18 Tiene 2 vectores: Alta y Baja Prioridad
Interrupción
Interrupción son
son llamadas
llamadas a
a funciones
funciones disparadas
disparadas por
por eventos
eventos
del
del Hardware,
Hardware, a
a dichas
dichas funciones
funciones no
no se
se les
les puede
puede pasar
pasar
parámetros
parámetros ni
ni tampoco
tampoco pueden
pueden devolver
devolver parámetros
parámetros
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 109
109
PIC18 Tiene 2 vectores: Alta y Baja Prioridad
Las funciones de interrupciones deben ser
tratadas de foema especial:
ISRs no reciben ni devuelven parámetros
ISRs no son llamadas por el código principal
ISRs no son llamadas por otras funciones
TMR0IF
TMR0IE
TMR1IF
Other Core
Interrupts Wakeup
to CPU
Lógica de Interrupción
Modo Legal o compatible con PIC16
Core Interrupts
Peripheral
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 110
110
TMR1IF
TMR1IE
Other
Peripheral
Interrupts
PEIE
GIE
Interrupt to
CPU
Vector to 0x0008
Peripheral
Interrupts
Lógica de Interrupción
Modo Prioridad
IP
IE
IF GIEH
High Priority
Interrupt to CPU
Vector to 0x0008
INT0IF INT0IE
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 111
111
IP
IE
IF GIEL
Wakeup to CPU
Interrupt to CPU
Low Priority
Interrupt to CPU
Vector to 0x0018
PIC18 Fuentes de Interrupción
Fuentes de Interrupción
3 o 4 Int. Externas (INT0-INT3)
Edge Triggered
Rising or Falling selected in INTCON2 register
PORTB Interrupción por cambio (RB4-RB7)
Timer Rollover/Overflow
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 112
112
Timer Rollover/Overflow
Cambio en la salida del comparador
Final de Conversión A/D
Eventos en el canal de comunicaciones
Eventos en otros periféricos…
Habilitando las Interrupciones
(1 de 9)
Select Legacy or Priority mode interrupt
operation
Default is no priority levels
PIC16 Compatibility mode
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 113
113
IPEN: Interrupt Priority Enable
1 = Enable priority levels on interrupts
0 = Disable priority levels on interrupt
RCON Register
IPEN SBOREN --- RI TO PD POR BOR
Habilitando las Interrupciones
(2 de 9)
Set Peripheral Interrupt Priority
Only needed if using Priority Mode
1 = High Priority, 0 = Low Priority
IPR1 Register
PSPIP ADIP RCIP TXIP SSPIP CCP1IP TMR2IP TMR1IP
PSPIP: Parallel Slave Interrupt Priority SSPIP: MSSP Interrupt Priority
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 114
114
IPR2 Register
OSCIP CMIP --- EEIP BCLIP HLVDIP TMR3IP CCP2IP
PSPIP: Parallel Slave Interrupt Priority
ADIP: A/D Converter Interrupt Priority
RCIP: EUSART Rcv Interrupt Priority
TXIP: EUSART Tx Interrupt Priority
SSPIP: MSSP Interrupt Priority
CCPIP: CCP1 Interrupt Priority
TMR2IP: Timer2 Interrupt Priority
TMR1IP: Timer1 Interrupt Priority
OSCIP: Oscillator Fail Interrupt Priority
CMIP: Comparator Interrupt Priority
---- Unimplemented Bit
EEIP: Data EEPROM/Flash Write
Operation Interrupt Priority
BCLIP: Bus Collision Interrupt Priority
HLVDIP: High/Low Voltage Detect Interrupt Priority
TMR3IP: Timer3 Interrupt Priority
CCP2IP: CCP2 Interrupt Priority
Habilitando las Interrupciones
(3 de 9)
Ensure Peripheral Interrupt Flags are clear
If set, an interrupt is pending or being processed
1 = Set, 0 = Clear
PIR1 Register
PSPIF ADIF RCIF TXIF SSPIF CCPIF TMR2IF TMR1IF
PSPIF: Parallel Slave Interrupt Flag
ADIF: A/D Converter Interrupt Flag
SSPIF: MSSP Interrupt Flag
CCPIF: CCP1 Interrupt Flag
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 115
115
PIR2 Register
OSCIF CMIF --- EEIF BCLIF HLVDIF TMR3IF CCP2IF
ADIF: A/D Converter Interrupt Flag
RCIF: EUSART Rcv Interrupt Flag
TXIF: EUSART Tx Interrupt Flag
CCPIF: CCP1 Interrupt Flag
TMR2IF: Timer2 Interrupt Flag
TMR1IF: Timer1 Interrupt Flag
OSCIF: Oscillator Fail Interrupt Flag
CMIF: Comparator Interrupt Flag
---- Unimplemented Bit
EEIF: Data EEPROM/Flash Write
Operation Interrupt Flag
BCLIF: Bus Collision Interrupt Flag
HLVDIF: High/Low Voltage Detect Interrupt Flag
TMR3IF: Timer3 Interrupt Flag
CCP2IF: CCP2 Interrupt Flag
Habilitando las Interrupciones
(4 de 9)
Set Peripheral Interrupt Enables
1 = Enabled, 0 = Disabled
PIE1 Register
PSPIE ADIE RCIE TXIE SSPIE CCPIE TMR2IE TMR1IE
PSPIE: Parallel Slave Interrupt Enable
ADIE: A/D Converter Interrupt Enable
SSPIE: MSSP Interrupt Enable
CCPIE: CCP1 Interrupt Enable
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 116
116
PIE2 Register
OSCIE CMIE --- EEIE BCLIE HLVDIE TMR3IE CCP2IE
ADIE: A/D Converter Interrupt Enable
RCIE: EUSART Rcv Interrupt Enable
TXIE: EUSART Tx Interrupt Enable
CCPIE: CCP1 Interrupt Enable
TMR2IE: Timer2 Interrupt Enable
TMR1IE: Timer1 Interrupt Enable
OSCIE: Oscillator Fail Interrupt Enable
CMIE: Comparator Interrupt Enable
---- Unimplemented Bit
EEIE: Data EEPROM/Flash Write
Operation Interrupt Enable
BCLIE: Bus Collision Interrupt Enable
HLVDIE: High/Low Voltage Detect Interrupt Enable
TMR3IE: Timer3 Interrupt Enable
CCP2IE: CCP2 Interrupt Enable
Habilitando las Interrupciones
(5 de 9)
Set Core Interrupt Priority
Only needed if using Priority Mode
1 = High Priority, 0 = Low Priority
INTCON2 Register
RBPU INTEDG0 INTEDG1 INTEDG2 --- TMR0IP --- RBIP
INT0 does not have an IP
bit – it is always a high
priority interrupt
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 117
117
INTCON3 Register
INT2IP INT1IP --- INT2IE INT1IE --- INT2IF INT1IF
TMR0IP: TMR0 Overflow Interrupt Priority
RBIP: RB Port Change Interrupt Priority
INT2IP: INT2 External Interrupt Priority
INT1IP: INT1 External Interrupt Priority
Habilitando las Interrupciones
(6 de 9)
Ensure Core Interrupt Flags are Clear
If set, an interrupt is pending or being processed
1 = Set, 0 = Clear
INTCON Register
GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 118
118
INTCON3 Register
INT2IP INT1IP --- INT2IE INT1IE --- INT2IF INT1IF
TMR0IF: TMR0 Overflow Interrupt Flag
INT0IF: INT0 External Interrupt Flag
RBIF: RB Port Change Interrupt Flag
INT2IF: INT2 External Interrupt Flag
INT1IF: INT1 External Interrupt Flag
Habilitando las Interrupciones
(6 de 9)
Set Core Interrupt Enables
1 = Enabled, 0 = Disabled
INTCON Register
GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 119
119
INTCON3 Register
INT2IP INT1IP --- INT2IE INT1IE --- INT2IF INT1IF
TMR0IE: TMR0 Overflow Interrupt Enable
INT0IE: INT0 External Interrupt Enable
RBIE: RB Port Change Interrupt Enable
INT2IE: INT2 External Interrupt Enable
INT1IE: INT1 External Interrupt Enable
Habilitando las Interrupciones
(8 de 9)
Enable Low Priority or Peripheral Interrupts
Still need to enable Global Interrupts when in PIC16 compatibility mode
INTCON Register
GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 120
120
PEIE/GIEL :
Peripheral Interrupt Enable (PIC16 Compatibility Mode) /
Global Interrupt Enable Low (Priority Mode)
In PIC16 Compatibility Mode (RCONIPEN = 0):
1 = Enables all unmasked peripheral interrupts
0 = Disables all peripheral interrupts
In Priority Mode (RCONIPEN = 1):
1 = Enables all low priority peripheral interrupts
0 = Disables all low priority peripheral interrupts
Habilitando las Interrupciones
(9 de 9)
Enable High Priority or Global Interrupts
INTCON Register
GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 121
121
GIE/GIEH :
Global Interrupt Enable (PIC16 Compatibility Mode) /
Global Interrupt Enable High (Priority Mode)
In PIC16 Compatibility Mode (RCONIPEN = 0):
1 = Enables all unmasked interrupts
0 = Disables all interrupts
In Priority Mode (RCONIPEN = 1):
1 = Enables all high priority interrupts
0 = Disables all high priority interrupts
Control de interrupciones con CCS
Se usa la directiva #INT_XXX para indicar la fuente
de la interrupcion.
XXX=depende del periférico interruptor
La rutina de interrupción no puede recibir ni pasar
parámetros, debe ser void
Ejemplo:
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 122
122
Ejemplo:
#int_rda
void isr_recepcion (void)
{
sentencias
}
Thank You!
Thank You!
Trademarks
The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KeeLoq, microID, MPLAB, PIC, PICmicro,
PICSTART, PRO MATE, PowerSmart, rfPIC and SmartShunt are registered trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control
Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR,
FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Linear Active Thermistor, Mindi,
MiWi, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo,
© 2011 Microchip Technology Incorporated. All Rights Reserved.
© 2011 Microchip Technology Incorporated. All Rights Reserved. Slide
Slide 124
124
PowerMate, PowerTool, REAL ICE, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel, Total Endurance,
UNI/O, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other
countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.

Más contenido relacionado

Similar a Diapositiva de estudios: PPT - Microchip PIC18.pdf

⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886
Victor Asanza
 
Microprosedador
MicroprosedadorMicroprosedador
Microprosedador
dy vc
 
M I C R O S C A P I T U L O 1
M I C R O S  C A P I T U L O 1M I C R O S  C A P I T U L O 1
M I C R O S C A P I T U L O 1
CristianAlban
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
CristianAlban
 
Grabacion de microcontroladores_pic
Grabacion de microcontroladores_picGrabacion de microcontroladores_pic
Grabacion de microcontroladores_pic
Melvin Gustavo Balladares Rocha
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
CristianAlban
 
Cartilla pic16f877
Cartilla pic16f877Cartilla pic16f877
Cartilla pic16f877
Franklin Isai Leonhuacal
 
3. radar medidor de velocidad
3. radar medidor de velocidad3. radar medidor de velocidad
3. radar medidor de velocidad
SNPP
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
CristianAlban
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
CristianAlban
 
Micro1.ppt
Micro1.pptMicro1.ppt
Micro1.ppt
erikus2015
 
Introduccion a las herramientas libres GNU/Linux para la programacion de micr...
Introduccion a las herramientas libres GNU/Linux para la programacion de micr...Introduccion a las herramientas libres GNU/Linux para la programacion de micr...
Introduccion a las herramientas libres GNU/Linux para la programacion de micr...
georgeguitar
 
⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886
Victor Asanza
 
⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886
Victor Asanza
 
Libro basico pic
Libro basico picLibro basico pic
Libro basico pic
Neda Liz Guevara Vargaya
 
Curso integral pic_236
Curso integral pic_236Curso integral pic_236
Curso integral pic_236
Francisco Acevedo Hernandez
 
Microcontroladores PIC
Microcontroladores PICMicrocontroladores PIC
Microcontroladores PIC
Sohar Carr
 
Clase 8-intro-a-los-microcontroladores
Clase 8-intro-a-los-microcontroladoresClase 8-intro-a-los-microcontroladores
Clase 8-intro-a-los-microcontroladores
Gabriel Jhonatan
 
7803.ppt
7803.ppt7803.ppt
7803.ppt
CiroFlores9
 
Sistemas Microprocesados I
Sistemas Microprocesados ISistemas Microprocesados I
Sistemas Microprocesados I
Christian Morales
 

Similar a Diapositiva de estudios: PPT - Microchip PIC18.pdf (20)

⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 1) DESARROLLO DE APLICACIONES CON #PIC16F886
 
Microprosedador
MicroprosedadorMicroprosedador
Microprosedador
 
M I C R O S C A P I T U L O 1
M I C R O S  C A P I T U L O 1M I C R O S  C A P I T U L O 1
M I C R O S C A P I T U L O 1
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
 
Grabacion de microcontroladores_pic
Grabacion de microcontroladores_picGrabacion de microcontroladores_pic
Grabacion de microcontroladores_pic
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
 
Cartilla pic16f877
Cartilla pic16f877Cartilla pic16f877
Cartilla pic16f877
 
3. radar medidor de velocidad
3. radar medidor de velocidad3. radar medidor de velocidad
3. radar medidor de velocidad
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
 
Micros Capitulo 1
Micros Capitulo 1Micros Capitulo 1
Micros Capitulo 1
 
Micro1.ppt
Micro1.pptMicro1.ppt
Micro1.ppt
 
Introduccion a las herramientas libres GNU/Linux para la programacion de micr...
Introduccion a las herramientas libres GNU/Linux para la programacion de micr...Introduccion a las herramientas libres GNU/Linux para la programacion de micr...
Introduccion a las herramientas libres GNU/Linux para la programacion de micr...
 
⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 4) DESARROLLO DE APLICACIONES CON #PIC16F886
 
⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886
⭐⭐⭐⭐⭐ (Práctica 2) DESARROLLO DE APLICACIONES CON #PIC16F886
 
Libro basico pic
Libro basico picLibro basico pic
Libro basico pic
 
Curso integral pic_236
Curso integral pic_236Curso integral pic_236
Curso integral pic_236
 
Microcontroladores PIC
Microcontroladores PICMicrocontroladores PIC
Microcontroladores PIC
 
Clase 8-intro-a-los-microcontroladores
Clase 8-intro-a-los-microcontroladoresClase 8-intro-a-los-microcontroladores
Clase 8-intro-a-los-microcontroladores
 
7803.ppt
7803.ppt7803.ppt
7803.ppt
 
Sistemas Microprocesados I
Sistemas Microprocesados ISistemas Microprocesados I
Sistemas Microprocesados I
 

Más de jorgejvc777

ENTRADA.pptx--------------------------------
ENTRADA.pptx--------------------------------ENTRADA.pptx--------------------------------
ENTRADA.pptx--------------------------------
jorgejvc777
 
Rectificadores_no_Controlados_1.ppt-------------
Rectificadores_no_Controlados_1.ppt-------------Rectificadores_no_Controlados_1.ppt-------------
Rectificadores_no_Controlados_1.ppt-------------
jorgejvc777
 
CONFIGURACION DEL ROUTER.pptx---------------------
CONFIGURACION DEL ROUTER.pptx---------------------CONFIGURACION DEL ROUTER.pptx---------------------
CONFIGURACION DEL ROUTER.pptx---------------------
jorgejvc777
 
Creación de Documento.pptx-----------------------
Creación de Documento.pptx-----------------------Creación de Documento.pptx-----------------------
Creación de Documento.pptx-----------------------
jorgejvc777
 
Potencia_1_SCR__12508__.ppt----------------
Potencia_1_SCR__12508__.ppt----------------Potencia_1_SCR__12508__.ppt----------------
Potencia_1_SCR__12508__.ppt----------------
jorgejvc777
 
VIRUS DE COMPUTADORA.pptx---------------------------
VIRUS DE COMPUTADORA.pptx---------------------------VIRUS DE COMPUTADORA.pptx---------------------------
VIRUS DE COMPUTADORA.pptx---------------------------
jorgejvc777
 
DIAPO SISE DEL PADRE.ppt---------------------------
DIAPO SISE DEL PADRE.ppt---------------------------DIAPO SISE DEL PADRE.ppt---------------------------
DIAPO SISE DEL PADRE.ppt---------------------------
jorgejvc777
 
DIAPOSITIVA - GUIDE.pptx-----------------------------
DIAPOSITIVA - GUIDE.pptx-----------------------------DIAPOSITIVA - GUIDE.pptx-----------------------------
DIAPOSITIVA - GUIDE.pptx-----------------------------
jorgejvc777
 
Sistemas Lineales.ppt------------------------
Sistemas Lineales.ppt------------------------Sistemas Lineales.ppt------------------------
Sistemas Lineales.ppt------------------------
jorgejvc777
 
Sistemas Lineales.ppt-------------------------------
Sistemas Lineales.ppt-------------------------------Sistemas Lineales.ppt-------------------------------
Sistemas Lineales.ppt-------------------------------
jorgejvc777
 
Dia del maestro.pptx---------------------
Dia del maestro.pptx---------------------Dia del maestro.pptx---------------------
Dia del maestro.pptx---------------------
jorgejvc777
 
TELE 4TO CICLO.ppt-----------------------
TELE 4TO CICLO.ppt-----------------------TELE 4TO CICLO.ppt-----------------------
TELE 4TO CICLO.ppt-----------------------
jorgejvc777
 
Subnetting_IP.ppt--------------------------
Subnetting_IP.ppt--------------------------Subnetting_IP.ppt--------------------------
Subnetting_IP.ppt--------------------------
jorgejvc777
 
implementacion de servicio wifi---------
implementacion de servicio wifi---------implementacion de servicio wifi---------
implementacion de servicio wifi---------
jorgejvc777
 
Direccion_ip.ppt------------------------
Direccion_ip.ppt------------------------Direccion_ip.ppt------------------------
Direccion_ip.ppt------------------------
jorgejvc777
 
practica1-3.pptx-------------------------
practica1-3.pptx-------------------------practica1-3.pptx-------------------------
practica1-3.pptx-------------------------
jorgejvc777
 
practica1-2.pptx-------------------------
practica1-2.pptx-------------------------practica1-2.pptx-------------------------
practica1-2.pptx-------------------------
jorgejvc777
 
practica1-1.pptx------------------------------
practica1-1.pptx------------------------------practica1-1.pptx------------------------------
practica1-1.pptx------------------------------
jorgejvc777
 
Wireless2.ppt------------------------------
Wireless2.ppt------------------------------Wireless2.ppt------------------------------
Wireless2.ppt------------------------------
jorgejvc777
 
gantt_es.pptx-----------------------------------
gantt_es.pptx-----------------------------------gantt_es.pptx-----------------------------------
gantt_es.pptx-----------------------------------
jorgejvc777
 

Más de jorgejvc777 (20)

ENTRADA.pptx--------------------------------
ENTRADA.pptx--------------------------------ENTRADA.pptx--------------------------------
ENTRADA.pptx--------------------------------
 
Rectificadores_no_Controlados_1.ppt-------------
Rectificadores_no_Controlados_1.ppt-------------Rectificadores_no_Controlados_1.ppt-------------
Rectificadores_no_Controlados_1.ppt-------------
 
CONFIGURACION DEL ROUTER.pptx---------------------
CONFIGURACION DEL ROUTER.pptx---------------------CONFIGURACION DEL ROUTER.pptx---------------------
CONFIGURACION DEL ROUTER.pptx---------------------
 
Creación de Documento.pptx-----------------------
Creación de Documento.pptx-----------------------Creación de Documento.pptx-----------------------
Creación de Documento.pptx-----------------------
 
Potencia_1_SCR__12508__.ppt----------------
Potencia_1_SCR__12508__.ppt----------------Potencia_1_SCR__12508__.ppt----------------
Potencia_1_SCR__12508__.ppt----------------
 
VIRUS DE COMPUTADORA.pptx---------------------------
VIRUS DE COMPUTADORA.pptx---------------------------VIRUS DE COMPUTADORA.pptx---------------------------
VIRUS DE COMPUTADORA.pptx---------------------------
 
DIAPO SISE DEL PADRE.ppt---------------------------
DIAPO SISE DEL PADRE.ppt---------------------------DIAPO SISE DEL PADRE.ppt---------------------------
DIAPO SISE DEL PADRE.ppt---------------------------
 
DIAPOSITIVA - GUIDE.pptx-----------------------------
DIAPOSITIVA - GUIDE.pptx-----------------------------DIAPOSITIVA - GUIDE.pptx-----------------------------
DIAPOSITIVA - GUIDE.pptx-----------------------------
 
Sistemas Lineales.ppt------------------------
Sistemas Lineales.ppt------------------------Sistemas Lineales.ppt------------------------
Sistemas Lineales.ppt------------------------
 
Sistemas Lineales.ppt-------------------------------
Sistemas Lineales.ppt-------------------------------Sistemas Lineales.ppt-------------------------------
Sistemas Lineales.ppt-------------------------------
 
Dia del maestro.pptx---------------------
Dia del maestro.pptx---------------------Dia del maestro.pptx---------------------
Dia del maestro.pptx---------------------
 
TELE 4TO CICLO.ppt-----------------------
TELE 4TO CICLO.ppt-----------------------TELE 4TO CICLO.ppt-----------------------
TELE 4TO CICLO.ppt-----------------------
 
Subnetting_IP.ppt--------------------------
Subnetting_IP.ppt--------------------------Subnetting_IP.ppt--------------------------
Subnetting_IP.ppt--------------------------
 
implementacion de servicio wifi---------
implementacion de servicio wifi---------implementacion de servicio wifi---------
implementacion de servicio wifi---------
 
Direccion_ip.ppt------------------------
Direccion_ip.ppt------------------------Direccion_ip.ppt------------------------
Direccion_ip.ppt------------------------
 
practica1-3.pptx-------------------------
practica1-3.pptx-------------------------practica1-3.pptx-------------------------
practica1-3.pptx-------------------------
 
practica1-2.pptx-------------------------
practica1-2.pptx-------------------------practica1-2.pptx-------------------------
practica1-2.pptx-------------------------
 
practica1-1.pptx------------------------------
practica1-1.pptx------------------------------practica1-1.pptx------------------------------
practica1-1.pptx------------------------------
 
Wireless2.ppt------------------------------
Wireless2.ppt------------------------------Wireless2.ppt------------------------------
Wireless2.ppt------------------------------
 
gantt_es.pptx-----------------------------------
gantt_es.pptx-----------------------------------gantt_es.pptx-----------------------------------
gantt_es.pptx-----------------------------------
 

Último

Dosificacion de hormigon NCH 170 actualizada
Dosificacion de hormigon NCH 170 actualizadaDosificacion de hormigon NCH 170 actualizada
Dosificacion de hormigon NCH 170 actualizada
pipex55
 
Infografía operaciones básicas construcción .pdf
Infografía operaciones básicas construcción .pdfInfografía operaciones básicas construcción .pdf
Infografía operaciones básicas construcción .pdf
Carlos Pulido
 
DIAGRAMA DE FLUJO DE ALGORITMO......
DIAGRAMA DE FLUJO   DE   ALGORITMO......DIAGRAMA DE FLUJO   DE   ALGORITMO......
DIAGRAMA DE FLUJO DE ALGORITMO......
taniarivera1015tvr
 
Semana 12 - Ley 29973 de las personas con discapacidad.pdf
Semana 12 - Ley 29973 de las personas con discapacidad.pdfSemana 12 - Ley 29973 de las personas con discapacidad.pdf
Semana 12 - Ley 29973 de las personas con discapacidad.pdf
SandyCuenca
 
Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...
Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...
Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...
andressalas92
 
DIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptx
DIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptxDIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptx
DIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptx
KeylaArlethTorresOrt
 
Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...
Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...
Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...
Eliana Gomajoa
 
slideshare- PRIMER CICLO MIERCOLES Y JUEVES..pptx
slideshare- PRIMER CICLO  MIERCOLES Y JUEVES..pptxslideshare- PRIMER CICLO  MIERCOLES Y JUEVES..pptx
slideshare- PRIMER CICLO MIERCOLES Y JUEVES..pptx
taniarivera1015tvr
 
Infografia - Hugo Hidalgo - Construcción
Infografia - Hugo Hidalgo - ConstrucciónInfografia - Hugo Hidalgo - Construcción
Infografia - Hugo Hidalgo - Construcción
MaraManuelaUrribarri
 
Cargas de Cálculos Estructurales de un Puente
Cargas de Cálculos Estructurales de un PuenteCargas de Cálculos Estructurales de un Puente
Cargas de Cálculos Estructurales de un Puente
jemifermelgarejoaran1
 
Presentación transferencia de calor Jesus Morales.pdf
Presentación transferencia de calor Jesus Morales.pdfPresentación transferencia de calor Jesus Morales.pdf
Presentación transferencia de calor Jesus Morales.pdf
jdcumarem02
 
SLIDEHARE.docx..........................
SLIDEHARE.docx..........................SLIDEHARE.docx..........................
SLIDEHARE.docx..........................
azulsarase
 
Reglamento Interno de seguridad y sdalud en
Reglamento Interno de seguridad y sdalud enReglamento Interno de seguridad y sdalud en
Reglamento Interno de seguridad y sdalud en
Jorge Luis Flores Zuñiga
 
DIAGRAMA ELECTRICOS y circuito electrónicos
DIAGRAMA ELECTRICOS y circuito electrónicosDIAGRAMA ELECTRICOS y circuito electrónicos
DIAGRAMA ELECTRICOS y circuito electrónicos
LuisAngelGuarnizoBet
 
Estructura de un buque, tema de estudios generales de navegación
Estructura de un buque, tema de estudios generales de navegaciónEstructura de un buque, tema de estudios generales de navegación
Estructura de un buque, tema de estudios generales de navegación
AlvaroEduardoConsola1
 
INVENTARIO CEROO Y DINAMICAA FABRIL.pptx
INVENTARIO CEROO Y DINAMICAA FABRIL.pptxINVENTARIO CEROO Y DINAMICAA FABRIL.pptx
INVENTARIO CEROO Y DINAMICAA FABRIL.pptx
FernandoRodrigoEscal
 
Calculo-de-Camaras-Frigorificas.pdf para trabajos
Calculo-de-Camaras-Frigorificas.pdf para trabajosCalculo-de-Camaras-Frigorificas.pdf para trabajos
Calculo-de-Camaras-Frigorificas.pdf para trabajos
JuanCarlos695207
 
SISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOS
SISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOSSISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOS
SISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOS
micoltadaniel2024
 
METODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIA
METODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIAMETODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIA
METODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIA
LuisCiriacoMolina
 
Presentación- de motor a combustión -diesel.pptx
Presentación- de motor a combustión -diesel.pptxPresentación- de motor a combustión -diesel.pptx
Presentación- de motor a combustión -diesel.pptx
ronnyrocha223
 

Último (20)

Dosificacion de hormigon NCH 170 actualizada
Dosificacion de hormigon NCH 170 actualizadaDosificacion de hormigon NCH 170 actualizada
Dosificacion de hormigon NCH 170 actualizada
 
Infografía operaciones básicas construcción .pdf
Infografía operaciones básicas construcción .pdfInfografía operaciones básicas construcción .pdf
Infografía operaciones básicas construcción .pdf
 
DIAGRAMA DE FLUJO DE ALGORITMO......
DIAGRAMA DE FLUJO   DE   ALGORITMO......DIAGRAMA DE FLUJO   DE   ALGORITMO......
DIAGRAMA DE FLUJO DE ALGORITMO......
 
Semana 12 - Ley 29973 de las personas con discapacidad.pdf
Semana 12 - Ley 29973 de las personas con discapacidad.pdfSemana 12 - Ley 29973 de las personas con discapacidad.pdf
Semana 12 - Ley 29973 de las personas con discapacidad.pdf
 
Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...
Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...
Libro Epanet, guía explicativa de los pasos a seguir para analizar redes hidr...
 
DIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptx
DIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptxDIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptx
DIAPOSITIVA DE LA NORMA ISO 22000 EXPOSICI�N.pptx
 
Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...
Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...
Enjoy Pasto Bot - "Tu guía virtual para disfrutar del Carnaval de Negros y Bl...
 
slideshare- PRIMER CICLO MIERCOLES Y JUEVES..pptx
slideshare- PRIMER CICLO  MIERCOLES Y JUEVES..pptxslideshare- PRIMER CICLO  MIERCOLES Y JUEVES..pptx
slideshare- PRIMER CICLO MIERCOLES Y JUEVES..pptx
 
Infografia - Hugo Hidalgo - Construcción
Infografia - Hugo Hidalgo - ConstrucciónInfografia - Hugo Hidalgo - Construcción
Infografia - Hugo Hidalgo - Construcción
 
Cargas de Cálculos Estructurales de un Puente
Cargas de Cálculos Estructurales de un PuenteCargas de Cálculos Estructurales de un Puente
Cargas de Cálculos Estructurales de un Puente
 
Presentación transferencia de calor Jesus Morales.pdf
Presentación transferencia de calor Jesus Morales.pdfPresentación transferencia de calor Jesus Morales.pdf
Presentación transferencia de calor Jesus Morales.pdf
 
SLIDEHARE.docx..........................
SLIDEHARE.docx..........................SLIDEHARE.docx..........................
SLIDEHARE.docx..........................
 
Reglamento Interno de seguridad y sdalud en
Reglamento Interno de seguridad y sdalud enReglamento Interno de seguridad y sdalud en
Reglamento Interno de seguridad y sdalud en
 
DIAGRAMA ELECTRICOS y circuito electrónicos
DIAGRAMA ELECTRICOS y circuito electrónicosDIAGRAMA ELECTRICOS y circuito electrónicos
DIAGRAMA ELECTRICOS y circuito electrónicos
 
Estructura de un buque, tema de estudios generales de navegación
Estructura de un buque, tema de estudios generales de navegaciónEstructura de un buque, tema de estudios generales de navegación
Estructura de un buque, tema de estudios generales de navegación
 
INVENTARIO CEROO Y DINAMICAA FABRIL.pptx
INVENTARIO CEROO Y DINAMICAA FABRIL.pptxINVENTARIO CEROO Y DINAMICAA FABRIL.pptx
INVENTARIO CEROO Y DINAMICAA FABRIL.pptx
 
Calculo-de-Camaras-Frigorificas.pdf para trabajos
Calculo-de-Camaras-Frigorificas.pdf para trabajosCalculo-de-Camaras-Frigorificas.pdf para trabajos
Calculo-de-Camaras-Frigorificas.pdf para trabajos
 
SISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOS
SISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOSSISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOS
SISTEMA AUTOMATIZADO DE LIMPIEZA PARA ACUARIOS
 
METODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIA
METODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIAMETODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIA
METODOLOGIA DE TRAZO Y REPLANTEO EN TOPOGRAFIA
 
Presentación- de motor a combustión -diesel.pptx
Presentación- de motor a combustión -diesel.pptxPresentación- de motor a combustión -diesel.pptx
Presentación- de motor a combustión -diesel.pptx
 

Diapositiva de estudios: PPT - Microchip PIC18.pdf

  • 1. PIC18 con CCS (PIC18F14K50) Autor: Andrés Raúl Bruno Saravia Microchip RTC Argentina
  • 3. Microchip Familias de MCUs © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 3 3
  • 4. Familia PIC18 PIC18 Tradicional PIC18 serie - J PIC18 serie - K 32KB 128KB 4KB © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 4 4 Tradiciona PIC18 40 MHz, 10 MIPS, 5V Flash endurance 100k EEPROM Características Premium PIC18 serie K 64MHz, 16 MIPS, 3V Flash endurance 10k EEPROM Menor costo <32KB Flash PIC18 serie J 40-48 MHz, 10-12 MIPS, 3V Flash endurance 1k – 10k Emulate EEPROM Menor costo >32KB Flash Program Flash Tipicamente los productos con mucha memoria tambien tienen muchos pines y perifericos avanzados integrados
  • 5. Diagrama en Bloques Simplificado Arquitectura PIC® 8-bit RAM Espacio de Datos Espacio de Programa Tabla de Acceso 8-bit 8-bit © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 5 5 Peripfericos Puertos I/O Memoria Flash 8-bit CPU 16-bit Bus de instrucciones Bus de datos 8-bit
  • 6. Mapa de Memoria de Datos Arquitectura PIC® 8-bit Memoria de datos hasta 4k bytes Dividida en bancos de 256 byte Medio Banco 0 y medio banco 15 son PIC18F2520/4520 Mapa de Registros ACCESS RAM Banco0 GPR Banco1 GPR Banco2 GPR © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 6 6 medio banco 15 son usados para crear un banco virtual de acceso directo ACCESS RAM ACCESS SFR ACCESS SFR Banco15 GPR Banco13 GPR Banco14 GPR * La división 50/50 no se mantiene en los dispositivos con muchos registros SFR (Special Function Registers)
  • 7. Mapa de memoria de Programa Arquitectura PIC® 8-bit Hasta 2MB (1M Words) continuos totalmente lineal Memoria de Programa En el chip Vector de Reset Vector de INT de alta prioridad Vector de INT de baja prioridad 000000h 000008h 000018h Contador de Programa de 21-bit © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 7 7 1FFFFEh Memoria de Programa Sin implementar (Read as ‘0’) 008000h 007FFEh Contador de Programa de 21-bit Stack de 31 niveles Nivel de Stack 1 Nivel de Stack 2 Nivel de Stack 30 Nivel de Stack 31
  • 8. Tabla de Lectura Arquitectura PIC® 8-bit Memoria de Datos (RAM) Memoria de Programa (Flash) 0x000000 0x000002 0x000004 0x000006 0x000001 0x000003 0x000005 0x000007 0x000 0x001 0x002 0x003 22-bit Address 00 00 09 TBLPTRU TBLPTRH TBLPTRL Puntero de Mem. Prog. de 21-bit © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 8 8 2C 2C TABLAT 0x00000A 0x000008 0x1FFFF4 0x1FFFF6 0x1FFFF8 0x1FFFFA 0x1FFFFC 0x1FFFFE 0x00000B 0x000009 0x1FFFF5 0x1FFFF7 0x1FFFF9 0x1FFFFB 0x1FFFFD 0x1FFFFF 0x005 0x004 0xFFA 0xFFB 0xFFC 0xFFD 0xFFE 0xFFF 8-bit Data Byte Alto Byte Bajo
  • 9. Características especiales Características especiales Como setear los bits de configuración del PIC® Como setear los bits de configuración del PIC®
  • 11. Fuentes de Clock Primaria Selección Fija LP, XT, HS, RC, EC, Int RC Osc Secundaria PIC18F: Sistema de Clock © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 11 11 Secundaria Oscilador Timer1 – Frecuencia fija Necesario para base de tiempo de RTR Oscilador Interno RC INTOSC (8 MHz por default) 4, 2, 1 MHz, 500, 250, 125 y 31 kHz seleccionables INTRC (31 kHz)
  • 12. Sistema de Clock PIC18F1XK50 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 12 12
  • 13. PIC18F1XK50 Opciones del Oscilador para el USB © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 13 13
  • 15. In-Circuit Serial Programming™ Solo necesita 2 pines para programar al dispositivo Conveniente para programar en sistemas Calibración de datos Serialización de datos Suportado por debuggers y programadores en MPLAB® Pin Pin PP VPP DD VDD SS VSS RB6 RB7 Function Function Programming Voltage Supply Voltage Ground Clock Input Data I/O & Command Input © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 15 15 programadores en MPLAB ICSP™ Connector
  • 16. Características Especiales PIC18F Amplio Voltaje de operación: 2.0V a 5.5V Memoria de Programa Flash Mejorada con 100,000 ciclos de borrado/escritura Memoria de Datos EEPROM con 1,000,000 de ciclos © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 16 16 Memoria de Datos EEPROM con 1,000,000 de ciclos de borrado/escritura Retención de Datos en Memoria EEPROM Flash/Data : 100 años típico
  • 17. Watchdog Timer Ayuda al software a recuperarse de un mal funcionamiento Usa un oscilador libre RC en el chip WDT es borrado por la instrucción CLRWDT WDT Habilitable (WDTEN) no puede ser borrado por soft el overflow (desborde) del WDT reetea al chip Período del timeout programable : 18ms a 3.0s típico Opera en modo SLEEP; sobre el time out, despierta la CPU. © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 17 17 Opera en modo SLEEP; sobre el time out, despierta la CPU.
  • 18. Generador de Reset Interno POR: Power On Reset con MCLR ataado a VDD, es generado un pulso de RESET cuando el flanco de subida a VDD es detectado PWRT: Power Up Timer 72 ms (nominal) VDD MCLR Circuito RESET en CHIP Reset Interno © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 18 18 72 ms (nominal) Desacoplado del BOR OST: Oscillator Startup Timer Mantiene en RESET al dispositivo por 1024 cyclos de maquina (TCYs) Le permite al cristal o al resonador estabilizarse Bypaseado en: Two Speed Startup Mode INTOSC usa un clock para el procesador no estable Internal Reset VDD MCLR POR PWRT OST TPWRT TOST Reset Operación
  • 19. BOR –Brown Out Reset Cuando el voltaje cae por debajo de un umbral particular, el dispositivo se pone en RESET Impide el funcionamiento irregular o inesperado Elimina la necesidad de un circuito externo BOR © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 19 19 Elimina la necesidad de un circuito externo BOR
  • 20. PBOR – Programmable Brown Out Reset Opción de configuración (fijado en tiempo de programa) No puede ser activado/desactivado por software Cuatro puntos de disparo BVDD seleccionables 2.5V – Mini VDD para OTP MCUs PICmicro® © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 20 20 2.5V – Mini VDD para OTP MCUs PICmicro 2.7V 4.2V 4.5V Para otros umbrales use un supervisor externo (MCP1xx, MCP8xx/TCM8xx, or TC12xx)
  • 21. PBOR – Programmable Brown Out Reset Mantiene al MCU PICmicro® MCU en RESET durante ~72ms despues que VDD supero el nivel de umbral © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 21 21
  • 22. PLVD – Detector de Bajo Voltaje Programable Alerta antes que el brown out 16 Puntos de disparo seleccionables © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 22 22 seleccionables 1.8V hasta 4.5V en pasos de 0.1 a 0.2V Entrada analógica externa VREF interno
  • 23. PIC18F Características especiales Resets PIC18 RESETS Power-on Reset (POR) MCLR Reset durante la operación normal Programmable Brown-out Reset (BOR) Watchdog Timer (WDT) Reset (durante la ejecución ) © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 23 23 ejecución ) Instrucción RESET Reset por Stack Full Reset por Stack Underflow Para todos los resets el vector del PC es la dirección 0 Despues del RESET el PC tiene 0x000000
  • 24. Los siguientes bits son afectados por el RESET RCON Register POR = ‘0’: Power On RESET BOR = ‘0’ & POR = ‘1’: BOR RESET TO = ‘0’: WDT RESET RI = ‘0’: RESET Instrucción PIC18F Características especiales RESET Registers © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 24 24 STKPTR Register STKFUL = ‘1’: Stack over flow RESET STKUNF = ‘1’: Stack under flow RESET MCLR RESET ies indicado por: POR, BOR, TO & RI = ‘1’ y STKFUL & STKUNF = ‘0’
  • 25. PIC18 Bits de Configuración PIC18 Bits de Configuración
  • 26. Que son los bits de Configuración? Son usados para activar o no las características especiales: Proteccion del Codigo Watchdog Timer Reset Vector High Interrupt Vector Low Interrupt Vector 16-bit Program Memory User Memory User Memory © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 26 26 Watchdog Timer Tipo de Oscilador Opcion de Debug Otras… User Flash Registros de Configuración Device ID Registro CONFIGlocalizado en la memoria de programa, fuera del area de ejecución del código (inicia en @ 0x300000) User Memory User Memory Configuration Configuration Memory Memory
  • 27. Bits de Configuración PIC18F4520 (4 of 11) IESO — — FCMEN FOSC2 FOSC1 FOSC0 — BORV1 — — BOREN1 BOREN0 PWRTEN R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 bit 7 bit 0 BORV0 CONFIG1H Register CONFIG2L Register FOSC3 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 27 27 — BORV1 — — BOREN1 BOREN0 PWRTEN bit 7 bit 0 BORV0 — WDTPS3 — — WDTPS1 WDTPS0 WDTEN R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 bit 7 bit 0 WDTPS2 — MCLRE — — LPT1OSC PBADEN CCP2MX R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 bit 7 bit 0 CONFIG2H Register CONFIG3H Register —
  • 28. Configurations Bits con CCS Usar directiva #FUSES #fuses HS,NOWDT © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 28 28 options puede variar segun el dispositivo. Un listado de las opciones válidas esta en el tope de cada archivo de cabecera de cada dispositivo.
  • 29. PIC18F1x50 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 29 29
  • 30. PIC18F14K50 Pin Out © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 30 30
  • 32. Un poco de historia... USB fue co-desarrollado por un grupo de compañías…. Compaq Intel Microsoft © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 32 32 Microsoft NEC …quería hacer mucho mas facil el adicionar/remover perifericos de la PCs 1998 – USB 1.1 2000 – USB 2.0 2003 – On-the-Go complementa a USB 2.0 (v1.0a)
  • 33. USB Basico USB un maestro “Single Master + Multiple Slaves” bus encuestado constantemente USB Host Controller (Master) y Root Hub © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 33 33 Mouse Speakers Printer Frame Frame Frame Start Of Frame Mouse Packets Speakers Packets Printer Packets
  • 34. Comparación de Buses 1394-Fire Wire Ethernet USB 2.0 WiFi (b/g) Ojo! No tiene que soportar High-Speed para ser USB 2.0 Compatible © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 34 34 1 1 Gb Gb 480 Mb/s 480 Mb/s 100 Mb/s 100 Mb/s 12 Mb/s 12 Mb/s 1.5 Mb/s 1.5 Mb/s 1 Mb/s 1 Mb/s 500 Kb/s 500 Kb/s Serial Port LS-USB 1.5 Mb/s FS-USB 12 Mb/s HS-USB 480 Mb/s USB 1.1 USB 2.0 Parallel Port CAN
  • 35. Grandes Mitos Mito: un Periférico USB Low-Speed puede transferir datos hasta la velocidad de 187.5 KB/s (1.5 Mbps) Real: Imposible, por las restricciones de las especificaciones del © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 35 35 USB 8 byte de datos transferidos cada 10 ms = 800 Bytes/segundo solamente
  • 36. Siguiente Gran Mito! Mito: Un periférico USB Full-Speed USB puede transferir datos hasta 1.5 MB/s (12 Mb/s) Real: Imposible, 1.5 MB/s es el total del ancho de banda del BUS El ancho de banda se reparte entre todos los periféricos USB © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 36 36 El ancho de banda se reparte entre todos los periféricos USB El Over head del Protocolo Las restricciones del Protocolo La realidad de la transferencia de datos de un único periférico puede llegar a ~1.0 MB/s en el mejor de los casos Solo 64 KB/s en la mayoría de los casos
  • 37. Topología del BUS USB Físico USB Host Controller & Root Hub Hub Hub Speaker Logic Analyzer Keyboard Hub: Carga maxima = 5 Host (Tier 1) Tier 2 Tier 3 Hub Hub © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 37 37 Hasta 126 periféricos... PIC18 USB esta diseñado para ser periferico. PIC24/PIC32 puede funcionar como Host o Periférico. Tier 4 Tier 5 Tier 6 Tier 7 Hub Hub Hub Hub Hub Hub Hub Hub Data Logger Printer
  • 38. Interfaz Física ~ 5.0 V ~ 3.3 V VBUS D+ D- GND VBUS D+ D- GND © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 38 38 Half Duplex con codificación de datos NRZI Bus Alimentado para cada dispositivo: 4.40-5.25V Garantizado 100 mA 500 mA max por medio de negociación Debe usar alimentación externa si se necesita mas de uno GND GND
  • 39. “mini-B” FS, HS “B” FS, HS Conectores Standard - USB 2.0 - “A” USB Host © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 39 39 FS, HS Device FS, HS Device
  • 40. Conectores Standard - Micro-USB - Objetivo: Define un tamaño más pequeño, conector compatible con USB 2.0 para dispositivos muy pequeños (es decir, teléfonos celulares) Plugs y Receptaculos Micro-B plug y receptaculo © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 40 40 Micro-B plug y receptaculo Permitido en productos OTG y on OTG Micro-A/B receptaculo Permitido en productos OTG Micro-A plug Indicacual es escencialmente el host (OTG)
  • 41. Endpoints: Source/Destino de datos USBen un periférico RAM Endpoint 1 OUT RAM Data Bucket LED USB framed data USB framed data USB PIC® MCU © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 41 41 RAM Endpoint 1 IN “Caps-Lock” Número máximo de endpoints por dispositivo especificados por el USB : − 16 OUT endpoints + 16 IN endpoints = 32 endpoints − PIC18F87J50, PIC18F4550, PIC24F, PIC32MX soporta hasta 32 endpoints − PIC18F14K50 soporta hasta 16 endpoints EP0 = es el “caño” de comunicación por Default USB framed data
  • 42. Clases de Dispositivos USB Mouse External Hard Drive Floppy Drive Data Glove Ethernet Adapter PICkit™ 3 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 42 42 Joystick MPLAB® REAL ICE™ in-circuit emulator Modem Keyboard Human Interface Device Class (HID) Mass Storage Device Class (MSD) Communication Device Class (CDC) Custom Class (Vendor Class) Muchas mas clases…. PICkit™ 3 Starter Kit
  • 43. El Proceso de Enumeración POWERED Power (self/bus) DEFAULT Bus reset Get Device ATTACHED © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 43 43 DETACHED ADDRESS Get Device Descriptor CONFIGURED Get Descriptors Cable Connected SUSPENDED
  • 44. Auto-Detección: Full-Speed Peripheral Device Peripheral Device Peripheral Device Peripheral Device V V V VUSB USB USB USB 3 3 3 3. . . .3 3 3 3 V V V V Full Speed Identification D+ line pull-up USB PIC® MCU © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 44 44 +5V D+ D- GND Transceiver Transceiver Transceiver Transceiver USB Connector D+ line pull-up 1.5 kΩ 5%
  • 45. Auto-Detección: Low-Speed Peripheral Device Peripheral Device Peripheral Device Peripheral Device V V V VUSB USB USB USB 3 3 3 3. . . .3 3 3 3 V V V V Low Speed Identification D- line pull-up USB PIC® MCU © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 45 45 +5V D+ D- GND Transceiver Transceiver Transceiver Transceiver USB Connector D- line pull-up 1.5 kΩ 5%
  • 46. Resistores Pull-up dentro del chip Peripheral Device VUSB 3.3 V resistores pull-up dentro del chip! USB PIC® MCU © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 46 46 +5V D+ D- GND Transceiver USB Connector del chip!
  • 47. Planeando la Alimentación - Arquitectura - “Low Power” alimentado del bus Hasta 100 mA (1 ‘carga única’) desde el BUS Function Controller + Function © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 47 47 Function
  • 48. Planeando la Alimentación - Arquitectura - “High Power” 100-500 mA desde el bus Debe ser enumerado a low power (100 mA) Device pide el bMaxPower Host habilita la configuración deseada solicitando el Set_Configuration © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 48 48 Set_Configuration
  • 49. Planeando la Alimentación - Arquitectura - “Self Powered” device Opcionalmente se puede consumir hasta 100 mA del bus (si es reactivado) + tanto como se encuentra disponible en su propia fuente © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 49 49
  • 50. Planeando la Alimentación - Necesito Autoalimentación? - Deberá alimentarse al dispositivo externamente si: este necesita funcionar sin estar conectado al BUS © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 50 50 este necesita mas de 500 mA Este va a estar conectado a una PC con baterías, o hubs
  • 51. Planeando la Alimentación Power from USB Cable VDD © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 51 51 ≤10µF
  • 52. Dispositivos alimentado externamente - Detectando la conexión al USB - VBUS from USB Cable VDD I/O Self-Powered © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 52 52 Si el dispositivo está autoalimentado, debe utilizar un pin I / O con tolernacia 5V al detectar una conexión del cable antes de habilitar el módulo USB y pull- up en D + y D-. Además, el dispositivo no debe nunca estar en modo fuente VBUS
  • 53. Performance PIC32 High Performance, Pin Compatible to PIC24F 80 MHz, 1.53 DMIPS/MHz Up to 80 MIPS 64- 100-Pin Packages Up to 512 KB Flash Up to 32 KB RAM USB 2.0 Device, Embedded Host, OTG ~50 USB PIC MCUs The industry’s strongest scalable product, family, and software migration path Scalable USB PIC® MCU Portfolio © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 53 53 PIC18F Small, Low Power, Low Cost Up to 12 MIPS 18- to 80-Pin Packages Up to 128KB Flash Up to 4KB RAM USB 2.0 Device Support Migration PIC24F Mid-Range, Capacitive-Touch Capable Up to 16 MIPS 64-, 80- 100-Pin Packages Up to 256 KB Flash Up to 16KB RAM USB 2.0 Device, Embedded Host, OTG 16-bit 8-bit Performance 32-bit
  • 54. Control USB with CCS compiler usb_init() usb_task() usb_enumerated() usb_cdc_kbhit() © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 54 54 usb_cdc_kbhit() usb_cdc_getc() usb_cdc_putc(c) usb_cdc_puts(*str) Include files: usb_desc_cdc.h usb_cdc.h
  • 56. PIC18 Common Peripherals Puertos I/O Analog Comparator Converso Analógico Digital Timers (0,1,2,3) CCP como PWM © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 56 56 CCP como PWM Addressable USART (AUSART)
  • 58. Puertos I/O Hasta 70 pines bidireccionales Los mismos estan multiplexados con Periféricos Alta capacidad de Corriente 25mA en modo fuente/sumidero Manipulación directa de cada bit en un solo © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 58 58 Manipulación directa de cada bit en un solo ciclo Diodos de Protección ESD 4kV Basado sobre el modelo del cuerpo Humano Despues del reset: Todos los I/O son entradas (Hi-Z) Todos los pines con capacidades analógicas activadas por default
  • 59. Configurundo los pines como digitales El método depende del dispositivo específico Puede escontrarse en el registro ADCON 1 Could be in ADCON1 register Puede encontrarse en el registro ANSEL Registro de control (ADCON1) VCFG1 VCFG0 PCFG3 PCFG2 PCFG1 PCFG0 Port Configuration Bits © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 59 59 Puede encontrarse en el registro ANSEL 1 = Analog; 0 = Digital ANS7 ANS6 ANS5 ANS4 ANS3 ANS2 ANS1 ANS0 ANS13 ANS12 ANS11 ANS10 ANS9 ANS8 Analog Select Register (ANSEL) Analog Select High Register (ANSELH)
  • 60. Control de la dirección I/O © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 60 60 Bit n en el registro de control TRISx controla la dirección en el Bit n en PORTx 1 = Entrada, 0 = Salida
  • 61. Entrada Slida de Datos Registros TRIS, PORT y LAT 0 1 0 1 0 0 1 1 LATx Lee PORTx Lee LATx Escribe PORTx o LATx Bus Interno de Datos © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 61 61 0 0 1 1 0 1 0 0 TRISx PORTx (I/O Pins) Dirección de Datos (1 = IN, 0 = OUT) Pines son todos entradas por default
  • 62. PORTB Opciones Todos lod pines del PORTB tienen resistores de PULL UP. Un bit controla el pull up de todos los pines INTCON2 Register R/W-1 R/W-1 R/W-1 R/W-1 U-0 R/W-1 U-0 R/W-1 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 62 62 bit 7 bit 0 bit 7 RBPU: PORTB Pull-up Enable bit 1 = All PORTB Pull-ups are disabled 0 = PORTB Pull-ups are enabled by individual port latch values bit 0 RBIP: RB Port Change Interrupt Priority bit 1 = High Priority 0 = Low Priority
  • 63. Control I/O con CCS output_a (value) output_bit (pin, value) output_high (pin) output_low (pin) © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 63 63 output_low (pin) output_toggle(pin) variable = input (pin) variable = input_a()
  • 64. Conversor A/D: Conversor A/D: A/D de 10-bit A/D de 10-bit
  • 65. Conersor A/D de 10-bit AN12 AN12 AN10 AN9 AN8 AN7* AN6* 13:1 Analog Mux CHS3:CHS0 ADC VAIN 10-bit A/D Result Registers Channel Select ADRESH ADRESL In ADCON0 Register © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 65 65 AN5* AN4 VREF+ / AN3 VREF- / AN2 AN1 AN0 13:1 Analog Mux ADC VCFG1:VCFG0 VDD VSS x0 0x x1 1x VREF+ VREF- VREF Select ADRESH ADRESL In ADCON1 Register *AN5-AN7 not available on 28-pin devices
  • 66. ADC 10-bit Escalando resultados •FS = Fondo de escala •N-bits, 2N Codigos © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 66 66 •N-bits, 2N Codigos posibles •“Tamaño del Bit” o Paso = VFS/2N
  • 67. Ejemplo: 10-bits ADC = 210 = 1024 codigos Escala de valores completa 0 – 5.12 V Cual es el tamaño de un bit? ADC 10-bit Escalando resultados © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 67 67 Respuesta: Tamaño del Bit = 5.12 / 1024 = 5 mV
  • 68. ADC Interpretando los resultados Ejemplo: 8-bits ADC = 28 Escala completa 0 – 5.0 V 1 Bit = 19.53 mV Calculo del valor si ADRESH = 0xCA © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 68 68 Result = VIN / Tamaño del Bit VIN = Result * Tamaño del Bit VIN = 202 * 19.53 mV VIN = 3.9456 V Calculo del valor si ADRESH = 0xCA
  • 69. Tiempo de adquisición Acquisition Time 10 ADRES Adquisición de la señal Acquisition Time Conversion Time VIN time time VC © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 69 69 Tiempo de adquisición determinado por la capacidad CHold y la Impedancia de fuente ADC VSS 10 + VC - Este tiempo le permite cargarse completamente a CHold time CHOLD V SOURCE RS 10kΩ Ω Ω Ω
  • 70. time Acquisition Time Acquisition Time 10 ADRES ADC Conversion Conversion Time ADC Result 11 ADC Conversion VIN time VC © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 70 70 time ADC VSS 10 + VC - 11 ADC Conversion Clock cycles (TAD) time CHOLD
  • 71. Conversor A/D de 10-bit Configuración ADCON0 Register U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 bit 7 bit 0 bit 5-2 CHS3:CHS0 Analog Channel Select Bits 0000 = Channel 0 (AN0) bit 1 GO/DONE: A/D Conversion Status bit 1 = A/D Conversion in progress 0 = A/D Idle © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 71 71 0000 = 0001 = 0010 = 0011 = 0100 = 0101 = 0110 = 0111 = 1000 = 1001 = 1010 = 1011 = 1100 = Channel 0 (AN0) Channel 1 (AN1) Channel 2 (AN2) Channel 3 (AN3) Channel 4 (AN4) Channel 5 (AN5) Channel 6 (AN6) Channel 7 (AN7) Channel 8 (AN8) Channel 9 (AN9) Channel 10 (AN10) Channel 11 (AN11) Channel 12 (AN12) 0 = A/D Idle bit 0 ADON: A/D On bit 1 = A/D Converter module is enabled 0 = A/D Converter module is disabled
  • 72. Conversor A/D de 10-bit Configuración ADCON1 Register U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W* bit 7 bit 0 bit 5 VCFG1: Voltage Reference (VREF-) Configuration bit 1 = VREF- (AN2) 0 = VSS © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 72 72 0 = VSS bit 4 VCFG0: Voltage Reference (VREF+) Configuration bit 1 = VREF+ (AN3) 0 = VDD
  • 73. Conversor A/D de 10-bit Configuración ADCON1 Register U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W* bit 7 bit 0 bit 3-0 PCFG3:PCFG0 A/D Port Configuration Control bits © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 73 73 A = Analog Input D = Digital I/O
  • 74. Conversor A/D de 10-bit Configuración ADCON2 Register U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W* bit 7 bit 0 bit 2-0 ADCS2:ADCS0: A/D Conversion Clock Selection bits NOTE: This parameter determines the value of TAD: the conversion time per bit. © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 74 74 bit 2-0 ADCS2:ADCS0: A/D Conversion Clock Selection bits 111 = FRC (Clock derived from A/D RC oscillator) 110 = FOSC/64 101 = FOSC/16 100 = FOSC/4 011 = FRC (Clock derived from A/D RC oscillator) 010 = FOSC/32 001 = FOSC/8 000 = FOSC/2
  • 75. Conversor A/D de 10-bit Configuración Seleccionando el clock del A/D A/D Clock Source (TAD) Maximum Device Frequency Operation ADCS2:ADCS0 PIC18F4520 2 T 000 2.86 MHz At FOSC = 4 MHz: © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 75 75 2 TOSC 000 2.86 MHz 4 TOSC 100 5.71 MHz 8 TOSC 001 11.43 MHz 16 TOSC 101 22.86 MHz 32 TOSC 010 40.0 MHz 64 TOSC 110 40.0 MHz RC x11 * * The Internal RC has a typical TAD time of 1.2µs Minimum TAD = 0.7µ µ µ µs See data sheet for official specification. TOSC = 1/FOSC = .25 µs TAD = 4TOSC = 1 µs
  • 76. Conversor A/D de 10-bit Configuración Calculando el tiempo de adquisición TACQ = TAMP + TC + TCOFF © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 76 76 TAMP = Amplifier Settling Time = Tamp internal + Tamp external TC = Charging Time = -(CHOLD)·(RIC + RSS + RS)·ln(1/2047)µ µ µ µs TCOFF = Temperature Coefficient = (Temp – 25 C)·(0.02µ µ µ µs/ C) for Temp 25 C = 0 for Temp 25 C
  • 77. Calculando el tiempo del amplificados Conversor A/D de 10-bit Configuración TAMP = TAMP INT+ TAMP EXT TAMP INT : Tiempo interno del amplificador. Chequear el data sheet para el © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 77 77 TAMP INT : Tiempo interno del amplificador. Chequear el data sheet para el dispositivo específico. Para el PIC18F4520, TAMP INT es 0.2 µs. TAMP EXT: Es el tiempo del amplificador externo. Este es muy importante cuando el circuito externo acondiciona la señal. Para la placa de micorochip PICDEM2 Plus es un POTENCIOMETRO, y este número es 0 µs. TAMP = 0.2 µ µ µ µs
  • 78. Conversor A/D de 10-bit Configuración Calculando el Tiempo de Carga TC = -(CHOLD)·(RIC + RSS + RS)·ln(1/2047)µ µ µ µs C = 25pF © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 78 78 CHOLD = 25pF RIC = 1kΩ Ω Ω Ω RSS = 2kΩ Ω Ω Ω RS = 2.5kΩ Ω Ω Ω MAX Asumiendo que la impedancia máxima es de 2.5kΩ Ω Ω Ω : TC = 1.05µ µ µ µs
  • 79. Conversor A/D de 10-bit Configuración Calculando el coeficiete de temperatura TCOFF = (Temp – 25 C)·(0.02µ µ µ µs/ C) Temp = Temperatura de Operación © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 79 79 Temp = Temperatura de Operación Valido para Temp. 25 C. TCOFF = 0 para Temp. 25 C Usando la máxima temperatura de operación de 85 C para un dispositivo industrial: TCOFF = 1.2µ µ µ µs
  • 80. Conversor A/D de 10-bit Configuración Calculando el Tiempo de adquisición TACQ = TAMP + TC + TCOFF Para Rs = 2.5k Ω © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 80 80 Para Rs = 2.5k Ω Temp. = 85 C TAMP = 0.2 µs TACQ = 0.2 + 1 + 1.2 = 2.4 µs
  • 81. bit 5-3 ACQT2:ACQT0: A/D Acquisition Time Selection bits 111 = 20 TAD Conversor A/D de 10-bit Configuración ADCON2 Register U-0 U-0 R/W-0 R/W-0 R/W-0* R/W* R/W* R/W* bit 7 bit 0 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 81 81 110 = 16 TAD 101 = 12 TAD 100 = 8 TAD 011 = 6 TAD 010 = 4 TAD 001 = 2 TAD 000 = 0 TAD Given: TACQ = 2.4 µs TAD = 1 us Then: ACQT2:0 = 010 = 4.0 µs
  • 82. Conversor A/D de 10-bit Configuración ADCON2 Register R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 bit 7 bit 0 bit 7 ADFM: Selecciona el resultado del formato del A/D 1 = Justificado a la derecha ADRESH ADRESL © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 82 82 0 = Justificado a la izquierda b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 ADRESH ADRESL b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 ADRESH ADRESL
  • 83. Control ADC con CCS setup_adc(mode) setup_adc_ports(value) set_adc_channel(channel) read_adc(mode) © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 83 83 read_adc(mode) adc_done() #device adc=xx (xx=8,10,12 o16 bits)
  • 85. Timer Comparativa TIMER 0 TIMERS 1 3 TIMERS 2 4 SIZE OF REGISTER 8-bits or 16-bits 16-bits 8-bits CLOCK SOURCE (Internal) Fosc/4 Fosc/4 Fosc/4 CLOCK SOURCE (External ) T0CKI pin T13CKI pin or Timer 1 oscillator None © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 85 85 (External ) Timer 1 oscillator (T1OSC) CLOCK SCALING AVAILABLE (Resolution) Prescaler 8-bits (1:2 1:256) Prescaler 2-bits (1:1, 1:2, 1:4, 1:8) Prescaler (1:1,1:4,1:16) Postscaler (1:1 1:16) INTERRUPT EVENT On overflow FFh 00h On overflow FFFFh 0000h TMR REG matches PR2 CAN WAKE PIC FROM SLEEP? NO YES NO
  • 86. Timer0 Modo compatible con PIC16 8-bit Timer/Counter Prescaler Programable de 8 bits Fuente de clock externa o interna Interrupción sobre el overflow de FF a 00 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 86 86 Interrupción sobre el overflow de FF a 00 T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync TMR0L 8-bit Data Bus TMR0IF
  • 87. Timer0 Modo 16-bit 16-bit Timer / Counter Modo Lectura/Escritura en 16-bit Interrupción sobre overflow de FFFF a 0000 Same basic features as compatibility mode © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 87 87 Same basic features as compatibility mode T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync High Byte 8-bit Data Bus TMR0IF TMR0L TMR0H READ TMR0L WRITE TMR0L
  • 88. Timer0 Operation T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync TMR0IF TMR0L © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 88 88 T0CON Register TMR0ON T08BIT T0CS T0SE PSA T0PS2:0 DATA BUS T08BIT 1 = 8 BIT 0 = 16 BIT
  • 89. Timer0 Operation T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync High Byte TMR0IF TMR0L TMR0H READ TMR0L WRITE TMR0L © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 89 89 T0CON Register TMR0ON T08BIT T0CS T0SE PSA T0PS2:0 DATA BUS T08BIT 1 = 8 BIT 0 = 16 BIT
  • 90. Timer0 Operation T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync High Byte TMR0IF TMR0L TMR0H READ TMR0L WRITE TMR0L © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 90 90 TMR0 Clock Source Select 1 = TOCK1, 0 = Fosc/4 T0CON Register TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
  • 91. Timer0 Operation T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync High Byte TMR0IF TMR0L TMR0H READ TMR0L WRITE TMR0L © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 91 91 Source Edge Select 1 = increment TMR0 on rising edge 0 = increment TMR0 on falling edge T0CON Register TMR0ON T08BIT T0CS T0SE PSA T0PS2:0
  • 92. Timer0 Operation T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync High Byte TMR0IF TMR0L TMR0H READ TMR0L WRITE TMR0L © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 92 92 T0CON Register TMR0ON T08BIT T0CS T0SE PSA T0PS2:0 Prescaler Assignment 1= prescaler NOT assigned 0= prescaler IS assigned
  • 93. Timer0 Operation T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync High Byte TMR0IF TMR0L TMR0H READ TMR0L WRITE TMR0L © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 93 93 T0CON Register TMR0ON T08BIT T0CS T0SE PSA T0PS2:0 DATA BUS Prescaler Rate Select Bits PS2 PS1 PS0 TMR0 RATE 0 0 0 1:2 0 0 1 1:4 0 1 0 1:8 0 1 1 1:16 1 0 0 1:32 1 0 1 1:64 1 1 0 1:128 1 1 1 1:256
  • 94. Timer0 Operation T0SE T0CKI FOSC/4 1 0 0 1 Programmable Prescaler T0CS PSA T0PS2:T0PS0 Clock Sync High Byte TMR0IF TMR0L TMR0H READ TMR0L WRITE TMR0L © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 94 94 T0CON Register TMR0ON T08BIT T0CS T0SE PSA T0PS2:0 TMR0ON 1 = ON 0 = STOPPED
  • 95. Timer1 and Timer3 16-bit Timer / Counter Timer, Synchronous Counter or Asynchronous Counter Can operate from separate external crystal © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 95 95 Can operate from separate external crystal Two read/write 8-bit registers ÷ ÷ ÷ ÷1, ÷ ÷ ÷ ÷2, ÷ ÷ ÷ ÷4, or ÷ ÷ ÷ ÷8 Prescaler Interrupt on overflow from FFFFh to 0000h
  • 96. Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 96 96 8-bit Data Bus T1CKPS1: T1CKPS0 TMR1ON TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L T1CON Register RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC
  • 97. 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 1 0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator Timer1 and Timer3 16-bit Read/Write Mode Enable © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 97 97 RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC T1CON Register TMR1L TMR1H TMR1IF Clear Timer 1 (CCP Special Event Trigger) 8-bit Data Bus 16-bit Read/Write Mode Enable 1 = Read/Write of Timer in one operation 0 = Read/Write of Timer in two 8-bit operations
  • 98. 16-bit Read/Write Mode Enable 1 = Read/Write of Timer Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 98 98 1 = Read/Write of Timer in one operation 0 = Read/Write of Timer in two 8-bit operations RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC T1CON Register 8-bit Data Bus TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L
  • 99. Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 99 99 RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC T1CON Register 8-bit Data Bus TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L Timer1 Oscillator Enable 1 = T1OSC Enabled 0 = T1OSC off
  • 100. Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator Timer1 Clock Source 1= External Clock © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 100 100 RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC T1CON Register 8-bit Data Bus TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L 1= External Clock 0 = Fosc/4
  • 101. Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator Timer1 Prescale Select 11 = 1:8 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 101 101 RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC T1CON Register 8-bit Data Bus TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L 11 = 1:8 10 = 1:4 01 = 1:2 00 = 1:1
  • 102. Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator Timer1 System Clock Status Read Only Bit © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 102 102 8-bit Data Bus TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L Read Only Bit 1 = Device clock derived from Timer1 OSC 0 = Device clock derived from another source RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC T1CON Register
  • 103. Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator Timer1 External Clock Synchronization © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 103 103 8-bit Data Bus TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L Synchronization Bit only used when TMR1CS = 1 1 = Synchronize external clock input 0 = Do not synchronize RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC T1CON Register
  • 104. Timer1 and Timer3 1 0 0 1 FOSC/4 T1OSO/ T13CKI T1OSI T1OSCEN TMR1CS Prescaler 1, 2, 4, 8 T1CKPS1: T1CKPS0 Sync Detect Sleep Input T1SYNC TMR1ON Timer 1 Oscillator Timer On 1 = Enables Timer 0 = Stops Timer © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 104 104 TMR1L TMR1IF Clear Timer 1 (CCP Special Event Trigger) High Byte TMR1H WRITE TMR1L READ TMR1L T1CON Register RD16 T1RUN T1OSCEN TMR1CS TCKPS1:0 TMR1ON Bit 7 Bit 0 T1SYNC 0 = Stops Timer 8-bit Data Bus
  • 105. Timer2 8-bit Timer with prescaler and postscaler Used as PWM time base TMR2 is readable writable TMR2 resets on match with PR2 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 105 105 TMR2 resets on match with PR2 Match with PR2 generates interrupt Used as baud clock for MSSP (SPI   )
  • 106. Timer2 T2OUTPS3:T2OUTPS0 T2CON Register R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 bit 7 bit 0 - T2OUTPS3 T2OUTPS2 T2OUTPS1 T2OUTPS0 TMR2ON T2CKPS1 T2CKPS0 TMR2 Postscale Value Selection Bits 00 = 1:1 01 = 1:4 1x = 1:16 0000 = 1:1 0001 = 1:2 1111 = 1:16 © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 106 106 1:1, 1:4, 1:16 Prescaler 1:1 to 1:16 Postscaler TMR2 PR2 Comparator FOSC/4 T2CKPS1:T2CKPS0 T2OUTPS3:T2OUTPS0 TMR2IF Timer 2 Output (To PWM or MSSP) 8-bit Data Bus Reset TMR2/PR2 Match TMR2 Prescale Value Selection Bits 1x = 1:16 1111 = 1:16
  • 107. Control Timers con CCS setup_timer_x(mode) set_timerx(value). value=get_timerx. © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 107 107
  • 109. Definición Interrupción PIC18 Tiene 2 vectores: Alta y Baja Prioridad Interrupción Interrupción son son llamadas llamadas a a funciones funciones disparadas disparadas por por eventos eventos del del Hardware, Hardware, a a dichas dichas funciones funciones no no se se les les puede puede pasar pasar parámetros parámetros ni ni tampoco tampoco pueden pueden devolver devolver parámetros parámetros © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 109 109 PIC18 Tiene 2 vectores: Alta y Baja Prioridad Las funciones de interrupciones deben ser tratadas de foema especial: ISRs no reciben ni devuelven parámetros ISRs no son llamadas por el código principal ISRs no son llamadas por otras funciones
  • 110. TMR0IF TMR0IE TMR1IF Other Core Interrupts Wakeup to CPU Lógica de Interrupción Modo Legal o compatible con PIC16 Core Interrupts Peripheral © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 110 110 TMR1IF TMR1IE Other Peripheral Interrupts PEIE GIE Interrupt to CPU Vector to 0x0008 Peripheral Interrupts
  • 111. Lógica de Interrupción Modo Prioridad IP IE IF GIEH High Priority Interrupt to CPU Vector to 0x0008 INT0IF INT0IE © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 111 111 IP IE IF GIEL Wakeup to CPU Interrupt to CPU Low Priority Interrupt to CPU Vector to 0x0018
  • 112. PIC18 Fuentes de Interrupción Fuentes de Interrupción 3 o 4 Int. Externas (INT0-INT3) Edge Triggered Rising or Falling selected in INTCON2 register PORTB Interrupción por cambio (RB4-RB7) Timer Rollover/Overflow © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 112 112 Timer Rollover/Overflow Cambio en la salida del comparador Final de Conversión A/D Eventos en el canal de comunicaciones Eventos en otros periféricos…
  • 113. Habilitando las Interrupciones (1 de 9) Select Legacy or Priority mode interrupt operation Default is no priority levels PIC16 Compatibility mode © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 113 113 IPEN: Interrupt Priority Enable 1 = Enable priority levels on interrupts 0 = Disable priority levels on interrupt RCON Register IPEN SBOREN --- RI TO PD POR BOR
  • 114. Habilitando las Interrupciones (2 de 9) Set Peripheral Interrupt Priority Only needed if using Priority Mode 1 = High Priority, 0 = Low Priority IPR1 Register PSPIP ADIP RCIP TXIP SSPIP CCP1IP TMR2IP TMR1IP PSPIP: Parallel Slave Interrupt Priority SSPIP: MSSP Interrupt Priority © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 114 114 IPR2 Register OSCIP CMIP --- EEIP BCLIP HLVDIP TMR3IP CCP2IP PSPIP: Parallel Slave Interrupt Priority ADIP: A/D Converter Interrupt Priority RCIP: EUSART Rcv Interrupt Priority TXIP: EUSART Tx Interrupt Priority SSPIP: MSSP Interrupt Priority CCPIP: CCP1 Interrupt Priority TMR2IP: Timer2 Interrupt Priority TMR1IP: Timer1 Interrupt Priority OSCIP: Oscillator Fail Interrupt Priority CMIP: Comparator Interrupt Priority ---- Unimplemented Bit EEIP: Data EEPROM/Flash Write Operation Interrupt Priority BCLIP: Bus Collision Interrupt Priority HLVDIP: High/Low Voltage Detect Interrupt Priority TMR3IP: Timer3 Interrupt Priority CCP2IP: CCP2 Interrupt Priority
  • 115. Habilitando las Interrupciones (3 de 9) Ensure Peripheral Interrupt Flags are clear If set, an interrupt is pending or being processed 1 = Set, 0 = Clear PIR1 Register PSPIF ADIF RCIF TXIF SSPIF CCPIF TMR2IF TMR1IF PSPIF: Parallel Slave Interrupt Flag ADIF: A/D Converter Interrupt Flag SSPIF: MSSP Interrupt Flag CCPIF: CCP1 Interrupt Flag © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 115 115 PIR2 Register OSCIF CMIF --- EEIF BCLIF HLVDIF TMR3IF CCP2IF ADIF: A/D Converter Interrupt Flag RCIF: EUSART Rcv Interrupt Flag TXIF: EUSART Tx Interrupt Flag CCPIF: CCP1 Interrupt Flag TMR2IF: Timer2 Interrupt Flag TMR1IF: Timer1 Interrupt Flag OSCIF: Oscillator Fail Interrupt Flag CMIF: Comparator Interrupt Flag ---- Unimplemented Bit EEIF: Data EEPROM/Flash Write Operation Interrupt Flag BCLIF: Bus Collision Interrupt Flag HLVDIF: High/Low Voltage Detect Interrupt Flag TMR3IF: Timer3 Interrupt Flag CCP2IF: CCP2 Interrupt Flag
  • 116. Habilitando las Interrupciones (4 de 9) Set Peripheral Interrupt Enables 1 = Enabled, 0 = Disabled PIE1 Register PSPIE ADIE RCIE TXIE SSPIE CCPIE TMR2IE TMR1IE PSPIE: Parallel Slave Interrupt Enable ADIE: A/D Converter Interrupt Enable SSPIE: MSSP Interrupt Enable CCPIE: CCP1 Interrupt Enable © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 116 116 PIE2 Register OSCIE CMIE --- EEIE BCLIE HLVDIE TMR3IE CCP2IE ADIE: A/D Converter Interrupt Enable RCIE: EUSART Rcv Interrupt Enable TXIE: EUSART Tx Interrupt Enable CCPIE: CCP1 Interrupt Enable TMR2IE: Timer2 Interrupt Enable TMR1IE: Timer1 Interrupt Enable OSCIE: Oscillator Fail Interrupt Enable CMIE: Comparator Interrupt Enable ---- Unimplemented Bit EEIE: Data EEPROM/Flash Write Operation Interrupt Enable BCLIE: Bus Collision Interrupt Enable HLVDIE: High/Low Voltage Detect Interrupt Enable TMR3IE: Timer3 Interrupt Enable CCP2IE: CCP2 Interrupt Enable
  • 117. Habilitando las Interrupciones (5 de 9) Set Core Interrupt Priority Only needed if using Priority Mode 1 = High Priority, 0 = Low Priority INTCON2 Register RBPU INTEDG0 INTEDG1 INTEDG2 --- TMR0IP --- RBIP INT0 does not have an IP bit – it is always a high priority interrupt © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 117 117 INTCON3 Register INT2IP INT1IP --- INT2IE INT1IE --- INT2IF INT1IF TMR0IP: TMR0 Overflow Interrupt Priority RBIP: RB Port Change Interrupt Priority INT2IP: INT2 External Interrupt Priority INT1IP: INT1 External Interrupt Priority
  • 118. Habilitando las Interrupciones (6 de 9) Ensure Core Interrupt Flags are Clear If set, an interrupt is pending or being processed 1 = Set, 0 = Clear INTCON Register GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 118 118 INTCON3 Register INT2IP INT1IP --- INT2IE INT1IE --- INT2IF INT1IF TMR0IF: TMR0 Overflow Interrupt Flag INT0IF: INT0 External Interrupt Flag RBIF: RB Port Change Interrupt Flag INT2IF: INT2 External Interrupt Flag INT1IF: INT1 External Interrupt Flag
  • 119. Habilitando las Interrupciones (6 de 9) Set Core Interrupt Enables 1 = Enabled, 0 = Disabled INTCON Register GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 119 119 INTCON3 Register INT2IP INT1IP --- INT2IE INT1IE --- INT2IF INT1IF TMR0IE: TMR0 Overflow Interrupt Enable INT0IE: INT0 External Interrupt Enable RBIE: RB Port Change Interrupt Enable INT2IE: INT2 External Interrupt Enable INT1IE: INT1 External Interrupt Enable
  • 120. Habilitando las Interrupciones (8 de 9) Enable Low Priority or Peripheral Interrupts Still need to enable Global Interrupts when in PIC16 compatibility mode INTCON Register GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 120 120 PEIE/GIEL : Peripheral Interrupt Enable (PIC16 Compatibility Mode) / Global Interrupt Enable Low (Priority Mode) In PIC16 Compatibility Mode (RCONIPEN = 0): 1 = Enables all unmasked peripheral interrupts 0 = Disables all peripheral interrupts In Priority Mode (RCONIPEN = 1): 1 = Enables all low priority peripheral interrupts 0 = Disables all low priority peripheral interrupts
  • 121. Habilitando las Interrupciones (9 de 9) Enable High Priority or Global Interrupts INTCON Register GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 121 121 GIE/GIEH : Global Interrupt Enable (PIC16 Compatibility Mode) / Global Interrupt Enable High (Priority Mode) In PIC16 Compatibility Mode (RCONIPEN = 0): 1 = Enables all unmasked interrupts 0 = Disables all interrupts In Priority Mode (RCONIPEN = 1): 1 = Enables all high priority interrupts 0 = Disables all high priority interrupts
  • 122. Control de interrupciones con CCS Se usa la directiva #INT_XXX para indicar la fuente de la interrupcion. XXX=depende del periférico interruptor La rutina de interrupción no puede recibir ni pasar parámetros, debe ser void Ejemplo: © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 122 122 Ejemplo: #int_rda void isr_recepcion (void) { sentencias }
  • 124. Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KeeLoq, microID, MPLAB, PIC, PICmicro, PICSTART, PRO MATE, PowerSmart, rfPIC and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Linear Active Thermistor, Mindi, MiWi, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, © 2011 Microchip Technology Incorporated. All Rights Reserved. © 2011 Microchip Technology Incorporated. All Rights Reserved. Slide Slide 124 124 PowerMate, PowerTool, REAL ICE, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel, Total Endurance, UNI/O, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies.