本文包含原理图、PCB、源代码、封装库、中英文PDF等资源
您需要 登录 才可以下载或查看,没有账号?注册会员
×
;------------------------------------
;- Generated Initialization File --
;------------------------------------
$include (C8051F310.h)
public Init_Device
ORG 0000H
GEIWEI EQU 60H
SHIWEI EQU 70H
BAIWEI EQU 80H
LJMP MAIN
ORG 0100H
MAIN:
LCALL Init_Device
MOV R2,#00
LOOP:
MOV A,R2
MOV B,#10
DIV AB
MOV GEIWEI,B
MOV B,#10
DIV AB
MOV SHIWEI,B
MOV B,#10
DIV AB
MOV BAIWEI,B
MOV A,BAIWEI
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P1,A
CLR P0.6
CLR P0.7
LCALL DELAY
MOV A,SHIWEI
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P1,A
SETB P0.6
CLR P0.7
LCALL DELAY
MOV A,GEIWEI
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P1,A
CLR P0.6
SETB P0.7
LCALL DELAY
INC R2
SJMP LOOP
TAB: DB 0FCH,060H,0DAH ; 段码数据表
DB 0F2H,066H,0B6H
DB 0BEH,0E0H,0FEH,0F6H
DELAY:
MOV R3,#10
D3: MOV R0,#200
D1: MOV R1,#200
D2: DJNZ R1,D2
DJNZ R0,D1
DJNZ R3,D3
RET
INIT SEGMENT CODE
rseg INIT
; Peripheral specific initialization functions,
; Called from the Init_Device label
PCA_Init:
anl PCA0MD, #0BFh
mov PCA0MD, #000h
ret
Timer_Init:
mov TMOD, #010h
mov CKCON, #002h
ret
Port_IO_Init:
; P0.0 - T1 (Timr1), Open-Drain, Digital
; P0.1 - Unassigned, Open-Drain, Digital
; P0.2 - Unassigned, Open-Drain, Digital
; P0.3 - Unassigned, Open-Drain, Digital
; P0.4 - Unassigned, Open-Drain, Digital
; P0.5 - Unassigned, Open-Drain, Digital
; P0.6 - Skipped, Open-Drain, Digital
; P0.7 - Skipped, Open-Drain, Digital
; P1.0 - Skipped, Open-Drain, Digital
; P1.1 - Skipped, Open-Drain, Digital
; P1.2 - Skipped, Open-Drain, Digital
; P1.3 - Skipped, Open-Drain, Digital
; P1.4 - Skipped, Open-Drain, Digital
; P1.5 - Skipped, Open-Drain, Digital
; P1.6 - Skipped, Open-Drain, Digital
; P1.7 - Skipped, Open-Drain, Digital
; P2.0 - Unassigned, Open-Drain, Digital
; P2.1 - Unassigned, Open-Drain, Digital
; P2.2 - Unassigned, Open-Drain, Digital
; P2.3 - Unassigned, Open-Drain, Digital
mov P0SKIP, #0C0h
mov P1SKIP, #0FFh
mov XBR1, #060h
ret
; Initialization function for device,
; Call Init_Device from your main program
Init_Device:
lcall PCA_Init
lcall Timer_Init
lcall Port_IO_Init
ret
end
|