• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   5 Anonymous Users






Re: 第一次使用Microchip MCU ....
#8
新會員
新會員


查看用戶資訊
問題已找到,但是GP2我仍然無法控制,是否我沒將GP2設為IO mode ? 那要如何設定,GP2才會是IO mode ...

謝謝!!

發表於: 2005/4/15 19:53
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 第一次使用Microchip MCU ....
#7
新會員
新會員


查看用戶資訊
list      p=10F200                
        
#include <P10F200.INC>
        
__CONFIG   _MCLRE_OFF _CP_OFF _WDT_OFF

Find_USB_Flag   EQU        0x10 
USB_value         EQU        0x11 
Delay_Var1        EQU        0x12 
Delay_count      EQU        0x13
;**********************************************************************
        
ORG     0x000             coding begins here     
        
goto    start
start
        nop                  
        movlw   
09h             set GP0,GP3 is input GP1,GP2 is output
        tris      GPIO         
        bsf     GPIO
,1            GP1 set '1'
        
bsf     GPIO,2            GP2 set '1' 
One_Loop
        clrf    Find_USB_Flag     
Find_USB_Flag 0
        
clrf    USB_value      
New_Loop    
        clrf    Delay_count
Next_Loop    
        movlw   GPIO
        movwf   USB_value
        btfsc   USB_value
,0       ; if GP0 goto One_Loop
        
goto    One_Loop 
        btfsc   USB_value
,
        
goto    One_Loop
        nop
        decfsz  Delay_count
,1
        
goto        Next_Loop 
        btfsc    Find_USB_Flag
,
        
goto    New_Loop
        bsf         Find_USB_Flag
,0
        bcf      GPIO
,1
        call      Delay
        bsf      GPIO
,1
        
goto       New_Loop
Delay
        clrf      Delay_Var1
Delay_Loop1
        nop
        nop    
        decfsz    Delay_Var1
,1    
        
goto      Delay_Loop1    
        
return    
        
END

//=============================
不知道哪裡錯了,我用軟體去模擬沒有問題,但燒到PIC10F200時卻沒有反應,GP1一直為'1',GP2一直為'0', 將GP0,GP3設'0'時,GP1不會產生 '1'->'0'->'1' 的動作,請教程式哪裡寫錯了?

謝謝!!

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


Re: 第一次使用Microchip MCU ....
#6
版主
版主


查看用戶資訊
這個程式的需求非常簡單,建議你打電話到 Microchip 來找我吧! 0800-717-718 找 楊先生或何先生。

發表於: 2005/4/13 11:38
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 第一次使用Microchip MCU ....
#5
新會員
新會員


查看用戶資訊
想了好久還是不知要如何下手,目前我想要的功能 2 input , 1 output , 當 2個input 同時為 '0'時,且時間要大於400ms,這時另一個output pin 就會產生一個 High Low 的 訊號,不曉得各位是否能夠幫忙....

謝謝!!

發表於: 2005/4/12 19:21
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 第一次使用Microchip MCU ....
#4
版主
版主


查看用戶資訊
bsf GPIO,0 ; 將 GP0 pin 設 '0'
bsf GPIO,1 ; 將 GP1 pin 設 '1'

如果我要讀取 GP0 pin 的值要如何寫? movwf GPIO ;將 GPIO 讀到 W REGISTER.

發表於: 2005/4/12 17:12
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 第一次使用Microchip MCU ....
#3
新會員
新會員


查看用戶資訊
Thank you !!


bsf GPIO,0 <- 是否將 GP0 pin 設 '1' ?
bsf GPIO,1 <- 是否將 GP1 pin 設 '1' ?

如果我要讀取 GP0 pin 的值要如何寫?

Thank !!

發表於: 2005/4/12 15:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 第一次使用Microchip MCU ....
#2
版主
版主


查看用戶資訊
網站就有 MPLAB IDE v7.10 用它就可以了。
http://www.microchip.com/stellent/idc ... me=en019469&part=SW007002

基本的範例程式如下所示:

;**********************************************************************
;   
This file is a basic code template for assembly code generation   *
;   
on the PICmicro PIC10F206This file contains the basic code      *
;   
building blocks to build upon.                                    *
;                                                                     *
;   
Refer to the MPASM User's Guide for additional information on     *
;   features of the assembler (Document DS33014).                     *
;                                                                     *
;   Refer to the respective PICmicro data sheet for additional        *
;   information on the instruction set.                               *
;                                                                     *
;                                                                     *
;                                                                     *
;**********************************************************************


    list      p=10F206            ; list directive to define processor
    #include <p10F206.inc>        ; processor specific variable definitions

    __CONFIG   _MCLRE_OFF & _CP_OFF & _WDT_OFF

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




;***** VARIABLE DEFINITIONS
temp            EQU         0x08        ;example variable definition
Delay_Var1        EQU        0x09 
Delay_Var2        EQU        0x0a


;**********************************************************************
    ORG     0x1FF             ; processor reset vector

; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.

    ORG     0x000             ; coding begins here 
    movwf   OSCCAL            ; update register with factory cal value 
    bsf    OSCCAL,0

start    
    nop                       ; example code
    movlw   0xFF              ; example code
    movwf   temp              ; example code

; remaining code goes here


    movlw    B'
11110011 
    movwf    CMCON0

    movlw    
B'11111100 
    tris    GPIO

Null_Loop

    bsf    GPIO,0
    bsf    GPIO,1

    call    Delay

    bcf    GPIO,0
    bcf    GPIO,1

    call    Delay

    goto    Null_Loop 

Delay
    clrf    Delay_Var1
Delay_Loop2
    clrf    Delay_Var2
Delay_Loop1
    nop
    nop
    decfsz    Delay_Var2,F
    goto    Delay_Loop1
    decfsz    Delay_Var1,F
    goto    Delay_Loop2
    return

    END                       ; directive '
end of program'

發表於: 2005/4/12 11:15
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


第一次使用Microchip MCU ....
#1
新會員
新會員


查看用戶資訊
第一次使用Microchip MCU ,不曉得 PIC10F200 要用哪一套編譯軟體,有沒有一些 sample code ?

發表於: 2005/4/12 9:32
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... ]

教育訓練中心

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