Documentos de Académico
Documentos de Profesional
Documentos de Cultura
En esta práctica nos creamos la parte de enfrente del “auto increíble usando
una barra led y programando 6 salidas pudimos usar el armado de la practica
anterior junto con el código solo configuramos que nos marcar ‘111000’ y
‘000111’ cada cierto tiempo par que al momento de arrancar el código le diera la
forma de la boca del auto.
Materiales:
Programador
Lo utilizaremos para subir los códigos al
microcontrolador
protoboard
Para realizar nuestro circuito
Resistencias 330Ω
Como tenemos 6 salidas
ocuparemos 6resistencias
para controlar la corriente y
no quemar los leds
Código:
*******************************************************************
;* This stationery serves as the framework for a user application. *
;* For a more comprehensive program that demonstrates the more *
;* advanced functionality of this processor, please see the *
;* demonstration applications, located in the examples *
;* subdirectory of the "Freescale CodeWarrior for HC08" program *
;* directory. *
;*******************************************************************
;
; variable/data section
;
ORG RAMStart ; Insert your data definition here
ExampleVar: DS.B 1
SALIDA EQU PTBD ;SE LE ASIGNA AL PUERTO UN NOMBRE
PARA IDENTIFICARLO COMO SALIDA
SalidaCfg EQU PTBDD
;
; code section feed_watchdog
;
ORG ROMStart
_Startup:
LDHX #RAMEnd+1 ; initialize the stack pointer
TXS
CLI ; enable interrupts
CLR SALIDA
MOV #$FF,SalidaCfg ;Se declara el puerto B como
salida
programa:
; Insert your code here
NOP
JSR RETARDO
MOV #%01110,SALIDA
JSR RETARDO
BRA programa
RETARDO:
MOV #$06,RTCSC ;SE CONFIGURA EL REGISTRO DE
CONTADOR DE TIEMPO REAL
;PARA QUE EL CONTEO SEA DE MEDIO
SEGUNDO (VER REGISTRO RTCMOD MANUAL)
ESPERA:
feed_watchdog
BRCLR 7,RTCSC,ESPERA
BSET 7,RTCSC
RTS
;**************************************************************
;* spurious - Spurious Interrupt Service Routine. *
;* (unwanted interrupt) *
;**************************************************************
spurious: ; placed here so that security
value
NOP ; does not change all the time.
RTI
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFA
DC.W spurious ;
DC.W spurious ; SWI
DC.W _Startup ; Reset
Conclusiones: