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


Browsing this Thread:   1 Anonymous Users






Re: c18 問題
#6
高級會員
高級會員


查看用戶資訊
在C18裡的MACRO語法好像是使用IN LINE ASM的用法 , 運算元的用法應該只能使用常數 , 將你的變數RAND3先利定址宣告在特定位址 , 找到RAND3變數位址後 , 直接代入 , 應該就可以了 ,

假設變數宣告位址在0X20

Rrncf(0x20 , 1 , 0);

試試看吧 !

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


Re: c18 問題
#5
新會員
新會員


查看用戶資訊

謝謝指導

void abc(void)
{

Rrncf(RAND3,1,0);

}

可是以上的語法,在編譯時但又產生如下的錯誤訊息


Error [1253] constant operand expected
Error [1253] constant operand expected

發表於: 2004/6/14 15:37
san
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: c18 問題
#4
版主
版主


查看用戶資訊
先看看 MPLAC C18 對一些 Macro 指令所做的一些定義 (PIC18F452.h)如下所示,

#define Nop() {_asm nop _endasm}
#define ClrWdt() {_asm clrwdt _endasm}
#define Sleep() {_asm sleep _endasm}
#define Reset() {_asm reset _endasm}

#define Rlcf(f,dest,access) {_asm movlb f rlcf f,dest,access _endasm}
#define Rlncf(f,dest,access) {_asm movlb f rlncf f,dest,access _endasm}
#define Rrcf(f,dest,access) {_asm movlb f rrcf f,dest,access _endasm}
#define Rrncf(f,dest,access) {_asm movlb f rrncf f,dest,access _endasm}
#define Swapf(f,dest,access) {_asm movlb f swapf f,dest,access _endasm }

Nop( ),Clrwdt( ), Sleep( ) 可直接使用於C程式中,且不需加
入任何參數。
但旋轉的指令就必須依據組合語言的型態指定 unsigned char 型態的變數,儲存的目的地,Access Bank 等三種參數。所以正確的語法
為Rrncf(RAND3,1,0) // 旋轉後存回自己,並使用Access Bank

詳細說明如下:

If dest is 0, the result is stored in WREG, and if dest is 1, the result is stored in var.
If access is 0, the access bank will be selected, overriding the BSR value. If access
is 1, then the bank will be selected as per the BSR value.

發表於: 2004/6/14 10:50
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: c18 問題
#3
版主
版主


查看用戶資訊
從錯誤訊息中看出,該巨集指令需要三個參數。詳情請查:
MPLAB® C18 C COMPILER USER’S GUIDE。

發表於: 2004/6/14 10:36
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: c18 問題
#2
高級會員
高級會員


查看用戶資訊
Nop() 與 nop(); 因該不一樣吧!
Rrncf(RAND3); ??? Rrncf(?? RAND3); 型態?,輸出入?

先學好 TURBO C++ 或 Borland C++ 再學C18!!

基礎先打好!!





發表於: 2004/6/13 0:40
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


c18 問題
#1
新會員
新會員


查看用戶資訊
各位先進請幫忙
void abc(void)
{

Nop();
Rrncf(RAND3);
}

以上的語法,在編譯時會產生如下的錯誤訊息

macro 'Rrncf' expects 3 arguments, but only 1 found
error 1 spawning C:\mcc18\bin\cpp18
Halting build on first failure as requested.

不知如何解除

發表於: 2004/6/12 22:41
san
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... ]

教育訓練中心

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