完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,伙计们,我正在学习使用我的PIC18F46K22的I2C通信。我想读和写一个RTCC。是否有一个教程或链接,我可以工作,可以帮助我学习如何使用MCC生成的函数的I2C公文?
以上来自于百度翻译 以下为原文 Hi Guys, I'm learning to use the I2C communications of my PIC18F46K22. I would like to read and write to a RTCC. Is there a tutorial or link that I can work trough that can assist me in learning how to use the MCC generated functions for the I2C comms? |
|
相关推荐
2个回答
|
|
HI,MCC生成的I2C代码,是一个从传输任务队列中工作的中断驱动程序。这是为了使驱动程序和硬件能够在自己的定时上工作,而主程序将能够在不用于控制I2C传输的时间内完成其他工作。这使得驱动文件中的代码:I2C1.H和I2C1.C(或者I2C2.H和I2C2.C)稍微复杂一点,而且在自己的代码中使用也更复杂一些。在MCC:I2C1.H生成的头文件中,有一个示例代码,说明如何在自己的代码中调用函数。但不直接显示如何使用实时时钟。如果您的程序偶尔只设置和读取RTCC,并且不需要同时执行其他任务,那么使用等待通信的每个步骤的代码就更容易,并且不使用中断。不幸的是,MCC并没有为这种类型的操作做简单的代码。随着MCC的附加库的发展,使用Mikro EelkTroNoCKI板上的设备。我不知道是否还有一个RTCC:HTTP://www. McCHIP.COM/PROM/50-50,已经有很多关于如何与I2C从设备通信的线索,有片段或完整的代码示例。Mysil的例子代码是HTTP://www.
以上来自于百度翻译 以下为原文 Hi, The I2C code that is generated by MCC, is a interrupt driver that work from a queue of transfer tasks. This is done such that the driver and hardware is able to work on it's own timing, while your main program will be able to do other work in the time that is not used to control the I2C transfer. However, this make the code in the driver files: i2c1.h and i2c1.c (or i2c2.h and i2c2.c) a little more complicated, and also is a little more complicated to use in your own code. In the header file generated by MCC: i2c1.h, there is example code showing how the functions may be called in your own code, but doesn't directly show how to use a realtime clock. If your program is expected to only set and read the RTCC occasionally, and do not need to do other tasks at the same time, it may be easier to use code that wait for each step of communication, and do not use interrupts. Unfortunately, MCC do not make simple code for this type of operation. There is development going on with additional libraries for MCC, to use devices on Mikro Elektronika Click boards. I do not know if there is a RTCC there yet: http://www.microchip.com/promo/50-in-50 There have been many threads about how to communicate with I2C slave devices, with pieces, or complete code examples. There are tutorials and example codes around, mostly with gross simplifications, shortcuts and mistakes. There is example code in http://www.embeddedcodesource.com/ Regards, Mysil |
|
|
|
嗨,伙计们,让你们知道。我得到了我的I2C通信工作。我在YouTube上看到了一个视频,名为“20047 Ser2——实用I2C:介绍、实现和故障排除”。它的一个视频编译了我的微芯片。这给了我我需要的I2C工作,同时让我了解如何设置和使用它。所以我推荐这个视频来帮助I2C协议。问候,Dirkie。
以上来自于百度翻译 以下为原文 Hi Guys, Just to let you know. I got my I2C communications to work. I watched a video on YouTube called "20047 SER2 - Practical I2C: Introduction, Implementation and Troubleshooting". Its a video compiled my Microchip. This gave me what I need to get my I2C working and at the same time got me to understand how to set it up and use it. So I recommend this video for assistance with the I2C protocol. Regards, Dirkie |
|
|
|
只有小组成员才能发言,加入小组>>
5368 浏览 9 评论
2100 浏览 8 评论
2004 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3277 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2312 浏览 5 评论
877浏览 1评论
766浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
705浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
763浏览 0评论
652浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-3-5 12:07 , Processed in 1.125088 second(s), Total 49, Slave 43 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191