• 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






C中程序嵌套有限制嗎
#1
資深會員
資深會員


查看用戶資訊
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
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... ]

教育訓練中心

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