完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我使用DS1307 RTC获取时间,但是当我开始从从属设备主设备接收数据时,请挂起。
以上来自于百度翻译 以下为原文 I am using DS1307 RTC to get time but when I start receiving data from slave device master device get hang in I2C2CONbits.RCEN = 1; //set I2C module to receive while(I2C2CONbits.RCEN==1); while (I2C2STATbits.RBF==0) //wait for response { Nop(); } I2C2STATbits.I2COV = 0; data = I2C2RCV; I2C2CONbits.ACKDT = ack; I2C2CONbits.ACKEN = 1; while(I2C2CONbits.ACKEN == 1); I2C_stop(); return data; //return data |
|
相关推荐
18个回答
|
|
如果出现了错误,消息“1”中的代码将挂起(I2C2STATBITS.RBF=0);如果前面的语句:I2C2CONBITS.RCEN返回到0,则没有接收到字节,那么等待RBF将无济于事。迈西尔
以上来自于百度翻译 以下为原文 If there is something wrong, code shown in message #1 will hang in the while ( I2C2STATbits.RBF == 0); loop. If a byte have not been received when the previous statement: I2C2CONbits.RCEN go back to 0, then waiting for RBF will not help. if (I2C2STATbits.RBF == 0) //check for response { __debug_break(); // test what went wrong // what is value of I2C2STATbits.BCL // what is value of I2C2STATbits.IWCOL // what other values in I2C2STAT if (I2C2STATbits.S == 1) I2C_stop(); return error; } Mysil |
|
|
|
如何在C30编译程序中写入上面的位是错误的。i2cIt.h:82:错误:“I2C2STATBITS”没有名为“RW”的成员。
以上来自于百度翻译 以下为原文 I2C2STATbits.RW how to write above bit in C30 compiler I am getting error. I2C_int.h:82: error: 'I2C2STATBITS' has no member named 'RW' |
|
|
|
您好,您可以尝试:I2C2STATBITS.RY-WOR I2C2STATBITS。RYNOTHOWWW,但是该位是由硬件设置和清除的只读状态位,因此在那里写入东西可能没有效果。迈西尔
以上来自于百度翻译 以下为原文 Hi, You may try: I2C2STATbits.R_W or I2C2STATbits.R_NOT_W but that bit is a Read-only status bit that is set and cleared by hardware, so writing something there will likely have no effect. Mysil |
|
|
|
我使用的是20MHz的外部晶体,什么值应该用II2C2BRG得到100kHz的时钟速率。
以上来自于百度翻译 以下为原文 I am using 20Mhz external crystal what value should be use in I2C2BRG to get 100KHz clock rate. |
|
|
|
|
|
|
|
如何生成I2C条件?我使用的是P24FJ64 GC010
以上来自于百度翻译 以下为原文 how to generate Ideal condition for I2C? I am using p24fj64gc010 |
|
|
|
|
|
|
|
I2C的初始条件由I2C信号线SCL和SDA上的上拉电阻安排。I2C信号线的三态控制位应设置为:1;PIN为三态高阻抗输入状态。如果I2C使用可用于模拟信号的引脚,则必须启用数字输入。D通过清除ANSF寄存器中的位。I2C2BRG寄存器的公式和表在MysILE数据表17.2节中。
以上来自于百度翻译 以下为原文 Hi, Initial conditions for I2C is arranged by Pull-Up resistors on I2C signal lines SCL and SDA. Tristate Control Bits for I2C signal lines shall be Set: = 1; for pins to be tristate high impedance input state. If I2C is using pins that may be used for Analog signals, then Digital Input must be enabled by clearing bits in ANSF register. Formulas and tables for I2C2BRG register is in datasheet section 17.2 Mysil |
|
|
|
我写了一个I2C位爆炸程序来解决类似的问题。永不回头。除了它更便携的事实,我们可能会使用另一个处理器家族在未来的重新设计这个产品,如果你想要一个副本(我写了它与DS323 1的RTC芯片)打我,我会尝试找出一种方法来张贴或电子邮件给你好运
以上来自于百度翻译 以下为原文 I wrote an i2c bit bang routine to get around a similar problem you descibed above ... and never looked back. besides its much more portable in light of the fact that we may be using another processor family in a future redesign of this product if you want a copy (i wrote it to talk to the ds3231 rtc chip) hit me up and ill try and figure out a way to post it up or email it to you good luck |
|
|
|
如何设置100kHz时钟速率?我的水晶20MHz
以上来自于百度翻译 以下为原文 How to set 100KHz clock rate ? my crystal 20MHz |
|
|
|
|
|
|
|
我在LCD上接收随机数据,任何人都可以更正我的代码。
以上来自于百度翻译 以下为原文 I am receiving random data on LCD can any one correct my code. I2C_init(); I2C_start(); //dispay_rtc_ACK = I2C_send_byte(0xD0); //dis_cmd(0xCA); //dis_data(dispay_rtc_ACK+48); I2C_send_byte(0xD0); I2C_send_byte(0x00); // I2C_send_byte(0x00); I2C_send_byte(0x80); //CH = 1 Stop oscillator I2C_send_byte(0x20); //Minute I2C_send_byte(0x4); //Hour I2C_send_byte(0x03); //Sunday I2C_send_byte(0x14); //1Date I2C_send_byte(0x11); //1 Jan I2C_send_byte(0x14); //2014 // I2C_send_byte(0x1); I2C_stop(); //Stop the I2C Protocol //Have to start the Clock again I2C_start(); I2C_send_byte(0xD0); I2C_send_byte(0x00); I2C_send_byte(0x00); //start Clock and set the second hand to Zero I2C_stop(); while(1) { dis_cmd(0xC6); RTC_sec=I2C_read(0xD0,0x00); //RTC_min=I2C_read(0xD0,0x01); //RTC_hour=I2C_read(0xD0,0x02); // RTC_sec=BCD2LowerCh(RTC_sec); dis_data(RTC_sec); } Attachment(s) New Text Document.txt (5.35 KB) - downloaded 116 times |
|
|
|
|
|
|
|
|
|
|
|
在PIC16F中,我们可以定义主和从模式。什么样的位应该被设置或清除,以使PIC24F成为I2C中的主控器。
以上来自于百度翻译 以下为原文 As in pic16f we can define SSPCON1:SSPM3:SSPM0: for Master and Slave mode. what bit should be set or clear to make pic24f as a Master in I2C |
|
|
|
我今天检查理想时钟保持低,我认为应该是高的,如何解决这个问题。
以上来自于百度翻译 以下为原文 I check today Ideally clock remain low, I think it should be high, how to resolve this problem. |
|
|
|
什么时候?初始化后直接?执行了一些操作之后?简洁的解释对你没有多大帮助。
以上来自于百度翻译 以下为原文 When? Straight after initialisation? After you perform some operations? Terse explanations will not get you much help. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5234 浏览 9 评论
2026 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3201 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
771浏览 1评论
659浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
588浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
670浏览 0评论
571浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-20 15:53 , Processed in 1.581884 second(s), Total 112, Slave 96 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号