#INCLUDE "P16F877.inc" ;org 00h ;goto a1;org 0ch;;******************************************; 主程序段;******************************************a1 movlw 8;循環(huán)次數(shù) movwf 40h;movlw B01111111;初顯示值movwf 41h;a2 bsf STATUS,RP0;選擇體1bcf STATUS,RP1;movlw 00h;movwf TRISD;設置RD口為輸出口bcf STATUS,RP0;選擇體0bcf STATUS,RP1;movfw 41h;movwf PORTD;輸出顯示數(shù)據(jù)RRF 41H,0;處理Crrf 41h,1;循環(huán)右移call m001;延時decfsz 40h,1;判斷是否完成8次goto a2;否繼續(xù)goto a1;是返回重新設置;************************************************; 延時子程序;************************************************m001movlw 4movwf 30hm002 movlw 248movwf 31hm003 movlw 250movwf 32hdecfsz 32h,1goto $-1decfsz 31h,1goto m003decfsz 30h,1goto m002 returnend
評論