#INCLUDE “P16F877.inc” ;
org 00h ;goto a1;org 0ch;;******************************************; 主程序段;******************************************a1 movlw 8;循环次数 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;输出显现数据RRF 41H,0;处理Crrf 41h,1;循环右移call m001;延时decfsz 40h,1;判别是否完结8次goto a2;否持续goto a1;是回来从头设置;************************************************; 延时子程序;************************************************m001movlw 4movwf 30hm002 movlw 248movwf 31hm003 movlw 250movwf 32hdecfsz 32h,1goto $-1decfsz 31h,1goto m003decfsz 30h,1goto m002 returnend