PIC单片机在ICD 上做一个简单的查表程序
时间:02-24
来源:互联网
点击:
include p16f877.inc>
status equ 03h ;2004/4/28
rp0 equ 05h ;
z equ 02h ;1-2-3-9-1
pcl equ 02h
portd equ 08h
trisd equ 88h
mm equ 20h
Count equ 22h
Count1 equ 23h
Count2 equ 24h
org 10
start
bsf status,rp0
clrf trisd
bcf status,rp0
movlw 0
movwf mm
main
call table ;mm=0查表返回后mm=b'11111000'
movwf portd
call delay
incf mm
movlw 0x09 ; if mm=5 goto start,mm become zero
subwf mm,0
btfsc status,z
goto start
goto main
delay
clrf Count
clrf Count1
movlw 0x0f
movwf Count2
PP
decfsz Count,f
goto PP
decfsz Count1,f
goto PP
decfsz Count2,f
goto PP
return
table
movf mm,0
addwF PCL,1
retlw b'00000110' ;1
retlw b'01011011'
retlw b'01001111'
retlw b'01100110'
retlw b'01101101' ;5
retlw b'01111101'
retlw b'00000111'
retlw b'01111111'
retlw b'01101111'
retlw b'00111111' ;0
end
status equ 03h ;2004/4/28
rp0 equ 05h ;
z equ 02h ;1-2-3-9-1
pcl equ 02h
portd equ 08h
trisd equ 88h
mm equ 20h
Count equ 22h
Count1 equ 23h
Count2 equ 24h
org 10
start
bsf status,rp0
clrf trisd
bcf status,rp0
movlw 0
movwf mm
main
call table ;mm=0查表返回后mm=b'11111000'
movwf portd
call delay
incf mm
movlw 0x09 ; if mm=5 goto start,mm become zero
subwf mm,0
btfsc status,z
goto start
goto main
delay
clrf Count
clrf Count1
movlw 0x0f
movwf Count2
PP
decfsz Count,f
goto PP
decfsz Count1,f
goto PP
decfsz Count2,f
goto PP
return
table
movf mm,0
addwF PCL,1
retlw b'00000110' ;1
retlw b'01011011'
retlw b'01001111'
retlw b'01100110'
retlw b'01101101' ;5
retlw b'01111101'
retlw b'00000111'
retlw b'01111111'
retlw b'01101111'
retlw b'00111111' ;0
end
单片机 51单片机 MCU 单片机视频教程 单片机开发 ARM单片机 AVR单片机 PIC单片机 Atmel stm32 单片机学习 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)