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


Browsing this Thread:   1 Anonymous Users






Re: dsPIC4011與25LC080a使用SPI
#2
版主
版主


查看用戶資訊
我只有寫過用 dsPIC30F 16-bit 的 SPI 與 Digital Potentiometer (MCP41010) 連接。底下就是SPI控制例子,僅供參考:

#define SPI1_CS    PORTDbits.RD7
#define MCP41010_W_CMD     0x1300       // See the data sheet of MCP41010

// Init SPI2 peripheral.
void Init_SPI2(void)
{
    
SPI2CON 0x053B;          // Master mode, 16 bits,no frame and 1:2 prescale
    
SPI2STAT 0x8000;         // enable  SPI 1
    
Flags.Timer 1;
    
TRISGbits.TRISG6 ;
    
TRISGbits.TRISG8 ;
}

void Send_DAC (int DAC_temp)
{
    
int buffer;

    
IFS1bits.SPI2IF 0;                // clear the spi int flag    
       
while (SPI2STATbits.SPIRBFbuffer SPI2BUF;      // dummy read the read buffer
    
SPI1_CS 0;                    // start SPI write
    
SPI2BUF DAC_temp MCP41010_W_CMD;        // load the table value to be SPIed
    
while (!IFS1bits.SPI2IF);             // wait till Tx is done
    
SPI1_CS 1;                    // stop SPI write
}


發表於: 2006/7/5 9:53
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


dsPIC4011與25LC080a使用SPI
#1
初級會員
初級會員


查看用戶資訊
我用16F877與25LC080a用spi作傳輸都沒有問題
可是用dsPIC使用SPI傳輸就不能傳!
不是dsPIC使用8位元傳輸模式,其他跟PIC16F877都差不多
還有哪些地方要注意的,請指教謝謝.

發表於: 2006/7/4 13:06
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... ]

教育訓練中心

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