- UID
- 911329
|
使用MC9S08AW16单片机
Include derivative-specific definitions
INCLUDE 'derivative.inc'
;
; export symbols
;
XDEF _Startup
ABSENTRY _Startup
;
; variable/data section
;
ORG RAMStart ; Insert your data definition here
ExampleVar:
;
; code section
;
ORG ROMStart
_Startup:
LDHX #RAMEnd+1 ; initialize the stack pointer
TXS
CLI ; enable interrupts
mainLoop:
org $0070
AD_Result: DS 1
org $c000
adc1ch1_init:
mov #$9b,ADC1CVL
bset 1,APCTL1
mov #$b0,ADC1CFG
mov #$30,ADC1SC2
mov #$21,ADC1SC1
rts
io_init:
lda #$ff
sta PTDD
sta PTDDD
rts
_startup:
main: clra
sta SOPT
mov #$00,AD_Result
jsr io_init
jsr adc1ch1_init
again:
brset 7,ADC1SC1,led_on
mov #$ff,PTDD
bra again
led_on: mov #$00,PTDD
bclr 7,ADC1SC1
bra again
; Insert your code here
NOP
feed_watchdog
BRA mainLoop
;**************************************************************
;* 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 $fffe
dc.w main
提示错误是
Error: At location 0470 -
Error: Attempt to use invalid or uninitialized memory
我是新手 求大神指教啊 |
|