快装活动房厂家
免费服务热线

Free service

hotline

010-00000000
快装活动房厂家
热门搜索:
行业资讯
当前位置:首页 > 行业资讯

PIC16F877A单片机led的动态显示

发布时间:2020-06-30 16:45:04 阅读: 来源:快装活动房厂家

list p=16F877A,R=DECinclude "c";;;;;user variables;;;;;;;;Count2 equ 23HCount3 equ 24Hdata_out1 equ 25Hdata_out2 equ 26H;;;;;;;reset vector;;;;;;;;;org 0x00goto mainline;;;;;;delay program;;;;;;;delay_2msmovlw 0x05movwf Count2lp0 movlw 0xffmovwf Count3lp1 decfsz Count3,Fgoto lp1decfsz Count2,Fgoto lp0return delay_250msmovlw 0x41movwf Count2movlw 0xffmovwf Count3decfsz Count3,Fgoto $-1decfsz Count2,Fgoto $-5movlw 0xffmovwf Count2movlw 0xffmovwf Count3decfsz Count3,Fgoto $-1decfsz Count2,Fgoto $-5return;;;;;;main program;;;;;;;;;mainlinebanksel TRISAmovlw 0x00movwf TRISAmovlw 0xffmovwf TRISBmovlw 0x00movwf TRISCmovwf TRISDmovwf TRISEbanksel PORTAmovlw 0x00movwf PORTAmovwf PORTBmovwf PORTCmovwf PORTDmovwf PORTE

banksel INTCONbcf INTCON,PEIElpbtfsc PORTB,0goto lpcall delay_250mswait1btfss PORTB,2goto led1btfss PORTB,3goto led2goto wait1lp2movf PORTA,Wmovwf data_out1L2btfsc PORTB,1goto L2call delay_250mswait2btfss PORTB,2goto led3btfss PORTB,3goto led4goto wait2led1call delay_250msmovlw 0x00movwf PORTAmovlw 0x01movwf PORTAmovlw 0xfemovwf PORTCgoto lp2led2call delay_250msmovlw 0x00movwf PORTAmovlw 0x02movwf PORTAmovlw 0xfemovwf PORTCgoto lp2led3call delay_250msmovlw 0x01movwf PORTAmovlw 0xfdmovwf PORTCcall delay_2msbanksel PORTCmovlw 0x00movwf PORTCmovlw 0xfemovwf PORTCmovf data_out1,Wmovwf PORTAcall delay_2mscall delay_2msled4call delay_250msmovlw 0x02movwf PORTAmovlw 0xfdmovwf PORTCcall delay_2msbanksel PORTCmovlw 0x00movwf PORTCmovlw 0xfemovwf PORTCmovf data_out1,Wmovwf PORTAcall delay_2ms

end

辽宁防静电工作服订制

哈尔滨西服订做

临沂订做工作服