中文字幕无码不卡一区二区三区_少妇被又大又粗又爽毛片久久黑人_91精品国产在热久久无毒不卡_久久久久久亚洲综合网站

技術(shù)熱線: 4007-888-234

專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命

提供開發(fā)工具、應(yīng)用測(cè)試 完善的開發(fā)代碼案例庫分享

從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無限潛能!

技術(shù)支持

控制霓虹燈閃爍的例程

更新時(shí)間: 2019-03-26

源程序:

 

;********************************************************
;
;                  LED flash control 2
;
;                                 Device : PIC16F84A
;                                 Clock  : 4MHz
;                                 Author : Seiichi Inoue
;********************************************************

 

        list            p=pic16f84a
        include         p16f84a.inc
        __config _hs_osc & _wdt_off & _pwrte_on & _cp_off
        errorlevel      -302    ;Eliminate bank warning

 

;****************  Label Definition  ********************

cblock  h'0c'
loop_cnt                        ;Loop counter for LED cnt
led_data0                       ;LED data 0
led_data1                       ;LED data 1
led01                           ;LED 01 pattern
led10                           ;LED 10 pattern
led11                           ;LED 11 pattern
port_work                       ;LED data save area
counter                         ;Software timer counter
ptn_save                        ;Pattern number save area
ptn_counter                     ;Pattern counter
w_save                          ;W register save area
s_save                          ;STATUS regi save area
        endc

 

ra0     equ     00              ;RA0 bit
ra1     equ     01              ;RA1 bit
ra2     equ     02              ;RA2 bit

;**************** Speed control data ********************
speed   equ     1               ;100ms (+1=50ms)

 

;*************  Brightness control data  ****************
led1    equ     b'11111110'     ;(01) almost dim
led2    equ     b'11111010'     ;(10) less bright
led3    equ     b'11110000'     ;(11) bright

 

;*************  Pattern Data Definition  ****************
; 1 bright  1 less bright  0 almost dim  0 dim
; 1         0              1             0

 

;******  Pattern 0  ******
p000    equ     b'00000000'
p001    equ     b'00000000'

 

p010    equ     b'10000001'
p011    equ     b'10000001'

 

p020    equ     b'11000011'
p021    equ     b'01000010'

 

p030    equ     b'01100110'
p031    equ     b'10100101'

 

p040    equ     b'00111100'
p041    equ     b'01011010'

 

p180    equ     b'11000000'
p181    equ     b'10100000'

 

p190    equ     b'10000000'
p191    equ     b'01000000'

 

p1a0    equ     b'00000000'
p1a1    equ     b'10000000'

 

;******  Pattern 2  ******
p200    equ     b'00000000'
p201    equ     b'00000000'

 

p210    equ     b'10000000'
p211    equ     b'10000000'

 

p220    equ     b'11000000'
p221    equ     b'01000000'

 

p230    equ     b'01100000'
p231    equ     b'10100000'

 

p240    equ     b'00110000'
p241    equ     b'01010000'

 

p250    equ     b'00011000'
p251    equ     b'00101000'

 

p260    equ     b'00001100'
p261    equ     b'00010100'

 

p270    equ     b'00000110'
p271    equ     b'00001010'

;****************  Program Start  ***********************
        org     0               ;Reset Vector
        goto    init
        org     4               ;Interrupt Vector
        goto    int

 

;******************  Initial Process  *******************
init
;*** Set Port mode
        bsf     status,rp0      ;Change to Bank1
        movlw   b'00000111'     ;RA2-0:IN mode
        movwf   trisa           ;Set TRISA reg
        movlw   b'00000000'     ;RB7-0:OUT mode
        movwf   trisb           ;Set TRISB reg

 

;*** Set Option reg
        movlw   b'10000111'     ;RBPU=OFF,PSA=0,PS=1:256
        movwf   option_reg      ;Set OPTION_REG
        bcf     status,rp0      ;Change to Bank0

 

;*** Set work area
        clrf    led_data0       ;Clear LED data0
        clrf    led_data1       ;Clear LED data1
        movlw   led1            ;Read 01 pattern
        movwf   led01           ;Set  01 pattern
        movlw   led2            ;Read 10 pattern
        movwf   led10           ;Set  10 pattern
        movlw   led3            ;Read 11 pattern
        movwf   led11           ;Set  11 pattern
        clrf    port_work       ;Clear LED data save area
        movlw   speed           ;Read speed data
        addlw   d'1'            ;+1 addition
        movwf   counter         ;Set counter
        movlw   d'1'            ;Set pattern data
        movwf   ptn_save        ;Set pattern 0
        clrf    ptn_counter     ;Clear pattern counter

 

;*** Set TMR0 reg
        movlw   d'61'           ;256-50ms/0.256ms = 61
        movwf   tmr0            ;Set 50msec to TMR0
        movlw   b'10100000'     ;GIE=1,TOIE=1
        movwf   intcon          ;Interruption enable

 

;****************  LED control Process ******************
loop
        movlw   d'4'            ;Set loop counter data
        movwf   loop_cnt        ;Set loop counter
loop1
        movlw   d'1'            ;Set check data
        subwf   loop_cnt,w      ;Check exec times
        btfss   status,z        ;Counter = 1 ?
        goto    next2           ;No.
        goto    process4        ;Jump to Process4
