• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::

論壇索引


Board index » All Posts (abewu)




Re: 偶又碰到問題啦....
#31
初級會員
初級會員


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: 偶又碰到問題啦....
#32
初級會員
初級會員


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: 18f4420 的 PLLEN
#33
初級會員
初級會員


Hey!版主。您提醒了一件事,寫程式時本來就覺得怪怪的。

當我在引用 mcc18 的 18f4420.h 時,該 header 檔有兩項怪事:

1. 該檔案只將 OSCTUNEbits 定義到 TUN0:TUN5 = OSCTUNE<0:5> ,bit6 & bit7 並未定義。相對的,剛剛查了一下,您提到的編號,例如18f2525,bit6 & bit7 被定義為 PLLEN 及 INTSRC。是不是 18f4420 根本沒有就沒有 PLLEN?但是 DS39631A 確清楚說明 PLL 的處理方式,為何呢?

2. DS39631A 內說 OSCTUNE 的 Frequency Tuning bits 為 <0:4> 5個 bits,為何 18f4420.h 內要將 Frequency Tuning bits 定義成 <0:5> 6個 bits?

您又是依據哪ㄧ個 Data Sheet 發現 18f4420 沒有支援 PLL?

看起來 DS39631A 是錯的了!!!

發表於: 2005/10/4 17:44
頂部


Re: 關於MCU取得!
#34
初級會員
初級會員


我手頭有幾顆12f675 IP 4SE,應該只是比 12f629 多了ADC不知您要不要。如果OK!請告知住址/數量我寄去給您。

發表於: 2005/10/4 17:03
頂部


Re: 18f4420 的 PLLEN
#35
初級會員
初級會員


18F4420文件內確有 x 4 PLL 的說明,請見18F4420 Datasheet 文件編號 DS39631A, Page 28. Fig. 2-8, PIC18F2420/2520/4420/4520 CLOCK DIAGRAM. 及 Section 2.6的 說明。

另,若依說明內容,PLL 是一般 Control Register 而不是 Configuration Register 的事, 應該是程式內設定。如何將 Target Board關電再開?

發表於: 2005/10/4 16:33
頂部


18f4420 的 PLLEN
#36
初級會員
初級會員


我使用PIC18F4420,現在需要用到 8MHz (INTOSC) * 4 (By PLL) = 32 MHz來測試另一片PIC184420的 PSP。
依據手冊 PLL 的啟動需符合兩個條件:
The PLL is available when the device is,
1. configured to use the internal oscillator block as its primary clock source (FOSC3:FOSC0 = 1001 or 1000).
2. the PLL will only function when the selected output frequency is either 4 MHz or 8 MHz (OSCCON<6:4> = 111
or 110).
當這兩個條件都符合時,可設定 PLLEN (OSCTUNE<6>) = 1,以啟動PLL。
我依此將 configue bits 設成 FOSC3:FOSC0 = 1001,
並於程式起始處加入以下程式 (by C18):
OSCCON = 0b01110011;
OSCTUNE= 0b01000000;
結果仍是 8M Hz,顯然PLL未被啟動。這是為何呢?期先進們能指導一二。

(注:由於此 PIC18F4420 是透過 UART PORT 與 PC 聯繫,8 M Hz 的確認是透過 RS-232 的收發狀況判斷。曾嘗試用 4 Mhz * 4,結果仍是 4 M Hz,PLL也沒有成功啟動。)

發表於: 2005/10/4 3:21
頂部



« 1 2 3 (4)



:::

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... ]

教育訓練中心

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