完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,因为我不了解IO端口和PPS文档,也没有找到这方面的线程,所以我想在这里直接询问。我使用的是PIC32MX795F512L,我想做以下功能:1。初始化I2C1模块,进行I2C通信。2。禁用/去初始化I2C模块。3。现在使用与GPIO相同的引脚并进行IO操作。4。再次执行步骤1。或重复步骤3。
以上来自于百度翻译 以下为原文 Hi, Since I don't understood the IO port and PPS documentation also no thread found for this, I prefer to ask here directly. I am using PIC32MX795F512L and I want to do following functionality: 1. Initialise I2C1 module and do I2C communication. 2. Disable/Deinitialize I2C module. 3. Now use same pins as GPIO and make IO operations. 4. Again do step 1. or step 3 repeatedly. |
|
相关推荐
7个回答
|
|
应该工作,是的。不确定如果这些引脚是PPS在您的照片,在这种情况下,一些额外的照顾可能适用。
以上来自于百度翻译 以下为原文 Should work, yes. Not sure if those pins are PPS on your PIC, in which case some extra care may apply. |
|
|
|
你的照片好像没有PPS。你的步骤1…4看起来还可以,所以在使用之后只需要注意启用和禁用PIC内部i2c模块(I2CxCON位15),但是不清楚您想要实现什么。如果您在I2C使用和I/O使用之间物理地连接/分离硬件,这可能是有意义的。不过,你提到了一个“循环”,这让我觉得你想分享引脚。通常你有一个或多个I2C奴隶连接到你的巴士,你需要上拉电阻器的SDA和SCL。你的I/O可能不喜欢弹出,而你的I2C奴隶可能不喜欢你的I2C总线。有时候,您想用I/O来驱动SDA线路,那么从机可能会驱动SDA线路。除非您有充分的理由这样做,否则我不会这样做。
以上来自于百度翻译 以下为原文 Your PIC doesn't seem to have PPS. Your steps 1 .. 4 seem ok, so just take care to enable and later disable the PIC internal i2c module after use ( I2CxCON bit 15), However it is unclear what you are trying to achieve. If you physically attach/detach hardware between i2c usage and I/O usage that might make sense. However you mention a "loop" around this, which lets me think you you want to share the pins. Usually you have one or multiple i2c slave attached to your bus, and you need pullup resistors for SDA and SCL. Your I/O might not like the pullups and your i2c slave might not like your bit-banging of the i2c bus lines. The slave might drive the SDA line at times you want to drive them with your I/O. I would not do that unless you have a good reason to do so. |
|
|
|
也许你应该谷歌的I2C和开放排水SCL和SDA线是“开放排放”的驱动程序。这意味着芯片可以驱动它的输出低,但它不能驱动它高。为了使线路能够达到高电平,您必须提供上拉电阻。您也可以将GPIO配置为与此兼容的开放漏极,但是您必须理解i2c要求,并且知道您正在做什么。
以上来自于百度翻译 以下为原文 May be you should google for i2c and open drain Both SCL and SDA lines are "open drain" drivers. What this means is that the chip can drive its output low, but it cannot drive it high. For the line to be able to go high you must provide pull-up resistors You might also configure your GPIO as open drain to be compatible with that, but you must understand i2c requirements and know what you are doing. |
|
|
|
您好,即使I2C控制器使用端口引脚,您也可以一直读取通用I/O端口寄存器。设置I2CxCON.ON=1;/*I2C控制器现在将控制SDAx和SCLx引脚。*/…I2CXCON.ON=0;/*IO引脚现在由IO端口寄存器控制。*/请注意,NXP在I2C文档中精心设计和指定了“开路漏极”驱动器,以避免I2C信号线上出现任何可能的短路情况。如果禁用I2C控制器并将管脚驱动到高逻辑电平,则会破坏I2C信号规则,如上面的rodims所解释的I2C规范在NXP网站上:Mysil NXP.COM/Dopunts/UsRyMualAl/UM10204.PDF,
以上来自于百度翻译 以下为原文 Hi, You can always Read the general I/O Port register even when I2C controller is using the port pins. Set I2CxCON.ON = 1; /* I2C controller will now control SDAx and SCLx pins. */ ... I2CxCON.ON = 0; /* IO pins are now controlled by IO port registers. */ Be aware that the "open drain" drivers are carefully designed and specified in I2C document by NXP, in order to avoid any possible short circuit condition on I2C signal lines. If you disable I2C controller and drive the pin to High logic level, you break I2C signalling rules, as rodims explain above. I2C specification is on NXP website: www.nxp.com/documents/user_manual/UM10204.pdf Regards, Mysil |
|
|
|
嗨,Rodims和Mysil,是的,我在物理上安装/拆卸IO设备/I2C设备到这些引脚。当我安装I2C设备时,我想用PIC的I2C模块与之通信。当我想做GPIO操作时,我会禁用I2C模块,并在相同的PIN上执行GPIO操作。那么,是否能像Mysil所说的启用/禁用I2C模块?或者我需要遵循不同的方式吗?
以上来自于百度翻译 以下为原文 Hi Rodims and Mysil, Yes I am physically attaching/dettaching the IO device/I2C device to these pins. When I attach I2C device I want to use PIC's I2C module to communicate with it. When I want to do GPIO operation, I would disable I2C module, and perform GPIO operation on same pins. So will it possible just by enabling/disabling I2C module as Mysil said? or do I need to follow some different way? |
|
|
|
仅仅禁用I2C模块应该让您完全控制引脚。
以上来自于百度翻译 以下为原文 Just disabling the I2C module should give you full control of the pins. |
|
|
|
这通常是在手动计时一个“挂”的I2C总线(SDA被拉低的奴隶与主机不同步,禁用启动和停止序列)。您可能能够找到一些代码,为您的处理器。搜索I2C“锁定”“挂”或类似的。/ Ruben
以上来自于百度翻译 以下为原文 This is usually done when manually clocking a "hung" I2C bus (SDA pulled low by slave out of synch with master which disables START and STOP sequence). You might be able to find some code for that for your processor. Search for I2C "lockup" "hang" or similar. /Ruben |
|
|
|
只有小组成员才能发言,加入小组>>
5160 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2225 浏览 5 评论
727浏览 1评论
612浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
501浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
626浏览 0评论
524浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 05:43 , Processed in 1.325002 second(s), Total 89, Slave 72 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号