• 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: 關於16F505.. 笨鴨有疑問請教???
#8
資深會員
資深會員


查看用戶資訊
哈哈 ...找到毛病啦!!!HAPPY...
原來少了RETLW 0 指令, 難怪會當雞囉!
還有呀??? 新買的 12F510 , 12F675 都拿到啦!!
嗯....12F675比較難 , 而且也沒有相關程式可以參考練習的 ;
還是玩玩12F510吧!!!
對啦!!一般程式寫玩以後, 個位大哥大是如何測試的呢???

By the way...偷偷告訴你們...
老婆呀 ??? 哈哈 ...她在台北!!!!!
所以笨鴨偶在這兒還是單身囉..... 黑皮,, 黑皮,,,
偶愛台媚... 台媚愛偶... 哈哈....
問題解決了... 心情特好....3Q !!! Lar everybody....

發表於: 2006/5/9 0:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F505.. 笨鴨有疑問請教???
#7
版主
版主


查看用戶資訊
你不是結婚了嗎??? 還敢去把馬子不怕皮癢啊!

發表於: 2006/5/8 17:56
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F505.. 笨鴨有疑問請教???
#6
資深會員
資深會員


查看用戶資訊
3Q , 3Q....個位大哥大指正, 簡單程式可以RUN啦!!!
因為是第一次使用16F505 我需要6個OUTPUT...
原本寫的程式變化比較多, 不知當在何處 ?????
以為是設定錯誤 一時心急, 把程式簡化後,,,,
居然忘了goto main .. 所以更不RUN啦!!
此次經驗是... 凡事急不得, 越急越看不到錯誤 ..
碰到問題解決不了, 先放下來 ...
帶狗兒出去散個步....逛逛MALL... 把把馬子... 聽聽音樂.....
好啦... 可以把原本寫的程式 ,再來看看是那兒臭臭啦 !!!
Have a nice weekend everybody and take care ,3Q lar!

發表於: 2006/5/6 1:37
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F505.. 笨鴨有疑問請教???
#5
版主
版主


查看用戶資訊
程式用 MPLAB SIM + Watch Window 可以執行,PORTC 的 Clock 也可以送出來,PORTB 的位元變化也正確,只是程式沒有正確的迴圈會造成當機,請加入一行 goto main 如下所示:

clrf PORTC ; Turn off CLK.
bsf PORTB,1 ; turnoff GREEN led.
goto main
;
delay_0.1s
movlw d'100' ; 100ms

發表於: 2006/5/5 11:51
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F505.. 笨鴨有疑問請教???
#4
資深會員
資深會員


查看用戶資訊
mplab sim 很正常

只是 delay_0.1s 前面少了一個 goto main

導致程式執行到 delay_0.1s 前一行會進入 delay_0.1s

而導致 stack overflow,而reset

你所謂不會run?是那裏不會run?


發表於: 2006/5/5 11:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F505.. 笨鴨有疑問請教???
#3
資深會員
資深會員


查看用戶資訊
3Q Lar!!!! . 那如此設定對不對呢??
還有我查看MAP, 所有REGISTER FILE 都在Bank0,
那我還需要下banksel 指令嗎 ???
還有 BUILD OK, 但是程式不會RUN???
可否幫忙看看那兒錯啦!!!!!! 3Q lar!!!
PIC16F505   TRI-COLOR LED FLASHER FOR MY DOGGIE    05/04/2006
    
#include    <p16F505.inc>   ; processor specific variables
ConfigureControls the reset pincode protectoscillator selectionWDT.
    
__CONFIG _CP_OFF _MCLRE_OFF _WDT_OFF _IntRC_OSC_RB4EN 
;-----[Defines Variable Assignments]--------------------------------------- 
     
cblock 0x08    
    
count        counter buffer.
    
count1        counter buffer.
    
count2        counter buffer.
    
endc
;-----[Reset Vector]---------------------------------------------------------
    
ORG     0x000            PIC goes here (Origin of codeafter reset.
    
movwf   OSCCAL            Load the oscillator calibration factor.
    
movlw   b'10000111'     Enable pull-ups resister,max pre-scaler.
    
OPTION                  ;    

    
movlw   b'00001000'     Set RB3 pin to an inputRB0,1,2,4,5 to outputs.
    
TRIS    PORTB            RB0 Red RB1 GreenRB2Blue LED.
    
movlw    b'0000000'        Set  RC0,1,2,3,4,5 to outputs.
    
TRIS    PORTC            RC0CLK0RC1CLK1RC2CLK2.
;-----[
Main routine]---------------------------------------------------------
main
    movlw    
b'11111111'        0xff all output High.
    
movwf    PORTB            ;Turn off LED.
    
clrf    PORTC            ;Turn off CLK all output Low
    
bcf     PORTB,0            turn on red LED.
    
movlw    b'11111111'        0xff all output High.
    
movwf    PORTC            Turn on CLK.
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
clrf    PORTC            Turn off CLK.
    
bsf        PORTB,0            turnoff RED led.
    
bcf        PORTB,2            Turn on Blue LED.
    
movlw    b'11111111'        0xff all output High.
    
movwf    PORTC            Turn on CLK.
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
clrf    PORTC            Turn off CLK.
    
bsf        PORTB,2            Turn off Blue LED.
    
bcf        PORTB,1            turn on GREEN led.
    
movlw    b'11111111'        0xff all output High.
    
movwf    PORTC            Turn on CLK.
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
call    delay_0.1s        ;
    
clrf    PORTC            Turn off CLK.
    
bsf        PORTB,1            turnoff GREEN led.
delay_0.1s
    movlw    d
'100'            100ms
    movwf    count1            
;
    goto    
delay_2            ;
delay_50ms
    movlw    d
'20'            20ms.
    
movwf    count1            ;
    goto    
delay_2            ;
delay_2
    movlw    d
'200'            ;
    
movwf    count2            ;
delay_3
    nop                        
1us.
    
nop                        1us.
    
decfsz    count2,F        1us.
    goto    
delay_3            2us.
    
decfsz    count1,F        ;
    goto    
delay_2            ;
    
retlw    0
    end



發表於: 2006/5/5 0:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F505.. 笨鴨有疑問請教???
#2
版主
版主


查看用戶資訊
上述除了 OSCCAL 是暫存器外,其餘的OPTION & TRIS都是16C5x 專用的指令,使用時需注意。有關RAM BANK 的切換可以使用 banksel 這個 directive instruction.

發表於: 2006/5/4 18:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於16F505.. 笨鴨有疑問請教???
#1
資深會員
資深會員


查看用戶資訊
Dear All :
請教16F505, 一開始設定 OSCCAL, OPTION ,TRIS...時需要先設定BANK嗎?? 3Q !!!!

發表於: 2006/5/4 7:52
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... ]

教育訓練中心

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