一乐电子

 找回密码
 请使用微信账号登录和注册会员

QQ登录

只需一步,快速开始

微信扫码登录

手机号码,快捷登录

手机号码,快捷登录

搜索
楼主: lichuang1005

转帖 [pic仪表]超级探头测试笔 数码之家38293312原创

  [复制链接]
发表于 2011-10-25 17:00 | 显示全部楼层
我有一片16F74能直接代用吗?
zhyzsn 发表于 2011-10-25 09:38 https://www.yleee.com.cn/images/common/back.gif


俺没仔细看过代码,16F87X比18F7X多了片内的eeprom,如果程序里没有使用到eeprom的话,应该重新选择MCU型号编译一次就行,但如果使用到eeprom的,那就要用87X才行
回复

使用道具 举报

发表于 2011-10-25 17:21 | 显示全部楼层
不错呀,有套件吗?
回复

使用道具 举报

 楼主| 发表于 2011-10-25 19:30 | 显示全部楼层
回复 12# zxmb


   没有 西班牙人的网站上有源代码 汇编格式的
回复

使用道具 举报

 楼主| 发表于 2011-10-25 19:39 | 显示全部楼层
回复 7# fat


    西班牙人的网站上有源代码 汇编格式的 能直接移植吗 16f913能行么 16f913管脚.JPG
回复

使用道具 举报

发表于 2011-10-25 21:42 | 显示全部楼层
汇编的程序要移植到913可能要改的地方不少,主要是9xx比7X/87x好象添了功能,因此SFR了多了。
回复

使用道具 举报

 楼主| 发表于 2011-10-25 22:59 | 显示全部楼层
回复 15# fat


    呵呵 要不就让913直接驱动LCD 做电压电流表头吧
回复

使用道具 举报

 楼主| 发表于 2011-10-25 23:04 | 显示全部楼层
回复 15# fat


    呵呵 要不就让913直接驱动LCD 做电压电流表头吧  913有16段lcd直接驱动 5路10bitA/D  4Kflash    sram:256  eeprom:256
913.JPG
回复

使用道具 举报

发表于 2011-10-26 01:46 | 显示全部楼层
回复  fat


    呵呵 要不就让913直接驱动LCD 做电压电流表头吧  913有16段lcd直接驱动 5路10bitA/D   ...
lichuang1005 发表于 2011-10-25 23:04 https://www.yleee.com.cn/images/common/back.gif



    913不便宜啊,而且笔段的裸屏也不好找
回复

使用道具 举报

发表于 2011-10-26 06:04 | 显示全部楼层
要是将电压档增加50。500,并增加输入阻抗,交直流,同时增加测电阻功能,那真是比万用表更强
回复

使用道具 举报

发表于 2011-10-26 06:20 | 显示全部楼层
本帖最后由 zydl123 于 2011-10-26 06:22 编辑

wwwwwwww.txt (31.96 KB, 下载次数: 295)
CT的旧帖我没保存哦,不过原创站我有收藏,,顺手转过来吧,大家看起来方便点

