Re: 關於 PIC10F206 的 delay
|
||||
---|---|---|---|---|
資深會員
|
有個現成的程式, 可以拿來參考;
目前笨笨鴨我.... 還看不懂此程式... 是日文的呦... 希望能提供壹些小小助益... 如果有人可以重新詳細註解一下... 笨笨鴨我 呱..呱..呱..呱.. 感激不盡 lar!!! >>>>>> www.picfun.com/P10F/p10f07.html <<<<<
發表於: 2005/6/28 1:11
|
|||
|
Re: 奇怪,,,奇怪......好奇怪??
|
||||
---|---|---|---|---|
資深會員
|
3Q 版主 問題找到啦 !!! 哈哈.... happy happy ....
我又去找個程式 來參考 , 發現 CMCON0的設定不同; 不工作的那個設定是... movlw d'10001111' movwf CMCON0, 改為 ..... movlw d'11110011' movwf CMCON0 MCU 10F206 就 OK 啦,,,, 我是不知道差在那裡 ???? 至少笨笨鴨..又可以繼續玩下去啦 !!!! happy happy 可以到街上泡洋妞去啦! 哈哈..嘿嘿..哈哈
發表於: 2005/6/18 3:34
|
|||
|
奇怪,,,奇怪......好奇怪??
|
||||
---|---|---|---|---|
資深會員
|
笨笨鴨, 又碰到問題囉,,
以下是現成的程式, 我用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
|
|||
|
如何讓10F2XX去睡覺覺呢???
|
||||
---|---|---|---|---|
資深會員
|
笨笨鳥在程式尾加入 goto sleep
但是行不通也 組譯時出現 symbol not previously defined 是否在睡覺覺前 還需要設定甚麼咚咚呀? 真是的 叫它去睡覺覺 就去嘛 磨啥菇菇咩! 難到要... 安樂死 咩 ! (PUT to SLEEP .... hahaha )
發表於: 2005/6/16 3:36
|
|||
|
Re: 菜鳥又有疑問囉???
|
||||
---|---|---|---|---|
資深會員
|
3Q ...謝謝啦.....happy
可是ㄚ... 笨笨鳥我是...左看右看,上看下看,倒過來看.... 還是有看沒有懂呦(註解說明太少).....哈哈 嗚 嗚 笨笨鳥我還再研究10F2XX... 一閃一閃亮晶晶的LED程式 看起來只好先收藏到我的葵花寶典密集去 待它日功力略增時....... By the way .....有沒有再簡單些的分時程式ㄚ 或者有沒有那種delay程式 或timer程式可以獨立工作 MCU不去管它們 等count完成了再通知MCU阿 我去看過的w100,w400講義 也還是太深啦! 有沒有W50給10F2XX用的初學者講義教材.....哈哈
發表於: 2005/6/15 0:41
|
|||
|
Dumb bird has another questions?
|
||||
---|---|---|---|---|
資深會員
|
阿哈.... 笨鳥心中又有疑問囉???
10F2XX 的RAM 只有24 Bytes 如何知道被用完了沒有呢 又有那些程式指令會占用RAM呢
發表於: 2005/6/10 7:07
|
|||
|
Dumb bird still as a dumb bird ....
|
||||
---|---|---|---|---|
資深會員
|
謝謝個位高人指點 原來Delay程式還可以分輪詢 及中斷式..
Haha ...piece of cake ...let me look look .... Will ..... but but ....question question more question ???? Seems... 10f2XX does not use interrupts ??? 輪詢(笨笨式)... 總有一天等到妳 太癡情也 太 笨笨啦 這招式 老先生我已經知曉! How about 中斷式.... 手頭現成Delay程式 都是 輪詢(笨笨式)... 是否有中斷式 簡單程式 讓我來琢磨琢磨... 3Q .... 阿里阿多.... 謝謝啦!!!!
發表於: 2005/6/4 1:03
|
|||
|
Re: 新手請教一些問題
|
||||
---|---|---|---|---|
資深會員
|
個人覺得w100還是很難了解
也許因為我完全不懂MCU 如果光是看書自修好像是很難耶 還好可以來這兒問一些笨笨問題 謝謝版主 及個位前輩囉 By the way...我也買了一片10F2XX自修CD 我覺得還不錯 如果需要的話 我可以E-MAIL給你們
發表於: 2005/6/3 0:50
|
|||
|
菜鳥又有疑問囉???
|
||||
---|---|---|---|---|
資深會員
|
目前還再研究10F2xx系列程式 原因是程式都比較單純
對菜鳥我 比較不會打結 但是ㄋㄟ????? 嘿.. 嘿.. 又有疑問囉??? 請教個位一個笨笨問題???? 如果MCU 在跑Delay 程式時 是否還可以執行其他程式 如果不能 那Delay 程式是120Sec或更長 的話 MCU就要呆跑Delay 程式 後才能再辦案啦 那不就是笨笨MCU啦 Will ..... any solution for this stupid question???
發表於: 2005/6/3 0:31
|
|||
|