f326_blink.asm
来自「8051试验程序 基础教材」· 汇编 代码 · 共 65 行
ASM
65 行
;-----------------------------------------------------------------------------
; Copyright (C) 2005 Silicon Laboratories, Inc.
; All rights reserved.
;
; FILE NAME : BLINK.ASM
; DATE : 20 APR 05
; TARGET MCU : C8051F326
; DESCRIPTION : This program illustrates how to configure a port and
; write to a port I/O pin.
;
; NOTES:
;
;-----------------------------------------------------------------------------
#include "ioC8051F326.h" ; Include register definition file.
;-----------------------------------------------------------------------------
; EQUATES
;-----------------------------------------------------------------------------
GREEN_LED equ P2.2 ; Green LED: '1' is ON
;-----------------------------------------------------------------------------
; RESET and INTERRUPT VECTORS
;-----------------------------------------------------------------------------
; Reset Vector
ASEGN CSEG01:CODE,0
ljmp Main ; Locate a jump to the start of
; code at the reset vector.
;-----------------------------------------------------------------------------
; CODE SEGMENT
;-----------------------------------------------------------------------------
RSEG BLINK:CODE ; Switch to this code segment.
Main:
; Configure the Oscillator to 6 Mhz
mov OSCICN, #81h
; Configure the LED pin
orl P2MDOUT, #04h ; make LED pin output push-pull
; Initialize LED to OFF
clr GREEN_LED
; Simple delay loop.
Loop2: mov R7, #03h
Loop1: mov R6, #00h
Loop0: mov R5, #00h
djnz R5, $
djnz R6, Loop0
djnz R7, Loop1
cpl GREEN_LED ; Toggle LED.
jmp Loop2
;-----------------------------------------------------------------------------
; End of file.
END
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?