4 回答

TA貢獻1817條經驗 獲得超6個贊
MPLAB
C18提供的庫是使用大代碼模型編譯(-ml 命令行選項)的。默認情況下,MPLAB
IDE和編譯器將使用小代碼模型編譯應用程序。例如,隨編譯器提供的printf函數(shù)期望收到“const far rom char
*”,但沒有為應用程序選擇大代碼模型時,應用程序實際發(fā)送“const near rom char *”到printf
函數(shù)。正是far和near間的差別引起了“type qualifier mismatch in
assignment”警告。要消除這些警告,應采取以下三種措施中的一種:
1) 使用小代碼模型重新編譯隨MPLAB C18 提供的庫(僅在所有應用程序均使用小代碼模型時推薦);
2) 在IDE 中為特定應用程序啟用大代碼模型(可能會增加代碼尺寸);
3) 將常量字符強制轉換為常量far rom 字符串指針,如:printf ((const far rom char *)”This is a test\n\r”);
其中2)更改方法如下:
當通過包含stdio.h 使用標準庫時,應為項目選擇大代碼模型。轉到Project>Build Options>Project
對話框,并選擇MPLAB C18 選項卡,然后選擇Categories: Memory Model (類別:存儲模型)并選中Large code
model (> 64Kbytes) (大代碼模型(> 64 KB))。

TA貢獻1836條經驗 獲得超5個贊
主要軟件版本: 3.1
主要軟件修正版本: N/A
次要軟件: N/A
解答:回調函數(shù)是在某些特定的條件下由Testsdand引擎調用的序列。Testsdand有三種回調函數(shù)序列,取決于回調函數(shù)在哪里定義以及調用回調函數(shù)的實體。
Model回調函數(shù)Model回調函數(shù)是在過程模型(process model)文件或是在客戶序列(client sequence)文件中定義的,并且是在過程模型(process model)中的序列調用的。Model回調函數(shù)可以實現(xiàn)過程模型(process model)中的每個序列自定義的運行。您可以在過程模型(process model)文件中創(chuàng)建Model回調函數(shù),標記為Model回調函數(shù),并且在執(zhí)行進入點(execution entry points.)調用。如果在序列文件中定義與過程模型(process model)文件同名的回調函數(shù),就可以按照自定義的序列文件中的序列執(zhí)行,更改在Edit>>Sequence File Callbacks。
Engine 回調函數(shù)Engine 回調函數(shù)的名稱是預先定義的,并且由引擎在特定的執(zhí)行進入點調用。根據(jù)Engine 回調函數(shù)定義的位置不同,可分為三組,Engine 回調函數(shù)可以分別在StationCallbacks.seq, the process model file, 或者 the test sequence file中定義。
Front-End回調函數(shù)Front-End回調函數(shù)位于Front-EndCallbacks.seq file中。用戶可以在FrontEndCallbacks.seq中以序列的方式自定義要進行的前端操作。FrontEndCallbacks.seq在目錄\Components\NI\Callbacks\FrontEnd中。Front-End回調函數(shù)也支持多操作界面共享前端操作,比如說用戶登陸窗口。
相關鏈接:Developer Zone Tutorial: Adding Custom Callbacks to TestStandModel.seqDeveloper Zone Tutorial: Modifying How TestStand Executes Sequences (Changing the Default TestStand Process Model)Developer Zone Tutorial: When should I Implement Changes to the Process Model Instead of Using Callbacks?

TA貢獻1797條經驗 獲得超6個贊
scanf("%d",&num);
printf("%d",num);
因為scanf and printf是格式化輸出,所以分兩個部分,第一部分用分號擴起,%加格式,%d代表整數(shù)十進制,后面是相關數(shù)據(jù),但scanf 將取得數(shù)據(jù) 放到num地址 所以加取地址符號&
而printf使用是 直接跟想輸出的數(shù)的變量名字num
#include <stdio.h>
void main( void )
{
int i, result;
float fp;
char c, s[81];
wchar_t wc, ws[81];
printf( "\n\nEnter an int, a float, two chars and two strings\n");
result = scanf( "%d %f %c %C %s %S", &i, &fp, &c, &wc, s, ws );
printf( "\nThe number of fields input is %d\n", result );
printf( "The contents are: %d %f %c %C %s %S\n", i, fp, c, wc, s, ws);
wprintf( L"\n\nEnter an int, a float, two chars and two strings\n");
result = wscanf( L"%d %f %hc %lc %S %ls", &i, &fp, &c, &wc, s, ws );
wprintf( L"\nThe number of fields input is %d\n", result );
wprintf( L"The contents are: %d %f %C %c %hs %s\n", i, fp, c, wc, s, ws);
}
輸出
Enter an int, a float, two chars and two strings
71
98.6
h
z
Byte characters
The number of fields input is 6
The contents are: 71 98.599998 h z Byte characters
Enter an int, a float, two chars and two strings
36
92.3
y
n
Wide characters
The number of fields input is 6
The contents are: 456 92.300003 y n Wide characters
添加回答
舉報