Re: 偶又碰到問題啦....
|
||||
---|---|---|---|---|
資深會員
|
大哥知了 3Q a lot.....笨鴨偶受益多多
發表於: 2005/10/12 0:22
|
|||
|
Re: 偶又碰到問題啦....
|
||||
---|---|---|---|---|
資深會員
|
研究了一下午, 重新整理如下, 不知道有沒有對耶?
好像有給它懂一點點 , 程式一下子 瘦了100Kg...hahaha 用我的程式可以寫爆 12F508, 哈哈..真是有夠笨瓜耶.. 待笨鴨偶重新整理整理, 在燒來試看看囉...3q lar. ;-----[Main routine]--------------------------------------------------------- start movlw d'30' ; movwf chDelay ; sync_1 btfss GPIO,0 ; 等同步訊號 goto sync_1 ; No, check again .. goto loop_1 ; Yes.. loop_1 movlw d'10' ; addwf chDelay,w ; movwf chInner_delay ; call fnDelayNx100us ; bsf GPIO,1 ; set GP1 to triger call fnDelay100us ; set triger width =100us. bcf GPIO,1 ; Clear triger decfsz chDelay,1 ; goto loop_1 ; goto strart ; ;-----------------------------[Sub routine]----------------------------------- fnDelay100us movlw d'33' movwf count keep_1 decfsz count1,f goto keep_1 ; Total delay 100us.. retlw 0 fnDelayNx100us call fnDelay100us decfsz chInner_delay ; goto fnDelayNx100us ; retlw 0
發表於: 2005/10/11 6:49
|
|||
|
Re: 偶又碰到問題啦....
|
||||
---|---|---|---|---|
資深會員
|
3Q 3Q +阿里阿多 ,abewu...
笨鴨我 了解程式能力還很低... 也沒學過組合語言,玩PIC純粹是興趣, 所以會問一些很笨, 很好笑的問題; 在這兒還真是能得到很多幫助.... thanks lar! 希望有機會能回台北參加教育訓練課程... Well....我需要好好研究一陣子您的程式... 也就是說會有更多很笨, 很好笑的問題要請教,,lor ,hahaha..
發表於: 2005/10/11 1:17
|
|||
|
Re: 偶又碰到問題啦....
|
||||
---|---|---|---|---|
初級會員
|
Hi! Duck288,
很久沒有用組合語言了! 正好有個小程式要寫, 用你的問題來複習一下也好. 只是沒有試用, 希望沒有語法問題, 您使用前麻煩先 double check 一下語法. 您應該已經有 delay 0.1ms 的 routine. 假設它稱為 fnDelay100us 在程式中作為基本 delay. 另外寫了一個 routine 稱為 fnDelayNx100us, 它會呼叫 'fnDelay100us' N 次, N = 1 to 256, 呼叫此 routine 前先將 N 置於變數 'chInner_delay' 內. 當 N = 0 時會執行 256 次. 離開時 'chInner_delay' 會變為 0. extern fnDelay100us ; 假設是您 delay 0.1ms 的 routine chDelay RES 1 ; 變數宣告 chInner_delay RES 1 ; 變數宣告 Hi_I_start_here movlw 30 ; My instruction movwf chDelay ; My instruction ; Your instructions ---------------- loop_1 ; 你的 goto ... 看不大懂. ; 希望沒誤解 btfss GPIO,0 ; ---等同步訊號, goto loop_1 ;假設同步信號是 '1'. ; ------------------------------------ movlw 10 ; My instruction addwf chDelay, W ; My instruction movwf chInner_delay ; My instruction call fnDelayNx100us ; My instruction ; Your instructions ---------------- bsf GPIO,1 ;-----觸發訊號 call fnDelay100us ; 改名字了!!! bcf GPIO,1 ; ------------------------------------ decfsz chDelay, 1 ; My instruction goto loop_1 ; My instruction retlw 0 ; My instruction fnDelayNx100us ; 新加的 routine call fnDelay100us decfsz chInner_delay,1 goto fnDelayNx100us retlw 0
發表於: 2005/10/9 23:04
|
|||
|
Re: 偶又碰到問題啦....
|
||||
---|---|---|---|---|
初級會員
|
Hi! Duck288,
很久沒有用組合語言了! 正好有個小程式要寫, 用你的問題來複習一下也好. 只是沒有試用, 希望沒有語法問題, 您使用前麻煩先 double check 一下語法. 您應該已經有 delay 0.1ms 的 routine. 假設它稱為 fnDelay100us 在程式中作為基本 delay. 另外寫了一個 routine 稱為 fnDelayNx100us, 它會呼叫 'fnDelay100us' N 次, N = 1 to 256, 呼叫此 routine 前先將 N 置於變數 'chInner_delay' 內. 當 N = 0 時會執行 256 次. 離開時 'chInner_delay' 會變為 0. extern fnDelay100us ; 假設是您 delay 0.1ms 的 routine chDelay RES 1 ; 變數宣告 chInner_delay RES 1 ; 變數宣告 Hi_I_start_here movlw 30 ; My instruction movwf chDelay ; My instruction ; Your instructions ---------------- loop_1 ; 你的 goto ... 看不大懂. ; 希望沒誤解 btfss GPIO,0 ; ---等同步訊號, goto loop_1 ;假設同步信號是 '1'. ; ------------------------------------ movlw 10 ; My instruction addwf chDelay, W ; My instruction movwf chInner_delay ; My instruction call fnDelayNx100us ; My instruction ; Your instructions ---------------- bsf GPIO,1 ;-----觸發訊號 call fnDelay100us ; 改名字了!!! bcf GPIO,1 ; ------------------------------------ decfsz chDelay, 1 ; My instruction goto loop_1 ; My instruction retlw 0 ; My instruction fnDelayNx100us ; 新加的 routine call fnDelay100us decfsz chInner_delay,1 goto fnDelayNx100us retlw 0
發表於: 2005/10/9 23:03
|
|||
|
Re: 偶又碰到問題啦....
|
||||
---|---|---|---|---|
資深會員
|
我的笨程式也許是太長啦....
可否教偶如何瘦身呢? 我希望在收到同步訊號後Delay 4ms 再送出一個0.1ms的觸發訊號 然後收到下個同步訊號後送出一個的Delay 3.9ms觸發訊號 也就是說每收到同步訊號後會減少0.1ms 從Delay 4ms 直到 Delay 1ms 我現在是用CALL Delay 的方式來完成 所以我有3個 delay程式 delay 1ms, delay0.2ms,delay0.1ms btfss GPIO,0 ---等同步訊號 goto.... ----check sync again goto loop_1 loop_1 call delay_1ms call delay_1ms call delay_1ms call delay_1ms -----total Delay 4ms bsf GPIO,1 -----觸發訊號 call delay_0.1ms ----- bcf GPIO,1 btfss GPIO,0 ---等同步訊號 goto.... ----check sync again goto loop_2 loop_2 call delay_1ms call delay_1ms call delay_1ms call delay_0.2ms call delay_0.2ms call delay_0.2ms call delay_0.2ms call delay_0.1ms -----total Delay 3.9ms bsf GPIO,1 -----觸發訊號 call delay_0.1ms ----- bcf GPIO,1 . . 直到call delay_1ms -----total Delay 1ms 所以程式是又笨又臭又長 我想一定有比較簡單的方法來完成 不知是否有人教偶如何瘦身呢? 3Q 3Q 3Q lor!!!!
發表於: 2005/10/9 13:21
|
|||
|
偶又碰到問題啦....
|
||||
---|---|---|---|---|
資深會員
|
偶 用12F508 寫了個程式 在Build all 以後出現下列訊息
warring: Crossing page boundary -- ensure page bits are set. warring: Address exceeds maximum range for this processor 是蝦咪意思呀??? 但是 Build all 以後又出現是 build succeeded 不知該怎麼辦耶???如何 set page 呀 ????
發表於: 2005/10/8 5:54
|
|||
|