• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users




(1) 2 »


Re: 有關#define和RES?!
#15
高級會員
高級會員


查看用戶資訊
昏倒...

RES 是假指令 .. 不能用在程式段...

真搞不董..你程式的邏輯...@@...


發表於: 2004/11/25 17:48
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#14
資深會員
資深會員


查看用戶資訊
用法不對!

會糾纏在這個問題是因為你們有些基本概念沒搞清楚,看完整文件比我來說清楚。像是有單一asm(不必link)與多asm(要link)兩種用法‧‧‧

說最後一次:

拜託你們 讀講義!

有三份與 MPLAB IDE / MPASM 相關,
推薦先讀我打粗紅圈的那份 MPASM 一日講義。

說到沒力‧‧‧

發表於: 2004/11/25 15:09
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#13
資深會員
資深會員


查看用戶資訊
除了用equ直接定址可以在watch看到變數名稱外
其他方式好像都看不到
所以只能自己算算位址數
再輸入位址來看了 (好麻煩 ~>_<~)

發表於: 2004/11/25 13:12
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#12
高級會員
高級會員


查看用戶資訊
沒關係...
還有個問題...
我用WATCH看...
我找不到count這個變數...
是本來就找不到ㄇ?!
還是....???

發表於: 2004/11/25 12:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#11
資深會員
資深會員


查看用戶資訊
參照:

tonys 寫道:
教你兩種方法合用:

1. 右邊的教材及講義區有 MPASM 的中文教材,可下載閱讀。  →  →  →

2. 你可以試寫程式,放入上述指令,組譯完成後,用 View→Disassembly Listing 看看到底組譯出什麼東西。

兩相對照,應更容易瞭解。

不止這個問題可用,其他問題也可用此方法。


縮圖

發表於: 2004/11/25 11:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#10
資深會員
資深會員


查看用戶資訊
那我就不知道了
我以前這樣寫
用WATCH來看都正常

發表於: 2004/11/25 8:50
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#9
高級會員
高級會員


查看用戶資訊
Hi~~jubel!
你說"RES是根據上一行的位址依序排列"
我有隨便寫個小程式測試...
可好像沒有醬ㄋㄟ?!
下面是我經過編譯後的結果!
1:         list p=18f252
                                                  2
:         #include<p18f252.inc>
                                                  
3:     ;****************************
                                                  
4:     number    equ    0x085
                                                  5
:     count    RES    2
                                                  6
:         org    0x00000
000000    EF02     
GOTO 0x4                       7:         goto    start
                                                  8
:     start
000004    0100     MOVLB 0                        9
:         banksel    number
000006    0E63     MOVLW 0x63                     10
:        movlw    .99
000008    6F85     MOVWF 0x85BANKED             11:        movwf    number
00000A    0100     MOVLB 0                        12
:        banksel    count
00000C    0EFE     MOVLW 0xfe                     13
:        movlw    .254
00000E    6F00     MOVWF 0
BANKED                14:        movwf    count,1
000010    0E0B     MOVLW 0xb                      15
:        movlw    .11
000012    6F01     MOVWF 0x1
BANKED              16:        movwf    count+1,1
000014    0E23     MOVLW 0x23                     17
:        movlw    .35
000016    6F02     MOVWF 0x2
BANKED              18:        movwf    count+2,1

發表於: 2004/11/24 20:15
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#8
資深會員
資深會員


查看用戶資訊
RES是保留變數位址
功能類似EQU
但EQU是直接定址,可以隨便你排,而且只能是8位元
而RES是根據上一行的位址依序排列,可以多位元組

假設AAA要放在0Ah,BBB要放在0Ch,都是8位元,則
AAA EQU 0Ah
BBB EQU 0Ch

用RES的話
首先要先定義一個絕對位址(用CBLOCK好像也可以)
AAA EQU 0Ah
BBB RES 2
CCC RES 1

編譯後的結果是
8位元AAA在0Ah
16位元BBB在0Bh跟0Ch
8位元CCC在0Dh

建議你可以隨便寫一個小程式
然後用軟體模擬,看WATCH視窗來試

發表於: 2004/11/24 9:13
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#7
高級會員
高級會員


查看用戶資訊
聽你醬子分析...
好像用RES沒多大的意義....
感覺上好像只是不用多花時間想一些Label名稱...
和不用考慮哪個位址已經被用走了...
我想我們一般程式所使用的變數應該不多...
應該不需要用到RES指令!
有點大材小用的感覺!!!
而且在想要的位址安排自己認為好記的名稱...
這樣寫起程式應該比較簡單點ㄅ!

發表於: 2004/11/23 22:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 有關#define和RES?!
#6
高級會員
高級會員


查看用戶資訊
不算是間接定址喔..
PIC沒有那麼強的定只能力,他只有直接定址的方式,
如果要作間接,只能用INDF配合FSR.

對編譯器來說..只是單純以Lalel取代成數值,然後在編譯成Hex ...怎麼說呢.?假設 LEDBUFFER 編譯器分配給他的位址是0x20 (0x21 , 0x22 沒有Lalel 但是編譯器會把該位址空出來,不安排給其他的Lalel)
ex:
.data
LEDBUFFER RES 3
.code
clrf LEDBUFFER
clrf LEDBUFFER+1
clrf LEDBUFFER+2

以上述例子.假設LEDBUFFER 編譯器分配給他0x20 ..則實際的程式會變成

clrf 0x20
clrf 0x21
clrf 0x22

關於排列的方式我不太清楚,不過自己的使用經驗都是順序排下來的.


發表於: 2004/11/23 0:27
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... ]

教育訓練中心

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