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


Browsing this Thread:   1 Anonymous Users






Re: c18
#3
管理員
管理員


查看用戶資訊
printf( ) 是一個在 C 李面很標準的 function 但佔用很大的記憶體 , 故 MPLAB C18 在 V2.4 版後才有 support.

在 MPLAB C18 中 , 若 user 未特別指定 , 則輸出一律到 UART. 當然 , 參考 stdio.h 中的定義 , 你會看到以下的宣告

typedef unsigned char FILE;

/* output destination handles */
#define _H_USER ((FILE*)((int)-1))
#define _H_USART ((FILE*)((int)-2))

extern FILE *stderr;
extern FILE *stdout;


只要修改 stdout 的值 = _H_USER , 則 printf 就會被輸出至 user 指定的裝置了 . 當然 , 代價是要自己寫 _user_putc.c . 這個檔案本來是空的. 位置在 mcc18\src\traditional\stdlib\

/* this default version should not do anything. it is entirely a
   placeholder symbol. To keep code size at a minimum, it is declared
   without a return value or parameters. The caller will still clean up 
   the stack frame correctly. 

   When using the _H_USER stream, the function will be implemented in
   application code with the prototype:   
    int _user_putc (char c);
  */
void
_user_putc 
(void)
{
}



總之 , printf 非常複雜 , 非短短篇幅可以道盡 . 辛苦一點 , 看看 Microchip 的 Manual 吧 !



發表於: 2005/4/23 1:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: c18
#2
新會員
新會員


查看用戶資訊
這個問題很幼稚嗎?沒人理我
我在一些範例程式中常看到"printf()的函數,而且輸出的對像是
uart,讓我感到很神奇,但也摸不透如何使用這個函式,並指定輸出的對像

有誰可以回答我,謝謝

發表於: 2005/4/22 10:22
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


c18
#1
新會員
新會員


查看用戶資訊
請問各位大人
c18的函數庫中的printf如何使用 ?
還有如何建入使用者自己的lib ?

發表於: 2005/4/15 22:01
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... ]

教育訓練中心

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