elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


+  Foro de elhacker.net
|-+  Informática
| |-+  Electrónica
| | |-+  Encender un led cada 0.5 segundos usando temporizador en ensamblador
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Encender un led cada 0.5 segundos usando temporizador en ensamblador  (Leído 3,703 veces)
EIVL14

Desconectado Desconectado

Mensajes: 1


Ver Perfil
Encender un led cada 0.5 segundos usando temporizador en ensamblador
« en: 27 Noviembre 2016, 01:55 am »

Buenas a todos, tengo el siguiente código asm (ensamblador) que consiste en simplemente encender y apagar un led cada 0.5 segundos en el PICF84A , pero lo necesito usando un TMR0 como temporizador. Soy totalmente nuevo en esto de programación de microcontroladores, sobre todo micros de la familia PIC, así que si alguien me puede echar una mano se los agradecería  :(

Código:
LIST P=16F84A
INCLUDE <P16F84A.INC>
CBLOCK 0x0C ; In this position starts user´s RAM.
ENDC
#DEFINE LED PORTB,0

;**********************************************************************************************

ORG 0x00
INICIO
bsf STATUS,RP0                    ; Access to bank 1
bcf LED                                    ; LED line configurated like OUTPUT
bcf STATUS,RP0                    ; Access to Bank 0.
PRINCIPAL
bsf LED                                    ; Turn on the LED
call Retardo_200ms                    ; while the sum of this time
call Retardo_200ms                    
bcf LED                                      ; It turns off while the sum of the next retardos
call Retardo_200ms  
call Retardo_100ms
goto PRINCIPAL

; Subrutinas "Retardo_200ms" y "Retardo_100ms"-------------------------------------------

CBLOCK
R_ContA                              ; Counters for the retardos
R_ContB
ENDC

Retardo_200ms                     ; The named "call" aports 2 machine cycles.
movlw d'200'             ; It Aports 1 machine cycle. This is the value of "M".
goto Retardos_ms             ; It aports 2 machine cycles.
Retardo_100ms                     ; The named "call" aports 2 machine cycles.
movlw d'100'             ; It aports 1 machine cycle.This is the value of "M".
goto Retardos_ms             ; It aport 2 machine cycles.
Retardo_1ms                     ; The named "call" aports 2 machine cycles.
movlw d'1'                     ; It aports 1 machine cycle. This is the value of "M".

Retardos_ms
movwf R_ContB             ; It aports 1 machine cycle.
R1ms_BucleExterno
movlw d'249'             ; It aports Mx1 machine cycles. This is the value of "K".
movwf R_ContA             ; It aports Mx1 machine cycles.
R1ms_BucleInterno
nop                                     ; It aports KxMx1 machine cycles.
decfsz R_ContA,F             ; (K-1)xMx1 cm (when it doesn´t jump) + Mx2 cm (when it jumps).
goto R1ms_BucleInterno           ; It aports (K-1)xMx2 machine cycles.
decfsz R_ContB,F             ; (M-1)x1 cm (when it doesn´t jump) + 2 cm (when it jumps).
goto R1ms_BucleExterno          ; It aports (M-1)x2 machine cycles.
return                             ; The return Jump aports 2 machine cycles.

END


« Última modificación: 27 Noviembre 2016, 02:00 am por EIVL14 » En línea

Meta


Desconectado Desconectado

Mensajes: 3.438



Ver Perfil WWW
Re: Encender un led cada 0.5 segundos usando temporizador en ensamblador
« Respuesta #1 en: 30 Diciembre 2016, 07:49 am »

Hola:

Intentas hacer lo mismo pero con el Timer0.

¿Te atreves?

Es más preciso y el PIC no se queda en esclavo.

Saludos.


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Dudas para crear temporizador en ensamblador « 1 2 »
Electrónica
Fox_Neo 12 23,251 Último mensaje 20 Abril 2013, 00:00 am
por Meta
cargar url diferente cada 5 segundos
Scripting
franfis 0 1,752 Último mensaje 5 Abril 2013, 18:56 pm
por franfis
Cada 12 segundos se perpetra un ciberdelito
Noticias
wolfbcn 0 1,001 Último mensaje 24 Diciembre 2013, 00:45 am
por wolfbcn
Encender led mediante internet usando pic18f y enc28j60
Electrónica
chipo 2 3,703 Último mensaje 22 Febrero 2014, 05:43 am
por Meta
Alertar con una string en ensamblador usando ollydbg « 1 2 »
ASM
Borito30 16 8,485 Último mensaje 7 Marzo 2017, 14:10 pm
por MCKSys Argentina
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines