[求助]調(diào)試程序出現(xiàn)以下錯(cuò)誤

我用CH375作USB主機(jī)方式,以串口方式讀取U盤數(shù)據(jù)。參考貴公司提供的CH375LIB\AVR\FILELIBB\EXAM1 CH375HFT.C程序,添加的頭文件是CH375HFB.H。但為什么編譯出現(xiàn)這種錯(cuò)誤呢?我用的是ICC編譯器。 CH375HFT.C程序的頭文件也就只有CH375HFB.H這一個(gè)!

E:\iccv7avr\bin\imakew -f CH375TEST8.mak iccavr -o CH375TEST8 -g -e:0x4000 -ucrtatmega.o -bfunc_lit:0x54.0x4000 -dram_end:0x45f -bdata:0x60.0x45f -dhwstk_size:16 -beeprom:0.512 -fihx_coff -S2 @CH375TEST8.lk -lcatmega !ERROR file 'ch375test8.o': undefined symbol '_pDISK_BASE_BUF' !ERROR file 'ch375test8.o': undefined symbol '_CH375LibConfig' !ERROR file 'ch375test8.o': undefined symbol '_CH375DiskReady' !ERROR file 'ch375test8.o': undefined symbol '_CH375Init' !ERROR file 'ch375test8.o': undefined symbol '_CH375IntStatus' !ERROR file 'ch375test8.o': undefined symbol '_delay1us' !ERROR file 'ch375test8.o': undefined symbol '_CH375DiskStatus' !ERROR file 'ch375test8.o': undefined symbol '_LCD_write_char' !ERROR file 'ch375test8.o': undefined symbol '_CH375GetVer' !ERROR file 'ch375test8.o': undefined symbol '_CH375DiskConnect' E:\iccv7avr\bin\imakew.exe: Error code 1 Done: there are error(s). Exit code: 1. Mon Apr 27 15:41:48 2009

還需要添加CH375HFA.A文件進(jìn)去才能編譯


是CH375HFA.A還是CH375HFB.A?


把CH375HFB.A添加進(jìn)去后,編譯,卻出現(xiàn)下面的這些錯(cuò)誤!是什么意思?我從來沒創(chuàng)建過CH375MAI這樣的工程或C文件。

E:\iccv7avr\bin\imakew -f CH375TEST8.mak iccavr -o CH375TEST8 -g -e:0x4000 -ucrtatmega.o -bfunc_lit:0x54.0x4000 -dram_end:0x45f -bdata:0x60.0x45f -dhwstk_size:16 -beeprom:0.512 -fihx_coff -S2 @CH375TEST8.lk L:\最新畢設(shè)\AVR程序\CH375HFB.A -lcatmega !ERROR file 'CH375MAI.o': undefined symbol 'push_gset1' !ERROR file 'CH375MAI.o': undefined symbol 'push_gset2' !ERROR file 'CH375MAI.o': undefined symbol 'push_gset3' !ERROR file 'CH375MAI.o': undefined symbol 'push_gset4' !ERROR file 'CH375MAI.o': undefined symbol 'push_gset5' !ERROR file 'CH375MAI.o': undefined symbol '_xFileNameEnumer' !ERROR file 'ch375test8.o': undefined symbol '_delay1us' !ERROR file 'CH375MAI.o': undefined symbol 'pop_gset1' !ERROR file 'CH375MAI.o': undefined symbol 'pop_gset2' !ERROR file 'CH375MAI.o': undefined symbol 'pop_gset3' !ERROR file 'CH375MAI.o': undefined symbol 'pop_gset4' !ERROR file 'CH375MAI.o': undefined symbol 'pop_gset5' !ERROR file 'ch375test8.o': undefined symbol '_LCD_write_char' E:\iccv7avr\bin\imakew.exe: Error code 1 Done: there are error(s). Exit code: 1. Mon Apr 27 19:22:55 2009


你在你的工程里面需要添加一個(gè)CH375HFT.C還有一個(gè)就是CH375HFB.A文件,然后把CH375HFB.H文件拷貝到工程目錄下面去,選擇MEGA32以上的單片機(jī)就可以進(jìn)行編譯了.


我這回直接把貴公司提供的CH375LIB\AVR\FILELIBB\EXAM1 CH375HFT.C程序拿來編譯,都沒修改到任何地方。像4樓所說的,設(shè)置工程文件如 http://m.findthetime.net/bbs/View.asp?S=101&I=1511 所說,可是還是出現(xiàn)以下錯(cuò)誤。

