📄 camera3.asm
字号:
;本程序实现的功能是,自动开启CAMERA
;该程序可用于PIC16F87X(A)所有系列
;DESIGNED BY MORRISWU 20080625
;************************************************
;《CAMERA》程序。文件名为“CAMERA.ASM”
;**************************************************
__CONFIG 3F39H;设置配置位中振荡方式为XT,其它全部禁止或关闭
;****************************************************
status equ 3h ;定义状态寄存器地址
portb equ 6h
trisb equ 86h
portc equ 7h ;定义端口C的数据寄存器地址
trisc equ 87h ;定义端口C的方向控制寄存器地址
data1 equ 23h ;定义一个廷时变量寄存器
data2 equ 24h ;定义另一个廷时变量寄存器
n1 equ d'13' ;定义一个外层循环廷时常数
n2 equ 0ffh ;定义一个内层廷时常数
;***********************************************************
org 000h ;定义程序存放区域的起始地址
nop ;放置一条ICD必须的空操用指令
bsf status,5 ;设置文件寄存器的体1
movlw 01h ;对端口C的方向控制码00H先送W
movwf trisc ;再由W转移到方向控制寄存器
movlw 01h
movwf trisb
bcf status,5 ;恢复到文件寄存器体0
start clrf portc
call delay
btfss portb,0
goto start
call delay
bsf portc,1
call delay
call delay
bcf portc,1
bsf portc,2
call delay
bcf portc,2
bsf portc,3
check btfsc portb,0
goto check
call delay10ms
btfsc portb,0
goto check
bsf portc,2
bcf portc,1
bcf portc,3
call delay
bcf portc,2
call delay
bsf portc,1
bcf portc,3
call delay
call delay
bcf portc,1
bcf portc,2
bcf portc,3
goto start
;-------------------------2s廷时子程序----------------------------
delay ;延时期2s
MOVLW 0CH
MOVWF 20H
LP1 MOVLW 0EBH
MOVWF 21H
LP2 MOVLW 0EBH
MOVWF 22H
LP3 DECFSZ 22H
GOTO LP3
DECFSZ 21H
GOTO LP2
DECFSZ 20H
GOTO LP1
RETURN
;******************10ms廷时子程序**********************************************
delay10ms
movlw n1
movwf data1
lp0 movlw n2
movwf data2
lp1 decfsz data2,1
goto lp1
decfsz data1,1
goto lp0
return
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -