• slider image 442
  • slider image 492
  • slider image 493
  • slider image 494
  • slider image 495
  • slider image 496
:::


Browsing this Thread:   1 Anonymous Users






Re: PIC16F877 PWM用熱敏電阻控制讓馬達乘4倍
#3
新會員
新會員


查看用戶資訊
是的,謝謝你用心看我的問題

發表於: 2008/1/14 22:28
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC16F877 PWM用熱敏電阻控制讓馬達乘4倍
#2
新會員
新會員


查看用戶資訊
Hi..
你寫的主旨有點奇怪..不太懂你所要表達的意思


是指利用熱敏電阻所造成的電壓變化..經由pic內建的ad讀入類比電壓..經過計算將原先pwm的開度..增加到原來的4倍..並輸出至放大電路..推動馬達...是這樣嗎..

發表於: 2008/1/14 12:38
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC16F877 PWM用熱敏電阻控制讓馬達乘4倍
#1
新會員
新會員


查看用戶資訊
請問各位先進
我要如何用熱敏控制馬達讓它乘4倍,並且LCD最高顯示到255,以下是我的程式碼,我該如何修改,謝謝


8 BITS A/D(VR) + LCD + PWM
;
LIST P=16F877, R=DEC
#INCLUDE P16F877.INC
CBLOCK 0X20
ENDC
;
; DEFINE RAM
;
CBLOCK
BCDBFH, BCDBFL
ENDC
;
ORG 0
NOP
GOTO MAIN
;
;

;---------------------------------------------------------------;
;
#INCLUDE <LCD.INC> ;
;
; Defines for I/O ports that provide LCD data & control ;
;
LCD_DATA equ PORTB ;
LCD_CNTL equ PORTB ;
;
RS equ 5 ; RS=PORTB,5 ;
E equ 4 ;
;
;===============================================================;
;
#INCLUDE <HX2BCD.INC>
#include <DLY2_5mS.INC>
;
;.................................
;

MAIN:
call InitLCD
call clrLCD
;
;************************************************
;* - Initialize the A/D converter *
;* - Left justified *
;* - 1 analog channels, 0 references *
;* - Fosc/8 clock source *
;* - Channel 0 *
;* - Enable A/D *
;************************************************
;
BANKSEL ADCON1 ; ADCON1 is in bank1
MOVLW B'00000100' ; select left(0) justified (d7)
; 1 ch(AN0)/0 refs
MOVWF ADCON1
;
BANKSEL ADCON0
MOVLW B'10001001' ; select Fosc/8(01), AN0(000)
MOVWF ADCON0 ; a/d done(0), x(0), a/d ON(1)
;
;************************************************
;* - Initialize the CCP1 Module *
;* - Set the period to FFh *
;* - Make RC2 an output *
;* - Configure CCP1 for PWM (xxxx11xx) *
;* - Initialize Timer2 *
;* - 1:1 Postscale (x0000xxx) *
;* - 1:4 Prescale (xxxxxx01) *
;* - Enable the timer (xxxxx1xx) *
;************************************************

BANKSEL PR2
MOVLW H'FF'
MOVWF PR2
BCF TRISC,2
BANKSEL CCP1CON
MOVLW B'00001111'
MOVWF CCP1CON
MOVLW B'00000101'
MOVWF T2CON

CALL DLY2_5mS ; wait for input charge
MAIN1:
BSF ADCON0,GO ; start a/d converting
MAIN2:
BTFSC ADCON0,GO ; a/d convertion finished?
GOTO MAIN2 ; no
;
call L2homeLCD
MOVF ADRESH,W ; read a/d result ( high byte )
CALL HX2BCD ; convert HEX to BCD
; results in BCDBFH/BCDBFL
;
MOVF BCDBFH,W ; output a/d results to LCD
CALL putHexLCD
;
MOVF BCDBFL,W
ADDLW .100
CALL putHexLCD
;
MOVF ADRESH,W
MOVWF CCPR1L ; Also in Duty cycle
;
GOTO MAIN1
;
;
;
END

發表於: 2008/1/12 19:57
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------