• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users






请问
#1
新會員
新會員


查看用戶資訊
我现在用6014A,我在调试SPI时发现一个现象,
我用SPI读外部FLASH,外部FLASH中我已经写入数据,内容为:1,2,3,4,5,6,7,8....顺序值.
如果我把初始化I/O放在SPI的SPI2CON寄存器初始化之前,则读出的数据为1,3,5,7...
如果我把初始化I/O放在SPI的SPI2CON寄存器初始化之后,则读出的数据正常,为1,2,3,4,5...
请问这是为什么,是否初始化I/O有什么顺序问题
谢谢
源程序如下:
//根据输入的片号选择FLASH芯片
//numb数据存储器FLASH芯片号
#define PORTDd PORTD
void selectFlashChip(uchar numb)
{
switch(numb)
{
case 0:
{
PORTDd &= 0xff8f;
PORTDd |=0x0020;
PORTDd =PORTDd;
};break;
case 1:
{
PORTDd &= 0xff8f;
PORTDd |=0x0030;
PORTDd =PORTDd;
};break;
case 2:
{
PORTDd &= 0xff8f;
PORTDd |=0x0040;
PORTDd =PORTDd;
};break;
case 3:
{
PORTDd &= 0xff8f;
PORTDd |=0x0050;
PORTDd =PORTDd;
};break;
default:
{
PORTDd &= 0xff8f;
PORTDd =PORTDd;
//proDealError(selectChipError,0);
}
}
}
void main()
{
....
//selectFlashChip(0); 放在这里,则读出的数据是1,3,5,7,9...
setupSPI2model(); //设置SPI工作模式
selectSPI2baud(1); //设置SPI波特率
useSPI2('Y'); //使能SPI
selectFlashChip(0); //放在这里,则能正常读出数据1,2,3,4...
//该语句必须放在setupSPI2model();
//selectSPI2baud(1); useSPI2('Y'); 的后面
readMemoryLine(xp,0x00000020,buff2,528);
....
}

發表於: 2006/5/30 12:26
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... ]

教育訓練中心

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