Re: PIC10F206 Prescaler設為1/256, 將TMR0時間拉長後,其輸出GP2無法拉Low….?
|
||||
---|---|---|---|---|
新會員
|
Hi Calvinho...!
It is work...!Thank you very much! Best Regards Morgan, Chen
發表於: 2005/6/2 1:19
|
|||
|
Re: PIC10F206 Prescaler設為1/256, 將TMR0時間拉長後,其輸出GP2無法拉Low….?
|
||||
---|---|---|---|---|
新會員
|
hi!謝謝您的回應!
對於Prescaler設定成1/256,我也有設定過!其執行256個指令後TMR0++,但其最後得結果,也無法造成GP2...010101的變化! 可否告訴我別種可能性...? Thank you very much!參照:
發表於: 2005/6/1 2:17
|
|||
|
Re: PIC10F206 Prescaler設為1/256, 將TMR0時間拉長後,其輸出GP2無法拉Low….?
|
||||
---|---|---|---|---|
管理員
|
仔細地檢查 option 指令中 W 的值和 data sheet 的說明做比較 ; 你會發現您的 PS0..2 ( bit 0..2 ) 的設定是不對的 : 當 PSx = 000 時 , TMR0 的 Prescaler 是 1:2 , 若你須要 1:256 的 prescaler , 要寫入 111 的值. 因為是 1:2 , 兩個指令 TMR0 就會變化 , 所以在判斷 TMR0 是否 = 0xff 時跟本很難捕捉到那一瞬間 . 通常將 prescaler 設很小時 , 我們檢查的是範圍而非特定值 ! 因會指令花的時間比 Timer 的進位時間長就一定會不正常 .
發表於: 2005/5/31 23:53
|
|||
|
PIC10F206 Prescaler設為1/256, 將TMR0時間拉長後,其輸出GP2無法拉Low….?
|
||||
---|---|---|---|---|
新會員
|
各位大大…我的程式在ICD2上模擬…可以將GP2 0,1,0,1…的變化…
煩請各位大大告知! Thank you! PS.若時間設短時,可動作! SOURCE CODE FOR YOUR REFERENCE org 0x000 ; movlw b'01111110' ;Center Frequency movwf OSCCAL ;-------------------------- ;---- Timer Initialize ---- ;-------------------------- ; /cmptocs tose tocs ps2 ps1 ps0 psa movlw 0x08 ;GP2 -> Output! tris GPIO movlw b'11100011' ;CMPOUT _COUTEN POL _CMPT0CS CMPON CNREF CPREF _CWU movwf CMCON0 clrwdt ;Disable Watch Dog Timer movlw b'11010000' ;_GPWU _GPPU TOCS TOSE PSA PS2 PS1 PS0 option movlw b'00000001' ;Initial TMR0 = 1 movwf TMR0 movlw 0x00 movwf Unit_Num ;Unit Number = 256 ;Total Timer = 256(PSA)*256(TMR0)*8(Unit_Num)= ;-------------------------- Main movf TMR0,0 xorlw 0xFF btfsc STATUS,2 incf Unit_Num,1 movlw 0x0A xorwf Unit_Num,0 btfsc STATUS,2 call Flash_On goto Main Flash_On ;----- Initial Counter ----- movf GPIO,0 xorlw 0x04 movwf GPIO movlw 0x00 movwf Unit_Num bcf STATUS,2 retlw Main end
發表於: 2005/5/27 0:02
|
|||
|