Browsing this Thread:
1 Anonymous Users
|
C中程序嵌套有限制嗎
|
|
資深會員
Joined
: 2008/10/28 21:09 最後登入時間
: 2013/5/29 21:55
Group:
註冊會員
Level : 12 HP : 0 / 290 MP : 61 / 13510 EXP : 61
|
uint8 SD_write_sector(uint32 addr,uint8 *buffer){ uint16 i,tmp,timeout; uint8 respone; uint8 cmd[]={0x58,0x00,0x00,0x00,0x00,0xff}; addr = addr*512; //a sector contain 512 bytes cmd[1] = (uint8)((addr & 0xff000000)>>24); cmd[2] = (uint8)((addr & 0x00ff0000)>>16); cmd[3] = (uint8)((addr & 0x0000ff00)>>8); cmd[4] = (uint8)(addr & 0x000000ff);
watres: SD_Disable(); PORTEbits.RE3=1; //generate 8 pulse SD_wr_byte(0xff); //select SD SD_Enable(); PORTEbits.RE3=0; //write cmd17 SD_wr_byte(cmd[0]); SD_wr_byte(cmd[1]); SD_wr_byte(cmd[2]); SD_wr_byte(cmd[3]); SD_wr_byte(cmd[4]); SD_wr_byte(cmd[5]); //WAITE R1=00,100times timeout=0; do { respone=SD_wr_byte(0xff); timeout++; } while((respone!=0x00)&&(timeout<10)); 為何有時會出現只發前五個SPI時鐘,隔45個時鐘后才再有時鐘,會丟數據?
發表於: 2009/1/8 23:31
|
|
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.