next2
        movlw   d'2'            ;Set check data
        subwf   loop_cnt,w      ;Check exec times
        btfss   status,z        ;Counter = 2 ?
        goto    next3           ;No.
        goto    process3        ;Jump to Process3

next3
        movlw   d'3'            ;Set check data
        subwf   loop_cnt,w      ;Check exec times
        btfss   status,z        ;Counter = 3 ?
        goto    next4           ;No.
        goto    process2        ;Jump to Process2
next4
        movlw   d'4'            ;Set check data
        subwf   loop_cnt,w      ;Check exec times
        btfss   status,z        ;Counter = 4 ?
        goto    loop            ;No. illegal
        goto    process1        ;Jump to Process1

 

led_cont
        movfw   port_work       ;Read PORT WORK data
        movwf   portb           ;Set PORTB
next
        decfsz  loop_cnt,f      ;Count down
        goto    loop1           ;Next Process
        goto    loop            ;Next Period

 

process1
;****************** bit0 for process1 *******************
        btfss   led_data0,0     ;1x ?
        goto    p10_0x          ;No.
        btfss   led_data1,0     ;11 ?
        goto    p10_10          ;Jump to 10 process
        goto    p10_11          ;Jump to 11 process
p10_0x
        btfsc   led_data1,0     ;01 ?
        goto    p10_01          ;Jump to 01 process

p10_00
        goto    p10_set         ;LED off

 

p10_01
        btfss   led01,0         ;Data = 1 ?
        goto    p10_clear       ;No.
        goto    p10_set         ;Yes.

 

p10_10
        btfss   led10,0         ;Data = 1 ?
        goto    p10_clear       ;No.
        goto    p10_set         ;Yes.

 

p10_11
        btfss   led11,0         ;Data = 1 ?
        goto    p10_clear       ;No.

p10_set
        bsf     port_work,0     ;Set bit0
        goto    bit1_process1
p10_clear
        bcf     port_work,0     ;Clear bit0

 

bit1_process1
;****************** bit1 for process1 *******************
        btfss   led_data0,1     ;1x ?
        goto    p11_0x          ;No.
        btfss   led_data1,1     ;11 ?
        goto    p11_10          ;Jump to 10 process
        goto    p11_11          ;Jump to 11 process
p11_0x
        btfsc   led_data1,1     ;01 ?
        goto    p11_01          ;Jump to 01 process

 

p11_00

 goto    p11_set         ;LED off

 

p11_01
        btfss   led01,0         ;Data = 1 ?
        goto    p11_clear       ;No.
        goto    p11_set         ;Yes.

 

p11_10
        btfss   led10,0         ;Data = 1 ?
        goto    p11_clear       ;No.
        goto    p11_set         ;Yes.

 

p11_11
        btfss   led11,0         ;Data = 1 ?
        goto    p11_clear       ;No.

p11_set
        bsf     port_work,1     ;Set bit1
        goto    bit2_process1
p11_clear
        bcf     port_work,1     ;Clear bit1

 

bit2_process1
;****************** bit2 for process1 *******************
        btfss   led_data0,2     ;1x ?
        goto    p12_0x          ;No.
        btfss   led_data1,2     ;11 ?
        goto    p12_10          ;Jump to 10 process
        goto    p12_11          ;Jump to 11 process
p12_0x
        btfsc   led_data1,2     ;01 ?
        goto    p12_01          ;Jump to 01 process

 

p12_00
        goto    p12_set         ;LED off

 

p12_01
        btfss   led01,0         ;Data = 1 ?
        goto    p12_clear       ;No.
        goto    p12_set         ;Yes.

 

p12_10

 btfss   led10,0         ;Data = 1 ?
        goto    p12_clear       ;No.
        goto    p12_set         ;Yes.

 

p12_11
        btfss   led11,0         ;Data = 1 ?
        goto    p12_clear       ;No.

 

p12_set
        bsf     port_work,2     ;Set bit2
        goto    bit3_process1
p12_clear
        bcf     port_work,2     ;Clear bit2

 

bit3_process1
;****************** bit3 for process1 *******************
        btfss   led_data0,3     ;1x ?
        goto    p13_0x          ;No.
        btfss   led_data1,3     ;11 ?
        goto    p13_10          ;Jump to 10 process
        goto    p13_11          ;Jump to 11 process
p13_0x
        btfsc   led_data1,3     ;01 ?
        goto    p13_01          ;Jump to 01 process

 

p13_00
        goto    p13_set         ;LED off

 

p13_01
        btfss   led01,0         ;Data = 1 ?
        goto    p13_clear       ;No.
        goto    p13_set         ;Yes.

 

 



404
返回首頁 |  返回上一頁
牟定县| 白玉县| 武城县| 嘉峪关市| 南漳县| 徐汇区| 图木舒克市| 武安市| 盐源县| 西乌珠穆沁旗| 昌江| 历史| 吉首市| 定结县| 南岸区| 新竹市| 汕头市| 望江县| 昂仁县| 雅江县| 四会市| 和静县| 华蓥市| 南通市| 长子县| 晋宁县| 大港区| 马关县| 岗巴县| 潼南县| 昭觉县| 三台县| 辉南县| 天水市| 虞城县| 尚志市| 岳普湖县| 屯门区| 柳河县| 洛阳市| 右玉县|