您当前的位置:五五电子网电子知识单片机-工控设备PIC单片机pic16f84 LED频率计 正文
pic16f84 LED频率计

pic16f84 LED频率计

点击数:7751 次   录入时间:03-04 11:38:25   整理:http://www.55dianzi.com   PIC单片机

Temp        equ        01Bh         ; temporary register
HIndex      equ        01Ch         ; index register
LEDIndex    equ        01Dh         ; LED pointer

;--------------------------------------------------------------------------

            include    <t1234led.inc>  ; timing loop values

;--------------------------------------------------------------------------

            org        0

Start       clrf       Index
            clrf       LEDIndex

            clrf       LED0
            clrf       LED1
            clrf       LED2
            clrf       LED3
            clrf       LED4
            clrf       LED5
            clrf       LED6
            clrf       LED7

            clrf       LowB
            clrf       MidB
            clrf       HigB

            bsf        STATUS,RP0

            MOVlw      b’00010000’ ; RA0..RA3 outputs
            MOVwf      TRISA       ; RA4 input

            MOVlw      b’00000000’ ; RB0..RB7 outputs
            MOVwf      TRISB

            clrwdt                 ;
            MOVlw      b’00100111’ ; Prescaler -> TMR0,
            MOVwf      OPTION_REG  ; 1:256, rising edge

            bcf        STATUS,RP0  ;

            goto       Go          ; line 370

;+-------------------------------------------------------------------------+
;| The bLOCk of subroutines and constants tables                           |
;+-------------------------------------------------------------------------+

;+-------------------------------------------------------------------------+
;| 3 byte substraction of the constant from the table, it sets carry       |
;| if result is negative                                                   |
;+-------------------------------------------------------------------------+

Subc24      clrf       Temp        ; it will temporary save CF
            MOVf       Index,W     ; pointer to low byte of constant
            MOVwf      HIndex      ; W -> HIndex
            call       DecTable    ; W returned with low byte of constant
            bsf        STATUS,C    ; set CF
            subwf      LowB,F      ; LowB - W -> LowB
                                   ; if underflow -> C=0
            btfsc      STATUS,C
            goto       Step1
            bsf        STATUS,C
            MOVlw      1
            subwf      MidB,F      ; decrement MidB
                                   ; if underflow -> C=0

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]  下一页


本文关键字:暂无联系方式PIC单片机单片机-工控设备 - PIC单片机