!W C:\DOCUME~1\Administrator\桌面\新建文件夾\CH375HFB.H(302): unknown preprocessor directive "#endifCH375LibConfig" !E C:\DOCUME~1\Administrator\桌面\新建文件夾\CH375HFB.H(879): "#endif" missed for if-group started at line 14 E:\iccv7avr\bin\imakew -f XX.mak iccavr -c -e -D__ICC_VERSION="7.13" -DATMEGA -DATMega128 -l -g -Mavr_enhanced -Wf-use_elpm C:\DOCUME~1\Administrator\桌面\新建文件夾\CH375HFT.C !W C:\DOCUME~1\Administrator\桌面\新建文件夾\CH375HFB.H(302): unknown preprocessor directive "#endifCH375LibConfig" !E C:\DOCUME~1\Administrator\桌面\新建文件夾\CH375HFB.H(879): "#endif" missed for if-group started at line 14 E:\iccv7avr\bin\imakew.exe: Error code 1 Done: there are error(s). Exit code: 1. Tue Apr 28 14:56:25 2009


你發(fā)個(gè)E-MAIL到我們技術(shù)支持信箱,我們給你發(fā)一個(gè)完整的工程:tech@wch.cn


郵件已發(fā)送,麻煩注意查收。


程序已經(jīng)給你發(fā)送,你那過去進(jìn)行編譯就可以了


我用ICC AVR 6.31A編譯了,可是出現(xiàn)以下錯(cuò)誤:

!E C:\DOCUME~1\Administrator\桌面\avr\avr\CH375HFT.C(23): Could not find include file !E C:\DOCUME~1\Administrator\桌面\avr\avr\CH375HFT.C(24): Could not find include file !E C:\DOCUME~1\Administrator\桌面\avr\avr\CH375HFT.C(25): Could not find include file


 這幾個(gè)頭文件在ICC編譯器的安裝目錄下,在編譯器中設(shè)置一下路徑就可以了.建議你去看一下ICC編譯器的使用說明


10樓說對了,可是我自己做了個(gè)測試CH375識別U盤程序,它卻識別不了,一直停留在“Wait Upan”等待U盤這句話,這是怎么回事? 我插入U(xiǎn)盤也沒跳過。 我采用CH375串口方式,單片機(jī)(M16) 《====》CH375《====》USB 串口 U盤

以下是我的測試程序: #include #include #include #include "CH375HFB.H" #include "1602.h"

#define CH375_INT_WIRE ( PINB & 0x10 ) /* PINB.4, CH375的中斷線INT#引腳,連接CH375的INT#引腳,用于查詢中斷狀態(tài) */

