SlideShare una empresa de Scribd logo
PROGRAMACIÓN MULTITAREA
(MULTITASKING) EN MICROCONTROLADORES
AVR DE 8 BITS.
HAZUR SOCCONINI ALVARADO
UNIVERSIDAD AUTÓNOMA METROPOLITNA XOCHIMILCO
1/20
CONCEPTOS
• THREAD: HILO, PROCESO INDIVIDUAL EJECUTANDOSE EN UN
PROGRAMA
• UN PROGRAMA DE FLUJO ÚNICO O MONO-HILVANADO (SINGLE-THREAD)
UTILIZA UN ÚNICO FLUJO DE CONTROL (THREAD) PARA CONTROLAR SU
EJECUCIÓN.
• TIEMPO COMPARTIDO COMPARTIR DE FORMA CONCURRENTE UN RECURSO
COMPUTACIONAL (TIEMPO DE EJECUCIÓN EN LA CPU, USO DE LA MEMORIA,
ETC.) ENTRE MUCHOS USUARIOS POR MEDIO DE LAS TECNOLOGÍAS DE
MULTIPROGRAMACIÓN Y LA INCLUSIÓN DE INTERRUPCIONES DE RELOJ POR PARTE
DEL SISTEMA.
2/20
CONCEPTOS
• TIMER: TEMPORIZADOR
• INTERRUPCIONES: COMPARTIR DE FORMA CONCURRENTE UN RECURSO
COMPUTACIONAL (TIEMPO DE EJECUCIÓN EN LA CPU, USO DE LA
MEMORIA, ETC.) ENTRE MUCHOS USUARIOS POR MEDIO DE LAS
TECNOLOGÍAS DE MULTIPROGRAMACIÓN Y LA INCLUSIÓN DE
INTERRUPCIONES DE RELOJ POR PARTE DEL SISTEMA.
3/20
PROGRAMAS DE FLUJO ÚNICO
• UN PROGRAMA DE FLUJO ÚNICO O MONO-HILVANADO (SINGLE-THREAD) UTILIZA UN
ÚNICO FLUJO DE CONTROL (THREAD) PARA CONTROLAR SU EJECUCIÓN. MUCHOS
PROGRAMAS NO NECESITAN LA POTENCIA O UTILIDAD DE MÚLTIPLES FLUJOS DE
CONTROL.
• SIN NECESIDAD DE ESPECIFICAR EXPLÍCITAMENTE QUE SE QUIERE UN ÚNICO FLUJO DE
CONTROL, MUCHOS DE LOS APPLETS Y APLICACIONES SON DE FLUJO ÚNICO.
4/20
TIPOS DE PROCESAMIENTO
• EN SERIE O SECUENCIAL
• POR LOTES
• MULTIPROGRAMACIÓN
5
5/20
¿QUÉ ES
MULTITASKING?
6/20
Fuente: Milan Milenkovic,
Sistemas Operativos
7/20
MICROCONTROLADOR
8/20
9/20
Interrupciones
Registros
Unidad de
Control
Buses
Periféricos
PROGRAMANDO CÓDIGO EFICIENTE EN ANSI C
10
10/20
COMPILADOR CARQUITECTURA AVR
SET DE INSTRUCCIONES
32 REGISTROS
PUNTEROS 24 BITS
EFICIENCIA EN 8 BITS (ATMEGA16/32)
• LOS PUNTEROS SIRVEN PARA ACCEDER A DATOS ALMACENADOS EN LA
MEMORIA FLASH DE PROGRAMA (ESTOS DATOS SON SOLO DE LECTURA).
• MANEJANDO DATOS DE 16 BITS, SUMA Y RESTA INMEDIATA (ADIW, SBIW).
• OPERACIONES ARITMÉTICAS Y DE COMPARACIÓN CON VALORES DE 16 BITS
(2 INSTRUCCIONES Y 2 CICLOS DE RELOJ).
• ANÁLOGO SE PUEDEN REALIZAR OPERACIONES ARITMÉTICAS Y DE
COMPARACIÓN CON DATOS DE 32 BITS (4 INSTRUCCIONES Y 4 CICLOS DE
RELOJ).
11
11/20
12
12/20
13
13/20
char *pointer1 = &table[0];
char *pointer2 = &table[49];
*pointer1++ = *- -pointer2;
LD R16,-Z ;predecrementa el puntero Z y carga dato
ST X+,R16 ;almacena dato y pos-incrementa
ANSI C
Lenguaje Ensamblador
VS
2 ciclos de reloj e
instrucciones de una
sola palabra
14
14/20
15
15/20
16
16/20
17
17/20
Sistema de Desarrollo basando en puerto JTAG con programador AVR DRAG
PRUEBA MULTITASTING ATMEGA 32
• TAREA 1. SIRENA
• TAREA 2. LED BASCULANTE
• TAREA 3. DESTELLO
18/20
19
19/20
y el código?
20/20
@HAZUR_
HAZUR84
HAZUR SOCCONINI
ALVARADO
GRACIAS!
HAZUR84

