You are on page 1of 2

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

;* 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. *
;*******************************************************************

; Include derivative-specific definitions


INCLUDE 'derivative.inc'

;
; export symbols
;
XDEF _Startup
ABSENTRY _Startup

;
; variable/data section
;
ORG RAMStart ; Insert your data definition here
ExampleVar: DS.B 1
NUMERO: EQU $90
;
; code section
;
ORG ROMStart

_Startup:
LDHX #RAMEnd+1 ; initialize the stack pointer
TXS
CLI ; enable interrupts
BSR PROG_PORTS

mainLoop:
feed_watchdog
BSR BCD ;Convierte el
numero a 7 segmentos
STA PTCD ;escribe el numero en el
display
LDA RTCCNT
CBEQA #$01,ASE

BRA mainLoop
ASE:
LDA NUMERO
CBEQA #$09,RES
INC NUMERO
CLR RTCCNT
BRA mainLoop

RES: MOV #$00,NUMERO


CLR RTCCNT
BRA mainLoop

;;;;;;;;;;;;;;;;;;;;;;; AREA DE SUBRUTINAS ;;;;;;;;;;;;;;;;;;;;


BCD:
LDHX #$E100
LDA NUMERO
TAX
LDA ,X
RTS

PROG_PORTS: MOV #$FF,PTCDD


MOV #$00,PTCD
MOV #$00,PTBDD
MOV #$0F,RTCSC ;Programando el timer
cada segundo
MOV #$01,RTCMOD ;Para contar hasta uno
RTS
ORG $E100
TABLE:
DC.B $3F,$06,$5B,$4F,$66,$6D,$7D,$66,$7F,$67
;**************************************************************
;* 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

You might also like