void xWriteCH375Cmd( UINT8 mCmd ) { UCSRA|=0x41;//TXCIE=1;TXB8=1; //TXCIE = 1,發(fā)送時(shí)使能中斷TXB8 = 1, 1表示地址,0 表示數(shù)據(jù) UCSRB|=0x40;//TXC=1; 發(fā)送數(shù)據(jù)開始 UDR = mCmd; //發(fā)送緩沖器 while (UCSRB==0x40); delay2us( ); delay2us( ); }

void xWriteCH375Data( UINT8 mData ) { UCSRA|=0x40;//TXCIE = 1,發(fā)送時(shí)使能中斷TXB8 = 0, 1表示地址,0 表示數(shù)據(jù) TXB8=0; UCSRB|=0x40; //TXC=1 發(fā)送數(shù)據(jù)開始 UDR = mData; while (UCSRB==0x40); delay2us( ); }

UINT8 xReadCH375Data( void ) { delay2us(); UCSRA|=0x80;//RXCIE = 1,發(fā)送時(shí)使能中斷RXB8=0, 1表示地址,0 表示數(shù)據(jù)RXB8=0; UCSRB|=0x80;//接收數(shù)據(jù)開始 RXC=1 while (UCSRB==0x80); return(UDR); }

/* 延時(shí)2微秒,不精確 */ void delay2us( ) { unsigned char i; for ( i = 2; i != 0; i -- ); }

/* 延時(shí)指定毫秒時(shí)間,根據(jù)單片機(jī)主頻調(diào)整,不精確 */ void mDelaymS( UINT8 ms ) { UINT16 i; while ( ms -- ) for ( i = 2600; i != 0; i -- ); }

/* 檢查操作狀態(tài),如果錯(cuò)誤則顯示錯(cuò)誤代碼并停機(jī) */ void mStopIfError( UINT8 iError ) { if ( iError == ERR_SUCCESS ) return; /* 操作成功 */ LCD_write_string(0,0,"Error"); /* 顯示錯(cuò)誤 */ }

void mInitSTDIO( ) { UBRRH = 0; UBRRL = 47; /* 9600bps@7.3728MHz */ UCSRB = 0x1C; /* BIT(RXEN) | BIT(TXEN);|BIT(UCSZ2) */ UCSRC = 0x06; /* BIT(UCSZ1) | BIT(UCSZ0); 9個(gè)數(shù)據(jù)位*/

} /* 設(shè)置CH375為USB主機(jī)方式 */ unsigned char mCH375Init( ) { unsigned char c, i; xWriteCH375Cmd( CMD_SET_USB_MODE ); /* 設(shè)置USB工作模式 */ xWriteCH375Data( 6 ); /* 模式代碼,自動檢測USB設(shè)備連接 */ for ( i = 0xff; i != 0; i -- ) { /* 等待操作成功,通常需要等待10uS-20uS */ c =UDR; if ( c == CMD_RET_SUCCESS ) break; /* 操作成功 */ } if ( i != 0 ) return( USB_INT_SUCCESS ); /* 操作成功 */ else return( 0xff ); /* CH375出錯(cuò),例如芯片型號錯(cuò)或者處于串口方式或者不支持 */ }

void main( ) { UINT8 i; //UINT16 NewSize, count; /* 因?yàn)镽AM容量有限,所以NewSize限制為16位,實(shí)際上如果文件較大,應(yīng)該分幾次讀寫并且將NewSize改為UINT32以便累計(jì) */ //UINT8 *pCodeStr; PORTA = 0x00;//端口初始化 DDRA = 0xFF; PORTC = 0xFF;//端口初始化 DDRC = 0xFF; init_lcd(); init_lcd(); mInitSTDIO( ); LCD_write_string(0,0,"Start" ); i = mCH375Init( ); /* 初始化CH375 */ mStopIfError( i ); mDelaymS( 100 ); mDelaymS( 100 ); mDelaymS( 100 ); mDelaymS( 100 ); i = CH375LibInit( ); /* 初始化CH375程序庫和CH375芯片,操作成功返回0 */ mStopIfError( i ); /* 其它電路初始化 */

while ( 1 ) { LCD_write_string(0,0,"Wait Udisk" ); mDelaymS( 100 ); mDelaymS( 100 ); mDelaymS( 100 ); while ( CH375DiskStatus < DISK_CONNECT ) { /* 查詢CH375中斷并更新中斷狀態(tài),等待U盤插入 */ if ( CH375DiskConnect( ) == ERR_SUCCESS ) break; /* 有設(shè)備連接則返回成功,CH375DiskConnect同時(shí)會更新全局變量CH375DiskStatus */ mDelaymS( 100 ); } } /* 檢查U盤是否準(zhǔn)備好,有些U盤不需要這一步,但是某些U盤必須要執(zhí)行這一步才能工作 */ for ( i = 0; i < 5; i ++ ) { /* 有的U盤總是返回未準(zhǔn)備好,不過可以被忽略 */ mDelaymS( 100 ); LCD_write_string(0,0,"Ready" ); mDelaymS( 100 ); mDelaymS( 100 ); mDelaymS( 100 ); if ( CH375DiskReady( ) == ERR_SUCCESS ) break; /* 查詢磁盤是否準(zhǔn)備好 */ } LCD_write_string(0,0,"Open"); mDelaymS( 100 ); mDelaymS( 100 ); mDelaymS( 100 ); }


建議你先看一下操作步驟再去操作.給你發(fā)的文件里面應(yīng)該有參考程序,不需要mCH375Init,在CH375LIBInit里面已經(jīng)做了,現(xiàn)在你先做測試命令,(參考CH375DS1),測試命令通過了在去操作其他的,否則沒有任何意義.


我要做串口方式,不是只有CH375做USB主機(jī)情況下才能用串口方式嗎?所以我用到 /* 設(shè)置CH375為USB主機(jī)方式 */ unsigned char mCH375Init( ) 這個(gè)函數(shù),而CH375LIBInit這個(gè)函數(shù)只是初始化CH375程序庫和CH375芯片而已,不是這樣嗎?


是的,但首先你要保證硬件連接無誤,以及三個(gè)讀寫函數(shù)都正確,所以建議你先做測試命令


操作U盤,CH375必須設(shè)置為主機(jī)方式才可以.在初始化時(shí),自然會將CH375設(shè)置為主機(jī)模式.


只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频