• <tbody id="w8jhq"><dfn id="w8jhq"><pre id="w8jhq"></pre></dfn></tbody>
  • <fieldset id="w8jhq"><pre id="w8jhq"></pre></fieldset>

    久久黄色 视频|我草AV|AV在线网站导航|色色97激情|无码人妻一区二区有奶水|日韩精品|大香蕉97视频|成人a站免费|日本黄色片|久久久久无码AV

    久久黄色 视频|我草AV|AV在线网站导航|色色97激情|无码人妻一区二区有奶水|日韩精品|大香蕉97视频|成人a站免费|日本黄色片|久久久久无码AV

    久久黄色 视频|我草AV|AV在线网站导航|色色97激情|无码人妻一区二区有奶水|日韩精品|大香蕉97视频|成人a站免费|日本黄色片|久久久久无码AV

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

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

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

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

    技術(shù)支持

    PIC單片機PWM實現(xiàn)數(shù)字模轉(zhuǎn)換的方法

    更新時間: 2019-03-23

    十年專注單片機方案開發(fā)的方案公司英銳恩,分享PIC單片機PWM實現(xiàn)數(shù)模轉(zhuǎn)換的方法。英銳恩現(xiàn)提供服務(wù)產(chǎn)品涉及主控芯片:8位單片機、16位單片機、32位單片機及各類運算放大器等。

    硬件圖:

    PIC單片機PWM實現(xiàn)數(shù)模轉(zhuǎn)換方法

    源程序:

    ; PWM port (in w), pin, duty
    ; Generates a bit stream of 256 1s and 0s with the specified
    ; duty cycle. If this bit stream is run through a simple RC
    ; integrator, the result is an analog voltage output of
    ; (duty/255) * (PIC supply voltage). For example, if duty is
    ; 100 and the supply is 5 volts, then the integrated output of
    ; pwm would be (100/255) * 5 = 1.96 volts. In many applications,
    ; pwm output should be buffered with a unity-gain op-amp
    ; circuit. In those cases, the pwm output pin should be set up
    ; as an output when Pwm is called, then immediately switched to
    ; input when Pwm is done. This prevents the steady-state output
    ; of the pin from affecting the voltage set by Pwm.

      P = pic16c55
            #include <16c55.inc>   ; processor assembler definitions
            _CONFIG _xt_osc & _wdt_off & _protect_off
            reset start

            org 8
    duty Res d'1' ; Pwm duty cycle.
    acc Res d'1' ; Pwm accumulator.
    index Res d'1' ; Temporary counter for pwm.
    pin Res d'1' ; Pin number to pulse (0-7).

    ; Device data and reset vector

     org 0

    ; Table to convert pin number (0-7) into bit mask (00000001b to 10000000b).
    Pinz         ADDWF pcl                 
                 RETLW d'1'                
                 RETLW d'2'
                 RETLW d'4'
                 RETLW d'8'
                 RETLW d'16'
                 RETLW d'32'
                 RETLW d'64'
                 RETLW d'128'

    start        MOVLW d'0'                 ; All outputs.
                 TRIS 5h
                 CLRF 5h                    ; Start with LED off.
                 CLRF duty                  ; Initial brightness = 0.
                 CLRF index                 ; Clear loop counter for pwm.
    start_loop   MOVLW d'2'                 ; Pin 2.
                 MOVWF pin

     MOVLW d'0'                 ; of port ra.
                 CALL pwm                   ; Send pwm to LED.
                 INCF duty                  ; Turn up brightness.
                 GOTO start_loop            ; Endless loop
    ; Upon entry, the desired pin must already be set up as an output.
    ; Variable "pin" contains the pin number (0-7). The w register contains a
    ; number representing the output port (0-2) for RA through RC. The variable
    ; duty contains the desired duty cycle from 0 to 255.

    Pwm          MOVWF fsr                  ; Point to the port number.
                 MOVLW 5h                   ; Add offset for port RA.
                 ADDWF fsr
                 MOVF pin,w                
                 CALL Pinz                  ; Get bit mask from the table.
                 MOVWF pin                  ; Put the mask into pin.
    Pwm_loop     MOVF duty,w                ; Let acc = acc + duty
                 ADDWF acc

                 MOVF pin,w                
                 BTFSC status,c             ; IF carry THEN pin = 1
                 IORWF indirect             ; ELSE pin = 0.
                 COMF pin,w                
                 BTFSS status,c            
                 ANDWF indirect             

        DECFSZ index               ; Repeat 256 times.
                 GOTO Pwm_loop
                 RETLW 0h                  

                
                
                 end

    404
    返回首頁 |  返回上一頁
    久久黄色 视频|我草AV|AV在线网站导航|色色97激情|无码人妻一区二区有奶水|日韩精品|大香蕉97视频
  • <tbody id="w8jhq"><dfn id="w8jhq"><pre id="w8jhq"></pre></dfn></tbody>
  • <fieldset id="w8jhq"><pre id="w8jhq"></pre></fieldset>
    日韩av电影一区| 一区二区不卡无码| 日本操逼大片| 无码天堂AV| 内射网址| 在线免费观看av一区| 曹先生探花视频| 国产精品国产乱| 亚洲w码欧美s码免费| 亚洲一区二区 无码| 婷婷色色网| 人妻福利视频| 月韩AV| 亚洲口交一区二区| 校园春色亚洲无码| 日韩免费AV在线观看| 悠悠色影院人妻无码| 亚洲性爱在线观看| 色色无码| 超碰日本人妻| 育av在线观看| 亚洲人成色000000| 久久播av| 国产精品免费电影| sese成人网| 日本无码中文字幕| 成人美女aV| a片视频网址| 亚洲色情在线| 一级A片免费观看| 亚洲在线视频一区| 曹先生探花视频| 6 9桃色A V| 久久伊人月| 日韩无码DVD| 日韩无码一区二| 亚日韩黄| 欧美黄色网| 岛国av无码一区二区| a片在线视频| 超碰黄色片|