Más contenido relacionado

PPTX
8255 Programmable parallel I/O
PPTX
Memory banking-of-8086-final
PPTX
8255 PPI
PPTX
Instruction set of 8085 microprocessor
PDF
Memory segmentation-of-8086
PPT
8086 micro processor
PPTX
Introduction to Counters
8255 Programmable parallel I/O
Memory banking-of-8086-final
8255 PPI
Instruction set of 8085 microprocessor
Memory segmentation-of-8086
8086 micro processor
Introduction to Counters

La actualidad más candente (20)

PPTX
Interfacing with peripherals: analog to digital converters and digital to ana...
PPT
Architecture of 8086 Microprocessor
PPT
Data transferschemes
PPTX
AVR ATmega32
PDF
Minimum and Maximum Modes of microprocessor 8086
PPTX
Branch instructions in 8051 micrcocontroller
PDF
Memory interfacing of microprocessor 8085
PPT
8085-microprocessor
PPTX
Programmable dma controller 8237
PDF
Intel 80486 Microprocessor
PPTX
Microprocessor vs. microcontroller
PPTX
Automatic temperature control using 8085 microprocessor
PPTX
Architecture of 80286 microprocessor
PPT
Microprogram Control
PPTX
Ripple Carry Adder
PDF
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086
DOCX
Types of cro
PPT
PPTX
8086 memory interface.pptx
PPTX
Interrupts on 8086 microprocessor by vijay kumar.k
Interfacing with peripherals: analog to digital converters and digital to ana...
Architecture of 8086 Microprocessor
Data transferschemes
AVR ATmega32
Minimum and Maximum Modes of microprocessor 8086
Branch instructions in 8051 micrcocontroller
Memory interfacing of microprocessor 8085
8085-microprocessor
Programmable dma controller 8237
Intel 80486 Microprocessor
Microprocessor vs. microcontroller
Automatic temperature control using 8085 microprocessor
Architecture of 80286 microprocessor
Microprogram Control
Ripple Carry Adder
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086
Types of cro
8086 memory interface.pptx
Interrupts on 8086 microprocessor by vijay kumar.k
Publicidad

Destacado (8)

PDF
Ejercicio 09 Serie
DOCX
Instrucciones avr
PPT
03 Arquitectura de un Microprocesador
PDF
02.Arquitectura de los microcontroladores pic
PDF
Ejercicio 02 Tablas
PDF
Ejercicio 08 CAD
PDF
Ejercicio 04 Calculos
PPTX
09 Conjunto de Instrucciones de los Atmega
Ejercicio 09 Serie
Instrucciones avr
03 Arquitectura de un Microprocesador
02.Arquitectura de los microcontroladores pic
Ejercicio 02 Tablas
Ejercicio 08 CAD
Ejercicio 04 Calculos
09 Conjunto de Instrucciones de los Atmega
Publicidad

Similar a Programación multitarea en microcontroladores avr de 8 bits. (20)

PPTX
Introducción
PPTX
Introducción
PDF
135127015 microcontroladores-1-1-ppt
PDF
Sesión 3 introduccion a microcontroladores
PDF
El microcontrolador PIC16F877
PPT
MICROCONTROLADORES.ppt
PDF
Apunte de microprocesadores pic
PDF
18 f4550 2
PDF
PPT
Curso Micro Tema 1
PDF
04 procesadores y microcontroladores
DOC
lógica programable
PPT
Diapos de pic
PPTX
Presentacion pic 16f887 y 18f4550
PDF
Pic16 f877
PPT
Microcontroladores
PDF
SISTEMAS OPERATIVOS
PDF
sistema operativo.pdf
TXT
Microcontrolador wiki
PPT
Microcontroladores 101108114327-phpapp01
Introducción
Introducción
135127015 microcontroladores-1-1-ppt
Sesión 3 introduccion a microcontroladores
El microcontrolador PIC16F877
MICROCONTROLADORES.ppt
Apunte de microprocesadores pic
18 f4550 2
Curso Micro Tema 1
04 procesadores y microcontroladores
lógica programable
Diapos de pic
Presentacion pic 16f887 y 18f4550
Pic16 f877
Microcontroladores
SISTEMAS OPERATIVOS
sistema operativo.pdf
Microcontrolador wiki
Microcontroladores 101108114327-phpapp01

