#include <8ps53.ash>
#define b_out1 porta,0
#define b_out2 portb,7
#define b_out3 portb,6
#define b_out4 portb,5
#define b_out5 portb,4
#define b_out6 porta,1
#define b_out7 porta,2
#define b_out8 porta,3
#define f_50ms 3eh,0
#define f_100ms 3eh,1
#define f_150ms 3eh,2
#define f_200ms 3eh,4
#define f_250ms 3eh,5
#define f_300ms 3eh,6
#define f_350ms 3eh,7
#define f_400ms 3dh,0
cnt_10ms equ 021h
cnt_10msA equ 022h
cnt_10msB equ 023h
cnt_10msC equ 024h
cnt_10msD equ 025h
cnt_10msE equ 026h
cnt_10msF equ 027h
cnt_10msG equ 028h
cnt_50ms equ 029h
cnt_100ms equ 030h
cnt_150ms equ 031h
cnt_200ms equ 032h
astk EQU 3fh
statusStk EQU 07h
c equ 00h
;z equ 02h
r0 equ 00h
;tmr0 equ 01h
;pcl equ 02h
;status equ 03h
r4 equ 04h
port5 equ 05h
port6 equ 06h
;pcon equ 08h
;wucon equ 09h
;pchbuf equ 0ah
;pdcon equ 0bh
;odcon equ 0ch
;phcon equ 0dh
;inten equ 0eh
;intflag equ 0fh
delay_1 equ 0x10
delay_2 equ 0x11
delay_3 equ 0x12
end_cnt equ 0x13
led_cnt equ 0x14
led_cnt_1 equ 0x15
loop_cnt equ 0x16
jb_cnt_h equ 0x17
jb_cnt_l equ 0x18
jb_cnt equ 0x19
flag equ 0x1a
end_f equ 0x0
initRam_cnt equ 0x3f
;-------------------------------
;------reset vector-------------
;-------------------------------
org 3ffh
goto 000h
org 000h
goto start
;-------------------------------
;------program ends-------------
;-------------------------------
;----hard interrupt vector------
;-------------------------------
org 008h
goto tmr0_interrupt
;-------------------------------
;-----program start vector------
;-------------------------------
start:
call initMcu
btrss status,TO_B
goto main
movia 10h
movar FSR
goto clrrArmLoop
;-------------------------------
;function : init_mcu
;in : none
;out : none
;description:
;-------------------------------
initMcu:
; clrr 5
; clrr 6
movia 00000000b
iost 5
movia 00000000b
iost 6
movia A0h
movar pcon
movia 00h
movar wucon
movia 0ffh
movar pdcon
movia 00h
movar odcon
movia 0ffh
movar phcon
movia 81h
movar inten
clrr intflag
movia 0fh
option
clrwdt
return
Clrrarmloop:
clrr indf
incr fsr,1
btrss status,Z_B
goto Clrrarmloop
led_list:
clrwdt
addar pcl,1
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
;调整上电延时时间
goto led1
goto led2
goto led3
goto led4
goto led5
goto led6
goto led7
goto led8
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
nop
nop
nop
nop
nop
nop
nop
led_off:
bsr b_out1
bsr b_out2
bsr b_out3
bsr b_out4
bsr b_out5
bsr b_out6
bsr b_out7
bsr b_out8
led1:
bcr b_out1
btrss f_50ms
return
btrss f_200ms
goto led2
bcr f_200ms
bsr b_out1
led2:
btrss f_100ms
goto led_list
bcr b_out2
btrss f_200ms
goto led3
bcr f_200ms
bsr b_out2
led3:
btrss f_150ms
goto led_list
bcr b_out3
btrss f_200ms
goto led4
bcr f_200ms
bsr b_out3
led4:
btrss f_200ms
goto led_list
bcr b_out4
btrss f_200ms
goto led5
bcr f_200ms
bsr b_out4
led5:
btrss f_250ms
goto led_list
bcr b_out5
btrss f_200ms
goto led6
bcr f_200ms
bsr b_out5
led6:
btrss f_300ms
goto led_list
bcr b_out6
btrss f_200ms
goto led7
bcr f_200ms
bsr b_out6
led7:
btrss f_350ms
goto led_list
bcr b_out7
btrss f_200ms
goto led8
bcr f_200ms
bsr b_out7
led8:
btrss f_400ms
goto led_list
bcr b_out8
btrss f_200ms
goto led1
bcr f_200ms
bsr b_out8
main:
clrwdt
addar pcl,1
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
goto led_off
goto led1
goto led2
goto led3
goto led4
goto led5
goto l