In any mode, holding ...
fat 发表于 2011-10-24 22:04 https://www.yleee.com.cn/images/common/back.gif



    有原码呀;;

        Super Probe - Maximum Functions from Minimum Parts;;        Current Functions;        -----------------;        Logic Probe;        Voltmeter;        Frequency Counter;        Event Counter;        Capacitor Test;        Signal Generator;        Diode Tester;        Logic Pulser;        Serial Generator (4 rates);        Midi Generator;        r/c servo pulse;        Square Wave;        20khz digital noise;        38KHz burst;; 29        added r/c square noise burst baudrates; 29        added memu forward/back; 30        added pwm function; 31        reworked square wave for interrupt operation; 32        fix logic probe function; 33        (compatability with new assembler); 34        fix dpcap syntax for hex values - last 2; 35        add inductance measure        list      p=16f870             ; list directive to define processor        #include <p16f870.inc>         ; processor specific variable definitions        errorlevel -302                ; Register not in bank 0 warning        radix dec        __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _LVP_OFF & _DEBUG_OFF & _CPD_OFF#define VERS                 035#define LPTIME                 42990           ;calibration time for counter#define MAXMODE                 17                ;total operational modes#define CLAMP                 PORTA,5                ;clamp input to T0#define R20                 PORTA,0                ;20 ohm direct feed#define R100                 PORTA,1                ;100 ohms#define R470                 PORTA,4                ;470 ohms#define R150                 PORTA,2                ;150#define R10K                 PORTC,7                ;10k#define R10KA                 PORTC,6                ;10k#define R100K                 PORTA,3                ;100k feed to input#define BLACK                 R150#define WHITE                 R100#define SOUT                 R20#define BUT1                 PORTC,4                ;button 1#define BUT2                 PORTC,5                ;button 2        org        20hwsave        equ        20Hssave        equ        21Hicount        equ        22Hflag        equ        23Hcount        equ        24Hscount        equ        25Hcsave        equ        26Hddata        equ        27H            ; was datasdata        equ        28Htemp        equ        29Hontime        equ        2BHoftime        equ        2CHisrvec        equ        2DHqtime        equ        2EH                ;comm timer for serialtimer        equ        30Hfreq        equ        33H                ;pwmp        equ        35Hmode        equ        36Hrate        equ        37Hbaud        equ        38Hmidic        equ        39H                ;midi channelpmode        equ        3AHhi        equ        3BHlo        equ        3CH             ; was lowrand        equ        3DHacc        equ        40H                ;32 bit registerxacc        equ        44H                ;aux 32 bit valuedigits        equ        48H                ;segment data for LEDdignr        equ        4CHdp        equ        4DHftimer        equ         4EHsegmask        equ        50Hdela        equ        51Hbcd        equ        54H                ;10 digit bcd bufferpto        equ        59Hpti        equ        5AHcnt        equ        5BHii        equ        5CHframe        equ        5DH#define HOLD                flag,0#define DIR                flag,1#define SAVE                flag,2#define RUN                flag,3#define SWIT                flag,4        org        0        goto        start        org        4isr        movwf        wsave        swapf        STATUS,w        movwf        ssave        clrf        STATUS        movf        isrvec,w        addwf        PCL,f        goto        pwmi        goto        sqriisrx        swapf        ssave,w        movwf        STATUS        swapf        wsave,f        swapf        wsave,w        retfie digseg        addwf        PCL,f        retlw        3fh        retlw   6h        retlw   5bh        retlw   4fh        retlw   66h        retlw   6dh        retlw   7dh        retlw   7h        retlw   7fh        retlw   67hgetano        addwf        PCL,f        retlw        1        retlw        2        retlw        4        retlw        8;        bit 7        decimal point;        bit 6        flash decimal;        bit 5,4        dp location;        bit 3-0        starting digit from bcd buffergetdp        addwf        PCL,f        retlw        03h        retlw        03h        retlw        03h        retlw        03h        retlw        94h        retlw        0A5h        retlw        0C6h        retlw        0D7h        retlw        0E8h        retlw        0F9hdpcap        addwf        PCL,f        retlw        01h        retlw        01h        retlw        84h        retlw        84h        retlw        84h        retlw        95h        retlw        0A6h        retlw        0B7h        retlw        0C8h        retlw        0D9hdpuls        addwf        PCL,f        retlw        170        retlw        55        retlw        17        retlw        5srq        movf        temp,w        incf        temp,f        addwf        PCL,f        retlw        low 1380                ;1200        retlw        high 1380               ;1200        retlw        low 680                 ;2400        retlw        high 680                ;2400        retlw        low 330                 ;4800        retlw        high 330                ;4800        retlw        low 160                        ;9600        retlw        high 160                ;9600modes        movf        temp,w        incf        temp,f        addwf        PCL,fvbase        retlw        73h                     ;Prob        retlw        50h                        ;Prob        retlw        5ch                        ;Prob        retlw        7ch                        ;Prob        retlw        73h                     ;PULS        retlw        3eh                        ;PULS        retlw        38h                        ;PULS        retlw        6dh                        ;PULS        retlw        3eh                     ;VoLt        retlw        5ch                        ;VoLt        retlw        38h                        ;VoLt        retlw        78h                     ;VoLt        retlw        05eh                    ;diod        retlw        4                        ;diod        retlw        5ch                     ;diod        retlw        05eh                        ;diod        retlw        71h                     ;FrEq        retlw        50h                        ;FrEq        retlw        79h                        ;FrEq        retlw        6fh                     ;FrEq        retlw        0                       ; Cnt        retlw        39h                        ; Cnt        retlw        54h                     ; Cnt        retlw        78h                        ; Cnt        retlw        0                       ; CAP        retlw        39h                        ; CAP        retlw        77h                        ; CAP        retlw        73h                        ; CAP        retlw        39h                     ;CoiL        retlw        5ch                        ;CoiL        retlw        4                        ;CoiL        retlw        38h                        ;CoiL        retlw        0                       ; SIG        retlw        6dh                     ; SIG        retlw        6                        ; SIG        retlw        3dh                        ; SIG        retlw        54h                     ;ntSC        retlw        78h                        ;ntSC        retlw        6dh                     ;ntSC        retlw        39h                        ;ntSC        retlw        00h                     ; SEr        retlw        6dh                        ; SEr        retlw        79h                        ; SEr        retlw        50h                        ; SEr        retlw        15h                     ;Midi        retlw        4                        ;Midi        retlw        5eh                        ;Midi        retlw        4                        ;Midi        retlw        21h                     ;r/c        retlw        52h                        ;r/c        retlw        58h                        ;r/c        retlw        0                        ;r/c        retlw        39h                     ;[]        retlw        0fh                        ;[]        retlw        00h                        ;[]        retlw        0                        ;[]        retlw        73h                     ;Prn        retlw        50h                        ;Prn        retlw        54h                        ;Prn        retlw        0                        ;Prn        retlw        04h                     ;ir38        retlw        50h                        ;ir38        retlw        4fh                        ;ir38        retlw        7fh                        ;ir38        retlw        73h                     ;PWm        retlw        2ah                        ;PWm        retlw        15h                        ;PWm        retlw        0                        ;PWmvpuls        retlw        0                       ;   5        retlw        0                        ;   5        retlw        0                        ;   5        retlw        6dh                        ;   5        retlw        0                       ;  50        retlw        0                        ;  50        retlw        6dh                        ;  50        retlw        3fh                     ;  50        retlw        0                       ; 500        retlw        6dh                        ; 500        retlw        3fh                        ; 500        retlw        3fh                        ; 500        retlw        0                       ; 5.0        retlw        0                        ; 5.0        retlw        0edh                        ; 5.0        retlw        3fh                        ; 5.0vbaud        retlw        06h                     ;1200        retlw        5bh                        ;1200        retlw        3fh                        ;1200        retlw        3fh                        ;1200        retlw        5bh                     ;2400        retlw        66h                        ;2400        retlw        3fh                        ;2400        retlw        3fh                        ;2400        retlw        66h                     ;4800        retlw        7fh                        ;4800        retlw        3fh                        ;4800        retlw        3fh                        ;4800        retlw        67h                     ;9600        retlw        7dh                        ;9600        retlw        3fh                     ;9600        retlw        3fh                        ;9600; execute routine as selected from menuexec        movf        mode,w        addwf        PCL,f        goto        lp1                ;logic probe        goto        pulse                ;logic pulser        goto        volt                ;voltmeter        goto        diode                ;doide voltage        goto        fcount                ;frequency count        goto        dcount                ;event count        goto        cap                ;cap meter        goto        induct                ;inducance meter        goto        sig                ;signal generator        goto        vgen                ;video generator        goto        s9600                ;serial out        goto        midi                ;midi out        goto        radcon                ;servo pulse        goto        square                ;square wave        goto        noise                ;digital noise        goto        ir38                ;38 khz test signal        goto        pwm                ;variable pulse widthstart        bsf        STATUS,5        movlw        b'00111111'        movwf        TRISA        movlw        0        movwf        TRISB        movlw        b'10110000'        movwf        TRISC        movlw        b'10001000'        movwf        OPTION_REG        bcf        STATUS,5        movlw        4        movwf        T2CON        clrf        segmask        bsf        segmask,0        clrf        dignr        call        getset                ;restore current mode        call        signon        movlw        low 1000        movwf        freq        movlw        high 1000        movwf        freq+1        movlw        48        movwf        pwmp; menu selection of operational modescycmode        call        putset                ;save all parameterscycle        bcf        INTCON,GIE        movf        mode,w        call        setmode                ;load segment menu datac2        call        segout                ;run display        movlw        10        call        delay        btfsc        BUT1                ;still held down?        goto        c4                ;no        btfss        BUT2        goto        c2c5        call        segout        movlw        10        call        delay        btfsc        BUT1        goto        doexec        btfsc        BUT2        goto        c5        decf        mode,f        movlw        MAXMODE-1        btfsc        mode,7                ;underflow?        movwf        mode        goto        cyclec4        call        segout        movlw        10        call        delay        btfsc        BUT2        goto        doexec                ;both buttons up - execute        btfsc        BUT1        goto        c4        incf        mode,f        movf        mode,w        xorlw        MAXMODE        btfsc        STATUS,Z        clrf        mode        goto        cycledoexec        call        putset                ;first, save op mode        call        clreg        goto        execclreg        bsf        STATUS,RP0                ;then clear all lines        bsf        R20        bsf        R100        bsf        R470        bsf        R150        bsf        R10K        bsf        R10KA        bsf        R100K        bsf        CLAMP        movlw        6        movwf        ADCON1        bcf        STATUS,RP0        return; save current setup in eepromputopt        btfss        SAVE                ;flagged for save?        return                        ;no.        bcf        SAVE                ;yes.putset        clrf        hi        clrf        lo        movf        mode,w        call        eewrite                ;save current mode in eeprom        incf        lo,f        movf        pmode,w        call        eewrite        incf        lo,f        movf        midic,w        call        eewrite        incf        lo,f        movf        baud,w        call        eewrite        return; get op mode from eepromgetset        clrf        hi        clrf        lo        call        eeread        movwf        mode        movf        mode,w        addlw        -MAXMODE        btfsc        STATUS,C        clrf        mode                ;restore        incf        lo,f                ;next location        call        eeread        movwf        pmode                ;pulse mode        movf        pmode,w        addlw        -4        btfsc        STATUS,C        clrf        pmode        incf        lo,f        call        eeread        movwf        midic        addlw        -15        btfsc        STATUS,C        clrf        midic        incf        lo,f                ;next location        call        eeread        movwf        baud                ;pulse mode        movf        baud,w        addlw        -4        btfsc        STATUS,C        clrf        baud        return; put mode text on 4 char displaysetmode        movwf        temp        bcf        STATUS,C        rlf        temp,f        rlf        temp,f        call        modes        movwf        digits        call        modes        movwf        digits+1        call        modes        movwf        digits+2        call        modes        movwf        digits+3        return; show version nr and op mode at startupsignon        movlw        VERS        call        wtod                ;put version nr        movlw        0                ;blank.        movwf        digits        call        sign        movf        mode,w        call        setmode        call        sign        return; run display slow for flashing effectsign        clrf        countx1        call        segout        movlw        15        call        delay        decfsz        count,f        goto        x1        return; PWM interrupt handlerpwmi        bcf        INTCON,T0IF        btfss        SWIT        goto        on        bcf        SWIToff        bcf        R20        movf        oftime,w        movwf        TMR0        goto        isrxon        bsf        SWIT        bsf        R20        movf        ontime,w        movwf        TMR0        goto        isrx; PWM control routinepwm        bsf        STATUS,RP0        bcf        R20        movlw        b'10000010'        ;/32 TMR0        movwf        OPTION_REG        bcf        STATUS,RP0        movlw        0        movwf        isrvec                ;set interrupt re-vector        bsf        INTCON,T0IE        bsf        INTCON,GIEp2        movf        pwmp,w        addlw        2        call        wtod        movf        pwmp,w        sublw        0        movwf        ontime        movf        pwmp,w        sublw        96        sublw        0        movwf        oftimep4        movlw        10        call        delay        call        segout        movlw        10        call        delay        call        segout        decfsz        timer,f        goto        p4        movlw        25        movwf        timerp3        movlw        5        call        delay        call        segout        btfss        BUT1        goto        dn        btfss        BUT2        goto        up        clrf        timer        goto        p3dn        btfss        BUT2        goto        cycle        decfsz        pwmp,f        decf        pwmp,f        incf        pwmp,f        goto        p2up        btfss        BUT1        goto        cycle        incf        pwmp,f        movf        pwmp,w        xorlw        96        btfsc        STATUS,Z        decf        pwmp,f        goto        p2ir38        bsf        STATUS,RP0        bcf        R20        bcf        STATUS,RP0ir2        call        brst        movlw        5        movwf        countir4        call        segout        movlw        9        call        delay        decfsz        count,f        goto        ir4        call        segoff        btfsc        BUT1        goto        ir2        btfsc        BUT2        goto        ir2        goto        cyclebrst        movlw        38        movwf        countb2        bsf        R20        movlw        20        movwf        delab3        decfsz        dela,f        goto        b3        nop        nop        nop        bcf        R20        movlw        20        movwf        delab5        decfsz        dela,f        goto        b5        nop        decfsz        count,f        goto        b2        return;--------------------------------------------------------; 20 khz digital noise @20Mhznoise        bsf        STATUS,RP0        bcf        R20        bcf        STATUS,RP0        movlw        55h        movwf        randn2        call        pseudo        btfsc        rand,0        bsf        R20        btfss        rand,0        bcf        R20        call        segout        movlw        65        movwf        delan4        decfsz        dela,f        goto        n4        btfsc        BUT2        goto        n2        btfsc        BUT1        goto        n2        goto        cyclepseudo        movf        rand,w        addwf        rand+1,w        movwf        rand+1        addwf        rand+2,w        movwf        rand+2        bcf        STATUS,C        ;do 8 bit rotate        rrf        rand,f        btfsc        STATUS,C        bsf        rand,7        addwf        rand,f        return; pulse width generation @20Mhzradcon        bsf        STATUS,RP0        bcf        R20        bcf        STATUS,RP0        movlw        low 1500        movwf        timer        movlw        high 1500        movwf        timer+1rc1        movf        timer,w        movwf        acc        movf        timer+1,w        movwf        acc+1        clrf        acc+2        clrf        acc+3        call        b2bcd        call        formatrc2        movlw        50        movwf        countrc3        call        segout        movlw        10        call        delay        decfsz        count,f        goto        rc3        movf        timer,w        movwf        lo        movf        timer+1,w        movwf        hi        call        segoff        call        rcpls        btfss        BUT1        goto        rcdn        btfss        BUT2        goto        rcup        goto        rc2rcup        btfss        BUT1        goto        cyclercup2        movlw        10        addwf        timer,f        btfsc        STATUS,C        incf        timer+1,f        movf        timer+1,w        xorlw        9        btfsc        STATUS,Z        goto        rcdn2        goto        rc1rcdn        btfss        BUT2        goto        cyclercdn2        movlw        -10        addwf        timer,f        btfss        STATUS,C        decf        timer+1,f        movf        timer+1,w        xorlw        2        btfsc        STATUS,Z        goto        rcup2        goto        rc1rcpls        incf        hi,f        incf        lo,f        bsf        R20rc4        nop        noprc5        decfsz        lo,f        goto        rc4        decfsz        hi,f        goto        rc5        bcf        R20        return; Square wave interrupt handlersqri        bcf        INTCON,T0IF        movf        freq,w        addwf        timer,f        movf        freq+1,w        btfsc        STATUS,C        incfsz        freq+1,w        addwf        timer+1,f        btfss        timer+1,7        bcf        R20        btfsc        timer+1,7        bsf        R20        movlw        -73        addwf        TMR0,f        goto        isrx; linear squarewave generation @20Mhzsquare        bsf        STATUS,RP0        bcf        R20        movlw        b'10001000'        movwf        OPTION_REG        ;/32 clock        bcf        STATUS,RP0        movlw        1        movwf        isrvec        bsf        INTCON,GIE        bsf        INTCON,T0IE        ;timer-0 interrupt onsqhl        movf        freq,w        movwf        acc        movf        freq+1,w        movwf        acc+1        clrf        acc+2        clrf        acc+3        call        b2bcd        call        formatsq2        movf        rate,w        movwf        countsqs1        call        segout        movlw        10        call        delay        decfsz        count,f        goto        sqs1        movlw        -5        addwf        rate,f        movf        rate,w        addlw        -5        btfsc        STATUS,C        goto        sq4        movlw        6        movwf        ratesq4        btfss        BUT1        goto        sqdn        btfss        BUT2        goto        squp        clrf        rate        goto        sq2squp        btfss        BUT1        goto        cycle        incf        freq,f        btfsc        STATUS,Z        incf        freq+1,f        goto        sqhlsqdn        btfss        BUT2        goto        cycle        movlw        -1        addwf        freq,f        btfss        STATUS,C        decf        freq+1,f        btfss        freq+1,7        goto        sqhl        clrf        freq        clrf        freq+1        goto        sqhl; logic pulserpulse        bsf        STATUS,RP0        movlw        6        movwf        ADCON1                ;all digital on ra        bcf        STATUS,RP0ppp2        movf        pmode,w                ;get pulse mode        addlw        (vpuls-vbase)/4        ;NOTE: = (vpuls-vbase)/4 in this assember        call        setmode        movf        pmode,w                ;now, get delay factor        call        dpuls        movwf        timer        goto        ppp3ppp5        bsf        STATUS,RP0        bcf        R20                ;activate pulse        nop        bsf        R20                ;end of pulse        bcf        STATUS,RP0        bsf        digits,6        ;show pulse is active        goto        ppp8ppp3        bsf        R20                ;set latch to low.        btfsc        R470                ;which way to pulse?        bcf        R20                ;then set latch to high.        movlw        8                ;low level detected?        btfsc        R20        movlw        1                ;no - show high        movwf        digits                ;in 1st displayppp8        movf        timer,w        call        delsq                ;delay w/display        movlw        2        call        delsq                ;adjust for hi end error        btfsc        BUT1        goto        ppp4                ;no button 1.        btfsc        BUT2        goto        ppp5                ;but 1 only - do pulses        goto        cycmode                ;exit to menu.ppp4        btfsc        BUT2                ;only button 2 ?        goto        ppp3                ;no - set pulse directionppp4x        movlw        10        call        delay        call        blank        call        segout        btfss        BUT1                ;exit?        goto        cycmode                ;yes - and save params        btfss        BUT2        goto        ppp4x        incf        pmode,f        movf        pmode,w        sublw        3        btfss        STATUS,C        clrf        pmode        goto        ppp2; signal generator (0.5 v square wave)sig        bsf        STATUS,RP0        bcf        R10K                ;engage 10k resistor        bcf        R100K                ;engage 100k resistor        movlw        6        movwf        ADCON1                ;all digital on ra        bcf        STATUS,RP0        bcf        R10K                ;10k pull to ground        bcf        R100K                ;100k for signal gen        clrf        digits        movlw        5        call        digseg        movwf        digits+1        movlw        0        call        digseg        movwf        digits+2        movwf        digits+3sis3        btfss        timer,6        bsf        digits,6        bsf        R100K        call        sis8sis4        incf        timer,f        btfsc        timer,6        bcf        digits,6        bcf        R100K        call        sis8        btfsc        BUT1        goto        sis4        btfsc        BUT2        goto        sis3        goto        cyclesis8        movlw        32        movwf        countsis9        call        segout                ;run diplay        movlw        14        call        short        decfsz        count,f        goto        sis9        return; do short delaysshort        movwf        delashs2        nop        nop        nop        nop        nop        decfsz        dela,f        goto        shs2        return; measure capacitor from tip to gound leadcap        bsf        STATUS,RP0        bcf        R100K                ;enable 100k resistor        bcf        STATUS,RP0        bsf        R100K                ;pull up resitor        bcf        R20                ;pull down for clamp        bsf        HOLD                ;default hold conditioncac2        call        segoff        clrf        acc                ;clear accum        clrf        acc+1        clrf        acc+2        clrf        acc+3        bsf        STATUS,RP0        bsf        R20                ;release clamp        bcf        STATUS,RP0        nop        nop                        ;compensate        nop                        ;for stray        nop                        ;capacitance        nop        nopcac7        nop                        ;tune loop with nop's        nop        nop        nop        nop        nop        nop        nop        nop        btfsc        R20                ;check direct (a/d) input        goto        cahit        incfsz        acc,f        goto        cac7        incfsz        acc+1,f        goto        cac7        incfsz        acc+2,f        goto        cac7        incfsz        acc+3,f        goto        cac7cahit        bsf        STATUS,RP0        bcf        R20                ;discharge cap        bcf        STATUS,RP0        call        b2bcd        call        cform                ;format for capscac6        call        show2        btfsc        BUT1        goto        cac6                ;no button - hold reading        btfsc        BUT2        goto        cac2                ;but1 only - do reading        goto        cycle; measure inductor from tip to gound leadinduct        bsf        STATUS,RP0        bcf        R100                ;enable 470 ohm resistor        bcf        STATUS,RP0        bcf        R100                ;pull up resitor        bsf        HOLD                ;default hold conditioninc2        call        segoff        movlw        80        call        delay        clrf        acc                ;clear accum        clrf        acc+1        clrf        acc+2        clrf        acc+3        bsf        R100                ;start voltageinc7        btfss        R20                ;check direct (a/d) input        goto        inhit        incfsz        acc,f        goto        inc7        incfsz        acc+1,f        goto        inc7        incfsz        acc+2,f        goto        inc7        incfsz        acc+3,f        goto        inc7inhit        bcf        R100        call        b2bcd        movlw        3        call        xform        bsf        digits+2,7inc6        call        show2        btfsc        BUT1        goto        inc6                ;no button - hold reading        btfsc        BUT2        goto        inc2                ;but1 only - do reading        goto        cycle; turn off all digitssegoff        bcf        PORTC,0        bcf        PORTC,1        bcf        PORTC,2        bcf        PORTC,3        return; Logic probe function; show Low, High, and Float w/ Pulse detectionlp1        bsf        STATUS,RP0        bcf        R10K                ;turn on voltage feed        bcf        R10KA                ;turn on other feed        movlw        b'10101000'        ;no prescale on TMR0        movwf        OPTION_REG        movlw        0Eh                ;ana0 on, left justify        movwf        ADCON1        bcf        STATUS,RP0        bsf        R10K                ;10k pull up        bcf        R10KA                ;10k pull down        movlw        81h                ;read a/d on RA.0        movwf        ADCON0        clrf        dp                ;no decimal        movlw        0ffh        movwf        TMR0                ;set for single count overflowlpx1        btfsc        BUT1        goto        lpx2        btfsc        BUT2        goto        lpx2        goto        cyclelpx2        call        atod                ;read the input        movf        hi,w                ;8 bit value        sublw        40                ;low enough for low?        btfsc        STATUS,C        goto        lplow        movf        hi,w        sublw        180        btfss        STATUS,C        goto        lphilpflo        movlw        40h                ;'-'        goto        lphllphi        movlw        76h                ;'H'        goto        lphllplow        movlw        38h                ;'L'lphl        call        letter        btfss        INTCON,T0IF                ;counter overflow?        goto        lpno        bcf        INTCON,T0IF        movlw        0ffh        movwf        TMR0                ;set for next time        clrf        timer        movlw        73h                ;'P'        movwf        digits+1        ;show pulse detectedlpno        call        show1        incf        timer,f        movf        timer,f        btfsc        STATUS,Z        clrf        digits+1        ;always flash off        goto        lpx1; run display for a short timeshow2        clrf        count        goto        shos2show1        clrf        count        bsf        count,7        goto        shos2show        clrf        count        bsf        count,6shos2        call        segout                ;show digits        call        flash                ;add dp        movlw        10        call        delay        decfsz        count,f        goto        shos2        return; show one character and blank other 3letter        movwf        digits        goto        blnk2blank        clrf        digitsblnk2        clrf        digits+1        clrf        digits+2        clrf        digits+3        return; show 8 bit value on displaywtod        movwf        acc        clrf        acc+1        clrf        acc+2        clrf        acc+3        call        b2bcd        call        format        return; measure diode drops; same as voltmeter but with 5v feed to probediode        bsf        STATUS,RP0        bcf        R10K                ;enable feed resistor        goto        vdx                ;otherwise, like voltmeter; voltmeter function, 0-5 voltsvolt        bsf        STATUS,RP0vdx        movlw        8Eh                ;enable ra.0 analog right justify        movwf        ADCON1        bcf        STATUS,RP0        bsf        R10K                ;only used for 'diode' mode.        movlw        81h                ;select ana0 and enable a/d        movwf        ADCON0vov2        call        atod                ;get 10 bits        bcf        STATUS,C        rrf        hi,f        rrf        lo,f                ;scale to 9 bits        movf        lo,w        movwf        acc        movf        hi,w        movwf        acc+1        clrf        acc+2        clrf        acc+3        call        b2bcd        call        format        bsf        digits+1,7        movlw        200        movwf        countvov4        call        segout        movlw        10        call        delay        decfsz        count,f        goto        vov4        btfsc        BUT1        goto        vov2        btfsc        BUT2        goto        vov2        goto        cycle; read 16 bit a/d value in hi/lowatod        bsf        ADCON0,2        nop        nopadchk        btfsc        ADCON0,2        ;check for conversion complete        goto        adchk        bsf        STATUS,RP0        movf        ADRESL,w        bcf        STATUS,RP0        movwf        lo        movf        ADRESH,w        movwf        hi        return; count events using TMR0 directlydcount        bsf        STATUS,RP0        bsf        CLAMP                ;disable clamp        bcf        R10K                ;use 10k only        bsf        R150                ;disconect other 10k        bsf        R100K                ;no 100k feed        bsf        R20                ;float direct resistor        movlw        b'10101000'        ;no prescale on TMR0        movwf        OPTION_REG        movlw        6        movwf        ADCON1                ;all ra is digital        bcf        STATUS,RP0        bsf        R10K                ;use 10k pullupdcic2        clrf        TMR0                ;clear hardware timer        clrf        xacc                ;clear 32bit count        clrf        xacc+1        clrf        xacc+2        clrf        xacc+3dcic3        call        xfer        call        b2bcd        movlw        3dcic5        call        xform                ;show low 4 digits        call        segout                ;run display        call        icup                ;update counter        btfss        BUT1                ;button 1 ?        goto        dcic9                ;no - continue        btfss        BUT2        goto        dcic2                ;reset counting.        goto        dcic3                ;continue count.dcic9        btfss        BUT2                ;both buttons?        goto        cycle                ;yes - exit.        call        xfer        call        b2bcd        movlw        7        goto        dcic5; update 32bit count from hardware timericup        movf        TMR0,w                ;hardware counter to accum        movwf        xacc        btfss        INTCON,T0IF        ;overflow        return                        ;not yet.        bcf        INTCON,T0IF        incfsz        xacc+1,f        return        incfsz        xacc+2,f        return        incf        xacc+3,f        return; move aux count to accumxfer        movf        xacc,w        movwf        acc        movf        xacc+1,w        movwf        acc+1        movf        xacc+2,w        movwf        acc+2        movf        xacc+3,w        movwf        acc+3        return; measure frequency using TMR0 with 8-bit prescalefcount        bsf        STATUS,RP0        bsf        CLAMP        bsf        R10K                ;no extra voltage        bsf        R150                ;disconect other 10k        bcf        R100K                ;use 100k pulldown        bsf        R20                ;float direct resistor        movlw        b'10100111'        ;256 count prescaler        movwf        OPTION_REG        movlw        6        movwf        ADCON1                ;all ra is digital        bcf        STATUS,RP0        bcf        R150                ;pull down lightly        clrf        acc        clrf        acc+1        clrf        acc+2        clrf        acc+3fcf2        call        b2bcd        call        format        btfsc        BUT1        goto        fcf4fcf7        btfss        BUT2                ;both buttons?        goto        cyclefcfx        movlw        3        call        xformfcf4        call        cnton        call        onesec        call        cntoff        goto        fcf2; clear 32bit count and turn on TMR0cnton        bcf        CLAMP        clrf        TMR0                ;clear timer and prescale        clrf        acc        clrf        acc+1        clrf        acc+2        clrf        acc+3        bsf        STATUS,RP0        bsf        CLAMP                ;tristate the clamp        bcf        STATUS,RP0        return; turn off counter and pulse input to read out prescalecntoff        bcf        CLAMP        bsf        STATUS,RP0        bcf        CLAMP        bcf        STATUS,RP0        movf        TMR0,w        movwf        acc+1        clrf        acccnc2        decf        acc,f        bsf        CLAMP        bcf        CLAMP        movf        TMR0,w        xorwf        acc+1,w        btfsc        STATUS,Z        goto        cnc2        return;---------------------------------------------------------; add decimal point to displayflash        swapf        dp,w        andlw        3                ;bits 5,4 = digit nr.        addlw        digits        movwf        FSR        btfsc        dp,7                ;decimal used?        bsf        0,7                ;light decimal point        incf        ftimer,f        btfsc        STATUS,Z        incf        ftimer+1,f        btfss        ftimer+1,5        goto        fno        btfsc        dp,6                ;flash mode?        bcf        0,7                ;flash back off        returnfno        nop        return; open count gate for exactly 1.000000 secondonesec        movlw        low LPTIME        movwf        timer        movlw        high LPTIME        movwf        timer+1osx1        nop                        ;100 cycle loop count        noposx2        call        ffill                ;time filler        call        segout                ;show last data        call        flash                ;include decimal        call        dotime                ;check for TMR0 overflow        decfsz        timer,f        goto        osx1        decfsz        timer+1,f        goto        osx2        movlw        8        movwf        timerosx5        call        dotime        decfsz        timer,f        goto        osx5        return; just kill some timeffill        movlw        16        movwf        tempfif2        decfsz        temp,f        goto        fif2        nop        nop        return; check for TMR0 rollover; (constant execution times)dotime        btfss        INTCON,T0IF        ;overflow?        goto        dno        bcf        INTCON,T0IF        ;clear the flag        incf        acc+2,f                ;increment next byte        btfsc        STATUS,Z        incf        acc+3,f                ;and next on rollover        returndno        nop        nop        nop        return; squared delay functiondelsq        movwf        dela+1        movwf        dela+2dlsd1        movf        dela+2,w        movwf        deladlsd0        call        segout        decfsz        dela,f        goto        dlsd0        decfsz        dela+1,f        goto        dlsd1        return; qubic delay functiondelay        movwf        dela+2dld2        movwf        dela+1dld1        movwf        deladld0        decfsz        dela,f        goto        dld0        decfsz        dela+1,f        goto        dld1        decfsz        dela+2,f        goto        dld2        return; format used for capacitor measurements; each count = 100pfcform        call        first        movf        count,w                ;1st non zero        call        dpcap        movwf        dp        andlw        0fh                ;where to start        movwf        count        goto        ff5; *****        video pattern generation *****vgen        bsf        STATUS,RP0        bcf        BLACK        bcf        WHITE        bcf        R100        bcf        STATUS,RP0        bcf        R100        bcf        PORTC,2        bcf        PORTC,3        movlw        0BFh        movwf        PORTBvgv2        call        vsync        movlw        40        movwf        countvc1        nop        call        bline        decfsz        count,f        goto        vc1        movlw        15        movwf        countvc2        call        dline        call        dline4        call        dline4        call        bline4        call        bline4        call        bline4        call        bline4        call        bline4        call        bline4        call        bline4        call        bline4        call        bline4        call        bline4        nop        decfsz        count,f        goto        vc2        movlw        17        movwf        countvc3        call        bline        nop        decfsz        count,f        goto        vc3        call        zline4        btfsc        BUT2        goto        vgv2        goto        cyclevsync        movlw        6        movwf        countvv2        bcf        BLACK        call        dla10        bsf        BLACK        movlw        46        call        vdela        decfsz        count,f        goto        vv2        movlw        6        movwf        countvv3        bcf        BLACK        movlw        46        call        vdela        bsf        BLACK        call        dla8        decfsz        count,f        goto        vv3        movlw        6        movwf        countvv4        bcf        BLACK        call        dla10        bsf        BLACK        movlw        46        call        vdela        decfsz        count,f        goto        vv4        returnzline4        call        dla4zline        bcf        BLACK                ;start h-sync        call        dla16        call        dla7        bsf        BLACK        call        vseg        movlw        89        call        vdela        nop        returnbline4        call        dla4bline        bcf        BLACK                ;start h-sync        call        dla16        call        dla7        bsf        BLACK        movlw        93        call        vdela        nop        returndline4        call        dla4dline        bcf        BLACK                ;start h-sync        call        dla16        call        dla7        bsf        BLACK        call        dla18        call        dla18        movlw        19        movwf        tempbd2        nop        nop        nop        nop        nop        nop        bsf        WHITE        nop        bcf        WHITE        decfsz        temp,f        goto        bd2        movlw        5        call        vdela        return; delay in processor cycles (includes call/return)dla18        nopdla17        nopdla16        nopdla15        nopdla14        nopdla13        nopdla12        nopdla11        nopdla10        nopdla9        nopdla8        nopdla7        nopdla6        nopdla5        nopdla4        returnvdela        movwf        tempvd2        decfsz        temp,f        goto        vd2        return; light alternate digits (12 ct)vseg        incf        frame,f                ;count frames        bcf        PORTC,0        bcf        PORTC,1        btfss        frame,0        bsf        PORTC,0        btfsc        frame,0        bsf        PORTC,1        nop        return; ****        end video gen *****; turn off displaysclear        movlw        0F0h        andwf        PORTC,f        return; cycle thru individual segment drives on 4 digits; (constant execution time: 30 instructions); ************** Do Not Modify *******************segout        movlw        0F0h        andwf        PORTC,f                ;clear low 4 bits        movf        dignr,w                ;get digit nr        addlw        digits                ;base of segment list        movwf        FSR        movf        0,w                ;get the data        andwf        segmask,w        ;mask the bit        xorlw        0ffh                ;invert        movwf        PORTB                ;one possible segment line low        movf        dignr,w        call        getano        iorwf        PORTC,f         ; set one high.        bcf        STATUS,C        rlf        segmask,f        btfsc        STATUS,C        goto        nseg        nop        nop        nop        nop        nop        returnnseg        bsf        segmask,0        ;rotate        incf        dignr,f        btfsc        dignr,2                ;overflow?        clrf        dignrbak        return; display digits from specified positionxform        movwf        count        goto        ff5; format first 4 signifcant digits on displayformat        call        first                ;find 1st non-zero digitffx        movf        count,w        call        getdp                ;get formating info        movwf        dp        andlw        0fh        movwf        countff5        call        ff9                ;get segment pattern        movwf        digits        call        ff9        movwf        digits+1        call        ff9        movwf        digits+2        call        ff9        movwf        digits+3        returnff9        movf        count,w        decf        count,f        call        getbd                ;get bcd value        call        digseg        return; set count to 1st non zero digitfirst        movlw        9                ;start w/last digit        movwf        countff2        movf        count,w                ;get next digit        call        getbd        xorlw        0                ;set z flag        btfss        STATUS,Z        return                        ;hit non zero        decfsz        count,f        goto        ff2        return; get bcd digit specified by 'w'getbd        movwf        temp                ;save digit nr        clrw        btfsc        temp,7                ;negative value?        return                        ;zero if negative.        bcf        STATUS,C        rrf        temp,f                ;find buffer offset        movf        temp,w        rlf        temp,f                ;restore all bits        addlw        bcd                ;add start of bcd buff        movwf        FSR                ;set pointer        movf        0,w                ;get the byte        movwf        ddata                ;and store it.        btfsc        temp,0                ;low or hi nibble?        swapf        ddata,f                ;hi.        movf        ddata,w        andlw        0fh        return; Convert 32-bit binary number at <acc> into a bcd number; at <bcd>. Uses Mike Keitz's procedure for handling bcd; adjust; Modified Microchip AN526 for 32-bits.b2bcd        movlw        32                ; 32-bits        movwf        ii                ; make cycle counter        clrf        bcd                ; clear result area        clrf        bcd+1        clrf        bcd+2        clrf        bcd+3        clrf        bcd+4b2bcd2        movlw        bcd                ; make pointer        movwf        FSR        movlw        5        movwf        cnt; Mike's routine:b2bcd3        movlw        33h        addwf        0,f                 ; add to both nybbles        btfsc        0,3                ; test if low result > 7        andlw        0f0h                ; low result >7 so take the 3 out        btfsc        0,7                ; test if high result > 7        andlw        0fh                ; high result > 7 so ok        subwf        0,f                 ; any results <= 7, subtract back        incf        FSR,f                 ; point to next        decfsz        cnt,f        goto        b2bcd3        rlf        acc+0,f                ; get another bit        rlf        acc+1,f        rlf        acc+2,f        rlf        acc+3,f        rlf        bcd+0,f                ; put it into bcd        rlf        bcd+1,f        rlf        bcd+2,f        rlf        bcd+3,f        rlf        bcd+4,f        decfsz        ii,f                 ; all done?        goto        b2bcd2                ; no, loop        return; read data 'w' at address hi/loweeread        bcf        STATUS,RP0        bsf        STATUS,RP1                ;bank-2        movf        lo,w        movwf        EEADR        movf        hi,w        movwf        EEADRH        bsf        STATUS,RP0        ;bank-3        bcf        EECON1,EEPGD        ;access data memory        bsf        EECON1,RD                ;start the read        bcf        STATUS,RP0        ;bank-2        movf        EEDATA,w        bcf        STATUS,RP1        bcf        STATUS,RP0        return; write data 'w' at address hi/loweewrite        bcf        STATUS,RP0        bsf        STATUS,RP1                ;bank-2        movwf        EEDATA                ;set data        movf        lo,w        movwf        EEADR                ;set address        movf        hi,w        movwf        EEADRH        bsf        STATUS,RP0        ;bank-3        bcf        EECON1,EEPGD        ;access data memory        bsf        EECON1,WREN        ;start write operation        movlw        55h        movwf        EECON2        movlw        0AAh        movwf        EECON2        bsf        EECON1,WR        nop        nopee2        btfsc        EECON1,WR                ;wait for complete        goto        ee2        bcf        STATUS,RP0        bcf        STATUS,RP1        returns9600        call        clear        bsf        STATUS,RP0        bsf        SOUT                ;set to input        bcf        STATUS,RP0        movf        baud,w        movwf        temp        bcf        STATUS,C        rlf        temp,f        call        srq                ;get low byte        movwf        qtime        call        srq        movwf        qtime+1        movlw        (vbaud-vbase)/4        addwf        baud,w        call        setmodess5        call        segout        btfss        BUT2        goto        ss8        btfsc        BUT1        goto        ss5        btfss        BUT2        goto        cycle        call        setdir        movlw        'A'        movwf        sdata        movlw        26        movwf        scountss2        movf        sdata,w        call        serout        incf        sdata,f        movlw        43        call        delsq        decfsz        scount,f        goto        ss2        movlw        13        call        serout        movlw        100        call        delsq        movlw        10        call        serout        movlw        220        call        delsq        btfss        BUT1                ;still held down?        goto        ss5                ;repeat operation.        goto        s9600ss8        call        clear                ;blank display        movlw        20        call        delay        btfss        BUT1        goto        cycle        btfss        BUT2        goto        ss8        incf        baud,f        bcf        baud,2                ;limit 0-3        bsf        SAVE        goto        s9600midi        movf        midic,w        addlw        1                ;convert to midi number        call        wtod        movlw        39h                ;'C'        movwf        digits        movlw        76h                ;'H'        movwf        digits+1        bsf        STATUS,RP0        bsf        SOUT                ;set to input        bcf        STATUS,RP0ms5        call        segout        btfss        BUT2        goto        madj        btfsc        BUT1        goto        ms5        call        setdir        movlw        45                ;31250 baud        movwf        qtime        clrf        qtime+1        movf        midic,w                ;get midi chan nr.        iorlw        90h                ;add note on command.        call        serout                ;note on        movlw        60        call        serout                ;middle C        movlw        40        call        serout                ;velocityms6        movlw        20        call        delsq        btfss        BUT1                ;wait for button release        goto        ms6        movf        midic,w        iorlw        90h        call        serout        movlw        60        call        serout        movlw        0        call        serout                ;send note off        call        putopt                ;maybe save channel        movlw        250        call        delsq        goto        midimadj        movlw        100        call        delsq        btfss        BUT1        goto        cycle        btfss        BUT2        goto        madj        bsf        SAVE                ;flag for saving new channel        incf        midic,f                ;next midi channel        movlw        0fh        andwf        midic,f                ;roll over at 15        goto        midi; check for current statesetdir        bcf        DIR                ;check for resting state        btfss        SOUT        bsf        DIR        bsf        STATUS,RP0        bcf        SOUT                ;set to output        bcf        STATUS,RP0        return; send serial data from outdatserout        clrf        count                ;bit count        bsf        count,3                ;count=8        movwf        ddata        call        zero                ;start bitsers2        call        full        btfsc        ddata,0        call        one        btfss        ddata,0        call        zero        rrf        ddata,f        decfsz        count,f        goto        sers2        call        full        call        one        call        full        call        full        call        full        returnzero        btfss        DIR                ;which way is up?        bcf        SOUT        btfsc        DIR        bsf        SOUT        returnone        btfss        DIR                ;which way is up?        bsf        SOUT        btfsc        DIR        bcf        SOUT        returnfull        movf        qtime+1,w        movwf        temp+1        movf        qtime,w        movwf        temp        incf        temp+1,f        incf        temp,fff3        decfsz        temp,f        goto        ff3        decfsz        temp+1,f        goto        ff3        return        end
回复

使用道具 举报

本版积分规则

QQ|一淘宝店|手机版|商店|一乐电子 ( 粤ICP备09076165号 ) 公安备案粤公网安备 44522102000183号

GMT+8, 2025-8-24 07:06 , Processed in 0.047633 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表