八路顺序控制器
list p=16f877
include "p16F877.inc"
;------------------------------------------------------------
deyh equ 0x23 ;延迟子程序使用。
deyl equ 0x24
;-------------------------------------------------------------
;*************************************************************
org 0x000
nop
start
banksel PORTB
clrf PORTB
banksel TRISB
clrf TRISB ;设置B 口为输出。
main
banksel PORTB ;点亮B0 位,顺序显示。
bsf PORTB,0
call delay
banksel PORTB ;点亮B1 位。
bsf PORTB,1
call delay
banksel PORTB ;点亮B2 位。
bsf PORTB,2
call delay
banksel PORTB ;点亮B3 位。
bsf PORTB,3
call delay
banksel PORTB ;点亮B4 位。
bsf PORTB,4
call delay
banksel PORTB ;点亮B5 位。
bsf PORTB,5
call delay
banksel PORTB ;点亮B6 位。
bsf PORTB,6
call delay
banksel PORTB ;点亮B7 位。
bsf PORTB,7
call delay
call delay
;MOVlw 0x00
;MOVwf PORTB
clrf PORTB
call delay
banksel PORTB ;点亮B7 位,反序显示。
上一篇:12C508超声波测距仪程序