Programación multitarea en microcontroladores avr de 8 bits.

  • 1. PROGRAMACIÓN MULTITAREA (MULTITASKING) EN MICROCONTROLADORES AVR DE 8 BITS. HAZUR SOCCONINI ALVARADO UNIVERSIDAD AUTÓNOMA METROPOLITNA XOCHIMILCO 1/20
  • 2. CONCEPTOS • THREAD: HILO, PROCESO INDIVIDUAL EJECUTANDOSE EN UN PROGRAMA • UN PROGRAMA DE FLUJO ÚNICO O MONO-HILVANADO (SINGLE-THREAD) UTILIZA UN ÚNICO FLUJO DE CONTROL (THREAD) PARA CONTROLAR SU EJECUCIÓN. • TIEMPO COMPARTIDO COMPARTIR DE FORMA CONCURRENTE UN RECURSO COMPUTACIONAL (TIEMPO DE EJECUCIÓN EN LA CPU, USO DE LA MEMORIA, ETC.) ENTRE MUCHOS USUARIOS POR MEDIO DE LAS TECNOLOGÍAS DE MULTIPROGRAMACIÓN Y LA INCLUSIÓN DE INTERRUPCIONES DE RELOJ POR PARTE DEL SISTEMA. 2/20
  • 3. CONCEPTOS • TIMER: TEMPORIZADOR • INTERRUPCIONES: COMPARTIR DE FORMA CONCURRENTE UN RECURSO COMPUTACIONAL (TIEMPO DE EJECUCIÓN EN LA CPU, USO DE LA MEMORIA, ETC.) ENTRE MUCHOS USUARIOS POR MEDIO DE LAS TECNOLOGÍAS DE MULTIPROGRAMACIÓN Y LA INCLUSIÓN DE INTERRUPCIONES DE RELOJ POR PARTE DEL SISTEMA. 3/20
  • 4. PROGRAMAS DE FLUJO ÚNICO • UN PROGRAMA DE FLUJO ÚNICO O MONO-HILVANADO (SINGLE-THREAD) UTILIZA UN ÚNICO FLUJO DE CONTROL (THREAD) PARA CONTROLAR SU EJECUCIÓN. MUCHOS PROGRAMAS NO NECESITAN LA POTENCIA O UTILIDAD DE MÚLTIPLES FLUJOS DE CONTROL. • SIN NECESIDAD DE ESPECIFICAR EXPLÍCITAMENTE QUE SE QUIERE UN ÚNICO FLUJO DE CONTROL, MUCHOS DE LOS APPLETS Y APLICACIONES SON DE FLUJO ÚNICO. 4/20
  • 5. TIPOS DE PROCESAMIENTO • EN SERIE O SECUENCIAL • POR LOTES • MULTIPROGRAMACIÓN 5 5/20
  • 10. PROGRAMANDO CÓDIGO EFICIENTE EN ANSI C 10 10/20 COMPILADOR CARQUITECTURA AVR SET DE INSTRUCCIONES 32 REGISTROS PUNTEROS 24 BITS
  • 11. EFICIENCIA EN 8 BITS (ATMEGA16/32) • LOS PUNTEROS SIRVEN PARA ACCEDER A DATOS ALMACENADOS EN LA MEMORIA FLASH DE PROGRAMA (ESTOS DATOS SON SOLO DE LECTURA). • MANEJANDO DATOS DE 16 BITS, SUMA Y RESTA INMEDIATA (ADIW, SBIW). • OPERACIONES ARITMÉTICAS Y DE COMPARACIÓN CON VALORES DE 16 BITS (2 INSTRUCCIONES Y 2 CICLOS DE RELOJ). • ANÁLOGO SE PUEDEN REALIZAR OPERACIONES ARITMÉTICAS Y DE COMPARACIÓN CON DATOS DE 32 BITS (4 INSTRUCCIONES Y 4 CICLOS DE RELOJ). 11 11/20
  • 13. 13 13/20 char *pointer1 = &table[0]; char *pointer2 = &table[49]; *pointer1++ = *- -pointer2; LD R16,-Z ;predecrementa el puntero Z y carga dato ST X+,R16 ;almacena dato y pos-incrementa ANSI C Lenguaje Ensamblador VS 2 ciclos de reloj e instrucciones de una sola palabra
  • 17. 17 17/20 Sistema de Desarrollo basando en puerto JTAG con programador AVR DRAG
  • 18. PRUEBA MULTITASTING ATMEGA 32 • TAREA 1. SIRENA • TAREA 2. LED BASCULANTE • TAREA 3. DESTELLO 18/20