天堂草原最受欢迎的角色,天堂动漫,天堂在线,色天堂下载,天堂中文在线资源,亚洲男人天堂

技術熱線: 4007-888-234
設計開發

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

開發工具

提供開發工具、應用測試 完善的開發代碼案例庫分享

技術支持

從全面的產品導入到強大技術支援服務 全程貼心伴隨服務,創造無限潛能!

新品推廣

提供新的芯片及解決方案,提升客戶產品競爭力

新聞中心

提供最新的單片機資訊,行業消息以及公司新聞動態

一款用F84做的測頻儀

更新時間: 2019-03-23
閱讀量:1735

十年專注單片機方案開發的方案公司英銳恩,分享一款用F84做的測頻儀。英銳恩現提供服務產品涉及主控芯片:8位單片機、16位單片機、32位單片機及各類運算放大器等。

;*******************************************************************
;
;        Frequency display
;        Crystal freq. 4.000MHz +/- a bit
;
;*******************************************************************
;
;        FM000.TXT Originally from FM3/4 9:39pm 14 May 2002
;        As implemented in experimental 3.5MHz receiver
;
;*******************************************************************
;
;        FM003        Fixed? major silliness in LO-IF code
;                Re-wrote USB/LSB suffix code
;                Added #defines for crook displays
;                Added #defines for two line displays
;                Wrapped #ifdef ... endif around debugging code
;
;*******************************************************************

;#define        testing                1        ; Comment out when testing finished

;#define        Bad_Display        1        ; Un-comment for "stop at 8" displays

;#define        Two_Line        1        ; Un-comment for two line displays

;*******************************************************************
;
;        CPU configuration
;        It's a 16F84, HS oscillator,
;        watchdog timer off, power-up timer on
;

        processor        16f84
        include               
        __config        _HS_OSC & _PWRTE_ON & _WDT_OFF


#define S_out        PORTA,0x00        ; 9600 baud serial out

#define        PUFF        PORTA,0x00        ; Future stabiliser
#define        HUFF        PORTA,0x01        ; Ditto.
#define        ENA        PORTA,0x02        ; Display "E"
#define        RS        PORTA,0x03        ; Display "RS"
#define PORTA4        PORTA,0x04        ; From LS393 divider chip

#define RESET        PORTB,0x01        ; Pin  7, Counter RESET
#define        UP_CNT        PORTB,0x02        ; Pin  8, Counter FLUSH
#define GATE        PORTB,0x03        ; Pin  9, Counter GATE
#define        Store        PORTB,0x04        ; Pin 10, 0 = Measure BFO
#define        Add_LO        PORTB,0x05        ; Pin 11, 0 = RF := LO + IF
                                ;         1 = RF := | LO + (-IF) |
#define        BFO_Lo        PORTB,0x06        ; Pin 12, 0 = BFO on lower freq.
#define        BFO_Hi        PORTB,0x07        ; Pin 13, 0 = BFO on higher freq.

#define        LOK_FLG        FLAGS,0x06
#define        Prg_FLG        FLAGS,0x05
#define        Ovr_Rng        FLAGS,0x04
#define        AMflag        FLAGS,0x03        ; 0 = Don't print USB/LSB suffix

#define BANKSEL        STATUS,RP0

#define        beq        bz                ; Motorola syntax branches
#define        BEQ        bz
#define        BNE        bnz
#define        bne        bnz

#define        BCC        bnc
#define        bcc        bnc
#define        BCS        bc
#define        bcs        bc

#define        BRA        goto
#define        bra        goto

;*******************************************************************
;
;        file register declarations: use only registers in bank0
;        bank 0 file registers begin at 0x0c in the 16F84
;
;*******************************************************************

        cblock 0x0c

        COUNT                        ; Bin to BCD convert (bit count)
        TEMP
        cnt                        ;                    (BCD BYTES)

        COUNT1                        ; Used by delay routines
                                ; and "prescaler flush"
        COUNT2                        ; Timing (100ms)

 COUNT3                        ; Timing (100ms)
        COUNT4                        ; Timing (400ms)


        CHR

        AccA:3                        ; Binary, MSB first
       
        AccB:3                        ; Intermediate frequency
       
        bcd:4                        ; BCD, MSD first 

 FLAGS

        SBflag                        ; 0 = Lower BFO frequency
                                ; 1 = Higher

        W_TEMP                        ; W saved here by ISR
        STATUS_TEMP                ; Status Register saved here by ISR
       
        dbg0:3                        ; Debugging stuff
        dbg1:3
        dbg2:3
        dbg3:3
        dbg4:3
        dbg5:3

        S_Wtemp                        ; "debug" Variables
        S_count
        D_Wtemp
        D_Stemp
        D_FSR
        D_hex
       
        endc

;**********************************************************
;
;        Begin Executable Stuff(tm)
;

        org        0

GO        clrwdt                        ; 0 << Reset
        call        InitIO                ; 1    INITIALISE PORTS

  CLRF        PORTA                ; 2
        goto        START                ; 3

INTRUPT        goto        ISR                ; 4 << Interrupt

;**********************************************************
;
;        Text Strings (stored in RETLWs)
;

mhz        dt        " MHz ",0
Spaces        dt        "   ",0
USB        dt        "USB",0
LSB        dt        "LSB",0
Prog        dt        "PRG",0

adv1        dt        "DFM 3.0 ",0
adv2        dt        "- VK3BHR",0

ovr1        dt        "   Over ",0
ovr2        dt        "Range   ",0

#ifdef        Two_Line

adv3        dt        "1234567890ABCDEF",0

endif


;**********************************************************
;
;        Main Program
;

START        CLRF        PORTB

#ifdef        testing
        bsf        PUFF
endif

        CALL        LCDINIT                 ; INITIALIZE LCD MODULE       

        MOVLW        adv1                ; Sign on
        call        pmsg

#ifdef        Bad_Display
        CALL        LINE2
endif

        movlw        adv2
        call        pmsg
       
        MOVLW        0x28                ; Delay for 4 sec.       
        CALL        DECI
        CALL        CLEAR

tx_1        decfsz        S_count,f        ; Done all bits?
        goto        put_clp

        movlw        0xE7                ; Delay for last data
txd_1        addlw        0x01
        bne        txd_1

        bsf        S_out                ; Transmit two stop bit

        movlw        0xCD
txd_9        addlw        0x01
        bne        txd_9
       
        return

endif

;********************************************************************
;        Tail End Charlie
;********************************************************************       
        END

联系我们: 漳浦县| 襄汾县| 永嘉县| 永定县| 海宁市| 罗江县| 绥芬河市| 新乡县| 桃园县| 杭锦旗| 湖南省| 呼伦贝尔市| 重庆市| 筠连县| 龙口市| 阿克苏市| 获嘉县| 太康县| 普宁市| 沧源| 洪江市| 富平县| 龙井市| 化州市| 彭州市| 防城港市| 正定县| 嘉定区| 张北县| 措勤县| 崇义县| 九龙县| 慈溪市| 巩义市| 微山县| 黄陵县| 达日县| 上栗县| 城口县| 永修县| 大邑县|