• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   3 Anonymous Users






Re: 關於C和組語同時使用
#10
版主
版主


查看用戶資訊
參照:

Alecfox 寫道:
請問 如果在DEBUG模式下
每次RESET 都會出現 STARTUP.AS檔案
要怎樣設定才可以讓IDE不出現這個檔案 ??
不然每次都會彈出這個視窗 = =

START.AS 是 Hi-Tech PICC 的啟動模組,跟C18 樣的方式如上所述,Config --> Setting --> Debug 下的選項下選擇 reset 後停在main() 。

發表於: 2009/10/19 17:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#9
資深會員
資深會員


查看用戶資訊
請問 如果在DEBUG模式下
每次RESET 都會出現 STARTUP.AS檔案
要怎樣設定才可以讓IDE不出現這個檔案 ??
不然每次都會彈出這個視窗 = =

發表於: 2009/10/19 13:47
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#8
新會員
新會員


查看用戶資訊
感謝Ryang的回答。

發表於: 2009/10/16 11:23
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#7
版主
版主


查看用戶資訊
剛再測試一下,Build 完後會叫出 c018i.o 的畫面,但 reset 後就直接跳到main( ) 了。記住一點其實 c018i.c 也是你的程式,她是用來設定變數初始值、堆疊指標、一般通用指標等必需的設定。也就是說程式必須先執行 c018i.c 後你的程式才會正確的執行。

當然在 debug 過程中是忽略它的,只要管 main( ) 開市就可以了。

發表於: 2009/10/16 11:14
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#6
新會員
新會員


查看用戶資訊
參照:

Ryang 寫道:
在MPLAB IDE 下,Reset 程式後後挑出啟動模組的程式。
可以在 Config --> Setting 下選擇程式在 Reset 後直接修執行啟動模組後在main( ) 停下來,這樣啟動模組就不會被叫出來了。


感謝Ryang的回應。
按照您說的方式修改以後,仍然會在Build All之後自動跳出c018i.c的程式碼視窗。
不過我想請問一下如果這是否只是MPLAB IDE的視窗設定問題,而不是程式碼在連結或是執行上的錯誤?如果只是設定問題,而不會影響到任何source code的運作和執行,那我就先忽略不管它了。
(BUILD SUCCEEDED,沒有任何warning)
謝謝。

發表於: 2009/10/16 10:44
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#5
版主
版主


查看用戶資訊
在MPLAB IDE 下,Reset 程式後後挑出啟動模組的程式。
可以在 Config --> Setting 下選擇程式在 Reset 後直接修執行啟動模組後在main( ) 停下來,這樣啟動模組就不會被叫出來了。

Attach file:



jpg  (0.00 KB)


發表於: 2009/10/16 10:05
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#4
新會員
新會員


查看用戶資訊
感謝Ryang的回應,不過可能誤會了我的語意,讓我釐清一下。
1.
extern void asm_function(void); 此為函數的原型宣告,不用加 extern

之所以加extern,是因為在曾百由老師的書中有提到:
Page_99:在C語言程式中必須要將被呼叫的組合語言函式宣告為外部(extern)函式。
此extern void asm_function(void); 為書中之範例。


2.
GLOBAL asm_function global 不是 label 她是個指令,在組語裡有人將指令寫在第一個位置的嗎?

GLOBAL是一個directive,的確不應該放在第一個位置,這個回答解決了兩個warning的問題,非常感謝!


3.
這是啟動模組 c018i.c 的程式,主要是將 Reset 的執行進入點轉向到 startup 的程式去執行。你沒看到有 goto 指令嗎?[/quote]
我知道這是啟動模組的程式,不過我的問題在每次Build All之後都會自動跳出c018i.c的程式碼視窗
不知道這種情況是代表什麼意思。

麻煩各位先進再指點一下,謝謝。

發表於: 2009/10/16 9:49
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#3
版主
版主


查看用戶資訊
參照:

