PIC單片機在ICD 上做一個簡單的查表程序
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單片機相關(guān)文章:51單片機教程
單片機相關(guān)文章:單片機教程
單片機相關(guān)文章:單片機視頻教程
單片機相關(guān)文章:單片機工作原理
評論