• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 初學者PIC12F629 OSCCAL設定問題請教謝謝!
#7
新會員
新會員


查看用戶資訊
找到原因測試時LED電阻太小造成

發表於: 2008/8/29 15:01
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 初學者PIC12F629 OSCCAL設定問題請教謝謝!
#6
新會員
新會員


查看用戶資訊
list p=12f629 ; list directive to define processor
#include <p12f629.inc> ; processor specific variable definitions

errorlevel -302 ; suppress message 302 from list file

__CONFIG _CP_ON & _CPD_ON & _BODEN_ON & _MCLRE_OFF & _WDT_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT

;**********************************************************************
ANSEL EQU 9F

;========== MAIN PROGRAM =========
ORG 00
CALL InitPorts
GOTO MAIN
ORG 06
MAIN:
CLRWDT
BTFSC GPIO,GPIO3
GOTO MAIN
NOP
BCF GPIO,GPIO1
NOP
BCF GPIO,GPIO2 ;GPIO2OFF

L4:
CLRWDT
BTFSC GPIO,GPIO3
GOTO GPIO2ON
GOTO L4


GPIO2ON:
NOP
BSF GPIO,GPIO2 ;GPIO2ON

GPIO3DET:
CLRWDT
BTFSS GPIO,GPIO3
GOTO GPIO3DET
NOP
;=================GPIO0 與 GPIO1 設定 影響 GPIO2 輸出===
BSF GPIO,GPIO1
;=====================================================
GOTO MAIN

InitPorts:
BCF STATUS,RP0 ; set file register bank to 0
CALL 3FF ;
BSF STATUS,RP0 ; bank 1
MOVWF OSCCAL
CLRF ANSEL ;digital IO
MOVLW 08 ;GPIO3=INPUT, OTHERS =OUTPUT
TRIS GPIO ;
MOVLW 08
OPTION ;
BCF STATUS,RP0 ; bank 0
MOVLW 07 ;Set GP<2:0> to
MOVWF CMCON ;digital IO
MOVLW 00
MOVWF INTCON

MOVLW 0FF
MOVWF GPIO
RETURN
END


GPIO0 與 GPIO1 設定 影響 GPIO2 輸出 ??

發表於: 2008/8/29 12:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 初學者PIC12F629 OSCCAL設定問題請教謝謝!
#5
新會員
新會員


查看用戶資訊
謝謝您指出初始化BANK 的問題

發表於: 2008/8/28 9:52
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 初學者PIC12F629 OSCCAL設定問題請教謝謝!
#4
資深會員
資深會員


查看用戶資訊
InitPorts
MOVLW 08H ;PA3=INPUT, OTHERS =OUTPUT
TRIS GPIO ; ------ XX
MOVLW 02H
MOVWF PA
MOVLW 08H
OPTION ; ---------XX
RETURN

12F629 不是 低階 PIC 不能如此設定
修改如下 :

InitPorts
MOVLW .2
MOVWF PA ; GPIO 位於 BANK 0

BSF STATUS , RP0 ; SET TO BANK 1
MOVLW 08H ;PA3=INPUT, OTHERS =OUTPUT
MOVWF TRISIO

MOVLW 08H
MOVWF OPTION_REG
BCF STATUS , RP0 ; SET TO BANK 0
RETURN

發表於: 2008/8/28 3:51
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 初學者PIC12F629 OSCCAL設定問題請教謝謝!
#3
新會員
新會員


查看用戶資訊
感謝 版主Ryang提供說明

發表於: 2008/8/26 17:28
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 初學者PIC12F629 OSCCAL設定問題請教謝謝!
#2
版主
版主


查看用戶資訊
使用內部 RC 振盪器較正值方式如下:
list      p=12f629           ; list directive to define processor
    
#include <p12f629.inc>        ; processor specific variable definitions

    
errorlevel  -302              suppress message 302 from list file

    __CONFIG   _CP_OFF 
_CPD_OFF _BODEN_OFF _MCLRE_ON _WDT_OFF _PWRTE_ON _INTRC_OSC_NOCLKOUT  

'__CONFIG' directive is used to embed configuration word within .asm file.
The lables following the directive are located in the respective .inc file.
See data sheet for additional information on configuration word settings.

;**********************************************************************
        
ORG     0x000             processor reset vector
        
goto    main              go to beginning of program


        ORG     0x004             
interrupt vector location
:
:
:

main
        call    0x3FF             
retrieve factory calibration value
        bsf     STATUS
,RP0        set file register bank to 1 
        movwf   OSCCAL            
update register with factory cal value 

:
:


Mid-range 的校正值存在 0x3FF 的位址,裡用 Call 0x3ff取的校正值後存入 OSCCAL 就可以了。

GPIO2 為什麼不同IC輸出頻率不同?
ans: 因為頻率沒有校正。

發表於: 2008/8/25 15:36
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


初學者PIC12F629 OSCCAL設定問題請教謝謝!
#1
新會員
新會員


查看用戶資訊
OSCCAL EQU 090H
GPIO EQU 5 ;
PA EQU 5
INPUT EQU 3 ;GPIO 3 IS INPUT ONLY PIN

;========== MAIN PROGRAM =========
ORG 0
MOVWF OSCCAL
CALL InitPorts
LOOP:
BCF PA,2
NOP
NOP
BSF PA,2
GOTO LOOP

InitPorts
MOVLW 08H ;PA3=INPUT, OTHERS =OUTPUT
TRIS GPIO ;
MOVLW 02H
MOVWF PA
MOVLW 08H
OPTION ;
RETURN

END

GPIO2 為什麼不同IC輸出頻率不同?
OSCCAL 如何設定內部4MHZ ?

發表於: 2008/8/25 15:16
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... ]

教育訓練中心

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