作者fmdjyl (小D(滴))
看板ASM
標題Fw: [問題] TI用C遇到的問題~~
時間Thu Mar 7 16:08:08 2013
※ [本文轉錄自 C_and_CPP 看板 #1HE4hJBI ]
作者: fmdjyl (小D(滴)) 看板: C_and_CPP
標題: [問題] TI用C遇到的問題~~
時間: Thu Mar 7 16:07:45 2013
原本在51上跑~是正常的~~
但換到TI上...這段都說有問題.
已弄不出語法上有什麼問題???
麻煩懇請指教~~
先謝謝大家
錯誤點在:Show_String(1,&Name,0x06,XLevel+0x00)
出現訊息為:
Error[Pe167]: argument of type "unsignhar (*)[9]" is incompatible whit parameter of type
"unsigned char *"
===============================================
int main( void )
{
unsigned char Name[]={1,1,1,1,1,1,1,1,0};
for(;;)
{
Show_String(1,&Name,0x06,XLevel+0x00);
}
}
unsigned char Ascii_1[5][5]={ // Refer to "Times New Roman" Font Database...
// Basic Characters
{0x3E,0x51,0x49,0x45,0x3E}, // ( 1)
{0x00,0x42,0x7F,0x40,0x00}, // ( 2)
{0x42,0x61,0x51,0x49,0x46}, // ( 3)
{0x21,0x41,0x45,0x4B,0x31}, // ( 4)
{0x18,0x14,0x12,0x7F,0x10}, // ( 5)
};
void Show_String(unsigned char a, unsigned char *Data_Pointer, unsigned char
b, unsigned char c)
{
unsigned char *Src_Pointer;
Src_Pointer=Data_Pointer;
Show_Font57(1,96,b,c); // No-Break Space
// Must be written first before the string start...
while(1)
{
Show_Font57(a,*Src_Pointer,b,c);
Src_Pointer++;
c+=6;
if(*Src_Pointer == 0) break;
}
}
void Show_Font57(unsigned char a, unsigned char b, unsigned char c, unsigned
char d)
{
unsigned char *Src_Pointer;
unsigned char i;
switch(a)
{
case 1:
Src_Pointer=&Ascii_1[(b-1)][0];
break;
}
Set_Start_Page(c);
Set_Start_Column(d);
I2C_Start();
I2C_O(0x40);
I2C_Ack();
for(i=0;i<5;i++)
{
I2C_O(*Src_Pointer);
I2C_Ack();
Src_Pointer++;
}
I2C_O(0x00);
I2C_Ack();
I2C_Stop();
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.251.176.110
※ 發信站: 批踢踢實業坊(ptt.cc)
※ 轉錄者: fmdjyl (60.251.176.110), 時間: 03/07/2013 16:08:08
1F:推 ruemann:改成 &Name[0] 看看 03/07 16:40
2F:推 kdjf:是直接 Name 吧 03/07 19:23
3F:→ fmdjyl:已測試成功.把&去掉就可以~只是還不知道為什麼KEILC~51可以 03/07 21:18
4F:→ fmdjyl:IAR的TI卻不行這樣寫 ~~~ 03/07 21:18
5F:→ fmdjyl:謝謝樓上幾位樓主的幫助~~萬般感謝~~~ 03/07 21:19
6F:→ Jhih8051:不同的compile會有差,個人覺得IAR比較嚴謹,NAME直接就 03/09 00:29
7F:→ Jhih8051:是指向位址了,不用再加& 03/09 00:30
8F:→ syura945:keil可以compile不代表結果是對的 這程式明顯寫錯 06/01 22:51