u901833 寫道:
好像語意有點不清,再重新排版一次。
麻煩有經驗的先進們指點一下,
謝謝。
----------------------------
u901833 寫道:
各位先輩大家好:
想請問一下,小弟在用MCC18時,想試試cross-compiler的功能,於是寫了一個ex1.c和ex1.asm都include在Source Files裡,
我用的是MPLAB IDE v8.36
ex1.c及ex1.asm的兩個檔案內容如下
ex1.c:
#include <stdio.h>
#pragma config WDT = OFF
extern void asm_function(void);  [color=ff0000此為函數的原型宣告,不用加 extern [/color]
unsigned int c_variable;
void main (void)
{
printf ("Hello, world!n");
c_variable 0;
printf ("%dn",c_variable);
asm_function();
printf ("%dn",c_variable);
while (
1);
}

ex1.asm:
EXTERN c_variable
MYCODE        CODE
asm_function
            MOVLW    0x0f
            MOVWF    c_variable
            
RETURN
                    GLOBAL    
asm_function [color=ff0000] global 不是 label 她是個指令,在組語裡有人將指令寫在第一個位置的嗎? [/color]
            
END

執行之後以MPLAB SIM Uart1可以看到
Hello, world!
0
15
表示執行正常。

但是在Build All之後,出現了兩個warning,分別是Found directive in column 1. (EXTERN)及Found directive in column 1. (GLOBAL),程式執行上都沒有問題,但就是有這兩個討人厭的warning,請問該如何解決?
另外,每次Build All之後,都是自動跳出c018i.c的檔案並且有藍色箭頭指向
_entry (void)
{
_asm goto _startup _endasm
}
中的_asm goto _startup _endasm,
請問這是怎麼回事?


這是啟動模組 c018i.c 的程式,主要是將 Reset 的執行進入點轉向到 startup 的程式去執行。你沒看到有 goto 指令嗎?

發表於: 2009/10/15 9:36
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於C和組語同時使用
#2
新會員
新會員


查看用戶資訊
好像語意有點不清,再重新排版一次。
麻煩有經驗的先進們指點一下,
謝謝。
----------------------------
u901833 寫道:
各位先輩大家好:
想請問一下,小弟在用MCC18時,想試試cross-compiler的功能,於是寫了一個ex1.c和ex1.asm都include在Source Files裡,
我用的是MPLAB IDE v8.36
ex1.c及ex1.asm的兩個檔案內容如下
ex1.c:
#include <stdio.h>
#pragma config WDT = OFF
extern void asm_function(void);
unsigned int c_variable;
void main (void)
{
printf ("Hello, world!n");
c_variable 0;
printf ("%dn",c_variable);
asm_function();
printf ("%dn",c_variable);
while (
1);
}

ex1.asm:
EXTERN c_variable
MYCODE        CODE
asm_function
            MOVLW    0x0f
            MOVWF    c_variable
            
RETURN
GLOBAL    
asm_function
            END

執行之後以MPLAB SIM Uart1可以看到
Hello, world!
0
15
表示執行正常。

但是在Build All之後,出現了兩個warning,分別是Found directive in column 1. (EXTERN)及Found directive in column 1. (GLOBAL),程式執行上都沒有問題,但就是有這兩個討人厭的warning,請問該如何解決?
另外,每次Build All之後,都是自動跳出c018i.c的檔案並且有藍色箭頭指向
_entry (void)
{
_asm goto _startup _endasm
}
中的_asm goto _startup _endasm,
請問這是怎麼回事?

發表於: 2009/10/15 9:13
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於C和組語同時使用
#1
新會員
新會員


查看用戶資訊
各位先輩大家好:
想請問一下,小弟在用MCC18時,想試試cross-compiler的功能,於是寫了一個ex1.c和ex1.asm都include在Source Files裡,但是在Build All之後,出現了兩個warning,分別是Found directive in column 1. (EXTERN)及Found directive in column 1. (GLOBAL),程式執行上都沒有問題,但就是有這兩個討人厭的warning,請問該如何解決?
另外,每次Build All之後,都是自動跳出c018i.c的檔案並且有藍色箭頭指向
_entry (void)
{
_asm goto _startup _endasm
}
中的_asm goto _startup _endasm,
請問這是怎麼回事?
我用的是MPLAB IDE v8.36
ex1.c及ex1.asm的兩個檔案內容如下
ex1.c:
#include <stdio.h>
#pragma config WDT = OFF
extern void asm_function(void);
unsigned int c_variable;
void main (void)
{
printf ("Hello, world!\n");
c_variable = 0;
printf ("%d\n",c_variable);
asm_function();
printf ("%d\n",c_variable);
while (1);
}

ex1.asm:
EXTERN c_variable
MYCODE CODE
asm_function
MOVLW 0x0f
MOVWF c_variable
RETURN
GLOBAL asm_function
END


執行之後以MPLAB SIM Uart1可以看到
Hello, world!
0
15
表示執行正常。
謝謝大家

發表於: 2009/10/13 15:33
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... ]

教育訓練中心

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