• 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: 奇怪,,,奇怪......好奇怪??
#4
版主
版主


查看用戶資訊
恭喜您!可以去泡妞了。

CMCON是用來設定比較器的模式用的。如果相關的腳是當作一般的I/O來用,就要把比較器的功能關掉,I/O動作才會正常。

不過,建議程式在開始之後,還是加一段DELAY的程式,再進行耗電的動作會比較安全。

看一下10F2XX的DATA SHEET,應該是有些內含比較器,有些沒有。

發表於: 2005/6/18 11:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 奇怪,,,奇怪......好奇怪??
#3
資深會員
資深會員


查看用戶資訊
3Q 版主 問題找到啦 !!! 哈哈.... happy happy ....

我又去找個程式 來參考 , 發現 CMCON0的設定不同;
不工作的那個設定是...
movlw d'10001111'
movwf CMCON0,
改為 .....
movlw d'11110011'
movwf CMCON0
MCU 10F206 就 OK 啦,,,,
我是不知道差在那裡 ????
至少笨笨鴨..又可以繼續玩下去啦 !!!!
happy happy 可以到街上泡洋妞去啦!
哈哈..嘿嘿..哈哈

發表於: 2005/6/18 3:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 奇怪,,,奇怪......好奇怪??
#2
版主
版主


查看用戶資訊
也許在main1的前一行,加上

call pause_250ms

您的問題就解決了。

我的理論是:原來的程式,在送電後,電源還不沒到很穩定的定位時,,它就開始點LED。於是,耗電造成瞬間壓降;PIC想要重置,電壓卻又降得不夠低,重置不良,就當了。

加一些delay,等電壓穩了,再點LED,就沒事了。

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


奇怪,,,奇怪......好奇怪??
#1
資深會員
資深會員


查看用戶資訊
笨笨鴨, 又碰到問題囉,,
以下是現成的程式, 我用BFMP燒錄器,mcu 用10F206
燒錄結果ok 但是用萬用板實際測試,mcu卻不會工作
又換了一個10F206 結果還是一樣
失望之餘 又換了一個10F202燒錄
奇怪...居然會工作了, 這麼個程式應該是給10F206用的
結果是..... 奇怪,,,奇怪 .....好奇怪??
10F202, 10F206, BFMP 都是新買的
不知 笨笨鴨 這次又做了甚麼糗事.....

; File Name:PIC10F206_06.asm, by John Massa, Nov 26, 2004, Ver 1.00
; Description: Three LEDs blink in sequence (Chase).
;-----[Schematic]------------------------------------------------------------
; PIC10F206
; _ _
; GP0, ICSPDAT, Cin+ [ \_/ ] GP3, MCLR/, Vpp
; Vss, Ground [ ] Vdd, +2.0 VDC to +5.5 VDC
; GP1, ICSPCLK, Cin- [_____] GP2, T0CKI, Cout, FOSC4
;-----[Configuration]--------------------------------------------------------
LIST
; P10F206.INC Standard Header File, Version 1.01 Microchip Technology, Inc.
NOLIST
#include <p10F206.inc> ; processor specific variables
; Configure: Controls the reset pin, code protect, oscillator selection, WDT.
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF
;-----[Defines & Variable Assignments]---------------------------------------
cblock 0x08
COUNT ; Count buffer
COUNT1 ; Count1 buffer
endc
;-----[Reset Vector]---------------------------------------------------------
ORG 0x000 ; PIC goes here (Origin of code) after reset.
movwf OSCCAL ; Load the oscillator calibration factor.
goto init ; go to initialization routine
;-----[Interrupt Vector]-----------------------------------------------------
; Note: PIC10F202/206 does not use interrupts.
;-----[Initialization]-------------------------------------------------------
init
;-----[OPTION]---------------------------------------------------------------
; OPTION register controls wake on GP0,1,3 change, GP0,1,3 pull-ups, TM0, etc
movlw b'10000111' ; Set pull-ups only, max pre-scaler
OPTION ;
;-----[CMCON0]---------------------------------------------------------------
; Comparator control register
movlw b'10001111' ; Turn-off the comparator, enable the I/O pins.
movwf CMCON0
;-----[TRIS]-----------------------------------------------------------------
; TRIS (reg#) tri-state I/O register. All I/O pins default to inputs at reset.
movlw b'00001000' ; Set GPIO pin 3 to an input, pins 0 - 3 to outputs.
TRIS GPIO ; Register 06h
;-----[Main routine]---------------------------------------------------------
main ; Three LEDs will sequence (Chase).
bcf GPIO,0 ; Turn-off all the LEDs
bcf GPIO,1
bcf GPIO,2
main1
bsf GPIO,0 ; Turn-on LED #1
call pause_250ms ; Pause for 250 miliseconds
bcf GPIO,0 ; Turn-off LED #1
bsf GPIO,1 ; Turn-on LED #2
call pause_250ms ; Pause for 250 miliseconds
bcf GPIO,1 ; Turn-off LED #2
bsf GPIO,2 ; Turn-on LED #3
call pause_250ms ; Pause for 250 miliseconds
bcf GPIO,2 ; Turn-off LED #3

goto main1
;-----[Subroutines]----------------------------------------------------------

pause_250ms ; This subroutine delays for ~250 milliseconds
movlw d'249' ; Move the literal count of 249 to reg 'W'
movwf COUNT ; ...then store it in the register 'COUNT'
goto pause

pause ; This subroutine pauses for 1 millisecond
movlw d'100' ; Move the literal count of 100 to reg 'W'
movwf COUNT1 ; ...then store it in the register 'COUNT1'

pause_1
NOP ; These 7 'NOP's delay for 7 microseconds
NOP
NOP
NOP
NOP
NOP
NOP
decfsz COUNT1,F ; Is the buffer 'COUNT1' decrement to zero?
goto pause_1 ; ...no, its not fully decremented yet, loop again
decfsz COUNT,F ; ...yes, now decrement the buffer 'COUNT'
goto pause ; The buffer 'COUNT' is not zero, load 'COUNT1' again
retlw 0 ; ...Yes, now the buffer COUNT' is zero. Return.

END ; Directive to end the program

發表於: 2005/6/17 7:18
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... ]

教育訓練中心

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