完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,有谁知道如何为SPI从属设备映射I/O引脚?我使用PIC32 MX130F256i AM试图从主设备接收数据,我的SD1I引脚在RP8上,SCKR引脚是RP14。我知道当我用另一个PIC测试时,主机工作得很好,但是当我连接到PIC32 SLAVEN的数据表时,它不工作。是SDI1R=0B0100;但到目前为止,我没有工作,我没有收到任何数据在缓冲区。如果有人知道帮助谢谢。
以上来自于百度翻译 以下为原文 Hello folks does anyone understand how to map i/o pins for SPI slave? I am using a PIC32MX130F256 I am trying to set up the slave device to receive data from a master my SD1I pin is on RP8 and the SCKR pin is RP14. i know the master works fine when I test with another pic but doesnt work when I connect to the PIC32 slave On the data sheet its says to do something like this SDI1R = 0b0100 ; but so far not working for me I dont receive any data in the buffer. if anyone understands help out thanks /* * File: my32bit_slave_spi.c * Author: semed * * Created on July 8, 2017, 12:00 PM */ #include "xc.h" #include "config.h" #define bufsize (10) char myRx_buffer[bufsize]; void doHeartBeat(void); int main(void) { int rData,j; IEC0CLR=0x03800000; // disable all interrupts SPI1CON = 0; // Stops and resets the SPI1. rData=SPI1BUF; // clears the receive buffer IFS0CLR=0x03800000; // clear any existing event IPC5CLR=0x1f000000; // clear the priority IPC5SET=0x0d000000; // Set IPL=3, Subpriority 1 IEC0SET=0x03800000; // Enable RX, TX and Error interrupts SPI1STATCLR=0x40; // clear the Overflow SPI1CON=0x8000; // SPI ON, 8 bits transfer, Slave mode //TRISBSET=0x4100; //set RB8 and RB14 as inputs _TRISB14=1; _TRISB8=1; //ANSELBSET =0; //ANSELBbits.ANSB15 =0; SYSKEY = 0xAA996655; SYSKEY = 0x556699AA; SDI1R = 0b0100 ; //config serial data in SDI to RP8// SYSKEY = 0x0; // SDI1R = 0b1010; //config serial data in SDI to RP10// j=0; while(1){ //ANSELBSET = 0; while (!SPI1STATbits.SPIRBF); myRx_buffer[j++]= SPI1BUF; if(j>=bufsize) j=0; doHeartBeat(); } return 0; } /*void doHeartBeat(void){ int i; TRISBSET=0x0000; for(i=0;i<5666;i++) LATBINV =0x2000; }*/ void doHeartBeat(void){ int i; _TRISB13 = 0; LATBINV = 0x2000; for(i=0;i<5666;i++); // _LATB15=0; } |
|
相关推荐
4个回答
|
|
你为什么不跟踪以前的帖子呢?HTTP://www. McCHIP.COM/FUMMS/M1003562.ASPX
以上来自于百度翻译 以下为原文 Why didn't you follow up your previous post ? http://www.microchip.com/forums/m1003562.aspx |
|
|
|
嗨,罗迪斯,谢谢。没有人回应旧的帖子,所以我决定创造一个新的职位。
以上来自于百度翻译 以下为原文 hi rodims thanks.. no one was responding to the old post anymore so i decided to create a new post |
|
|
|
请不要。如果有必要的话,把额外的信息添加到你原来的文章中。如果你开始在多个主题中得到平行的答案,它会变得非常混乱。
以上来自于百度翻译 以下为原文 Please don't. Add extra information to your original post if necessary. It becomes very confusing for everyone if you start getting parallel sets of answers in multiple topics. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
4844 浏览 9 评论
1846 浏览 8 评论
1760 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2971 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2074 浏览 5 评论
470浏览 1评论
1123浏览 1评论
313浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
374浏览 0评论
270浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-5-12 07:48 , Processed in 1.039586 second(s), Total 82, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号