Microchip
直播中

吴晓成

7年用户 362经验值
私信 关注
[问答]

2个PIC之间的通信没有通信线

你好,首先我很抱歉我的“正常”英语。我可能会犯一些错误……我正在开发一个学校项目,我有2个不同的模块,在不同的位置(60cm距离)。第一个模块有一个12F1572处理器,一个12伏特的电源输入,一个78L05电压调节器来为处理器供电。该处理器分析传感器并确定0, 1, 2或3的危险水平。这是一个非常简单的项目,但是这个第一个模块必须与第二个模块通信“危险级别”。这个第二个模块还有一个12F1572处理器和各种LED。这个模块只能有2根导线。所以,只有2根导线,我必须为系统供电,并在处理器之间进行简单的通信。我现在的想法是:第一个模块,根据“危险级别”将切换不同的电压电平来为第二个模块供电。第二个模块只有2个。电线。第一根导线是接地的。第二线是一个可变电压电源输入,连接到78L05总是有5伏的PIC。在这个PIC和使用一个分压器和ADC,I可以很容易地测量输入电压,这样第二个模块知道“危险水平”。对于第一个模块从不同的电压电平切换,我正在考虑使用MUX或DEMUX和许多晶体管来完成这项工作。是否有任何IC可以减少我的硬件或其他想法切换到不同的电压水平?对于PIC的通信而言,这个项目有什么更好的主意?非常感谢你的帮助。

以上来自于百度翻译


      以下为原文

    Hello,
First I am sorry for my "normal" English.  I might make some mistakes...
I am developing a school project and I have 2 different modules, on different locations (60cm distance).
First module has a 12F1572 processor,  a 12 Volt power input, a 78L05 voltage regulator to power the processor. This processor analyzes a sensor and determines the danger level of 0, 1, 2 or 3.  This is a very simple project.
However this first module must communicate the "danger level" with a second module.
This second module also has a 12F1572 processor and various LED´s inside.  This module can only have 2 wires.
So, with only 2 wires I must power the system and make a simple communication between the processors.

My idea for now is:
The first module, according with the "danger level" will switch a different voltage level to power the second module.
The second module only has 2 wires. First wire is ground. Second wire is a variable voltage power input that connect to a 78L05 to always have 5 Volts for the PIC. In this PIC and using a voltage divider and ADC I can easily measure the input voltage and this way the second module knows the "danger level".

For the first module to switch from different voltage levels, I am thinking about using a Mux or DeMux and many transistors to make this work.  Is there any IC that will reduce my harware or any other ideas to switch from different voltage levels ?

Any better idea for this project in terms of communication between PIC´s  ?

Many thanks for your help.

回帖(5)

陈杰

2019-1-22 09:30:27
林想到了。

以上来自于百度翻译


      以下为原文

    LIN comes to mind.
举报

陈鲜孰

2019-1-22 09:41:46
PIC12F1572具有USAT。TX引脚的正常空闲状态很高。这将是相当容易提供电流限制12V的电源/数据总线,并驱动MOSFET,所以它拉巴士下降到0V时,TX引脚变低。当停止位(第十位)处于标记(逻辑‘1’’)时,TX引脚永远不会停留在9位以上。也可以在字符之间等待,保持平均电压足够高。在接收器端,电位分压器将线路耦合到RX引脚,以限制最大引脚电压至5V,并且二极管抽出功率以充足够大的储能电容器,馈送5V LDO稳压器,以保持PIC供电,而MOSFET将线拉低至9位。还有一个细节:BUCOCON:SCKP位可以用来转换TX管脚信号,这样就不需要外部逆变器来驱动MOSFET栅极,如果你想要双向CUS(半双工),在显示PIC上复制下拉MOSFET(而不是12V电流源)。在传感器PIC上的电位分压器和TX输入。这样就可以进行错误检查,例如,显示器可以回传接收到的字符,如果传感器PIC检测到不匹配,它可以重发数据,如果它仍然不好,则通过保持低的线足够长的时间来重置显示器以使其下降。保持波特率降低到大约1200波特,并且它WI。对于双绞线布线,几十米将是很好的。

以上来自于百度翻译


      以下为原文

    The PIC12F1572 has a USART.     The normal idle state of the TX pin is high.   It would be fairly easy to supply current limited 12V to the power/data bus, and drive a MOSFET so it pulls the bus down to 0V when the TX pin goes low.  The TX pin never stays low for more than 9 bits as the stop bit (10th bit) is at mark (logic '1') level.  Also you can wait in between characters to keep the average voltage high enough.    On the receiver end, a potential divider couples the line to the RX pin to limit the maximum pin voltage to 5V, and a diode taps off the power to charge a large enough reservoir capacitor, feeding a 5V LDO regulator, to keep the PIC powered while the MOSFET is pulling the line low for up to 9 bits.
 
There's a further couple of details:- the BAUDCON:SCKP bit can be used to invert the TX pin signal so you don't need an external inverter to drive the MOSFET gate, and if you want two way comms (half duplex), duplicate the pulldown MOSFET (but not the 12V current source) at the display PIC and the potential divider and TX input at the sensor PIC.  That lets you do error checking, e.g. the display can echo back the received character, and if the sensor PIC detects a mismatch, it can resend the data and if its still bad, reset the display by holding the line low long enough to power it down. 
 
Keep the baud rate down to about 1200 baud, and it will be good for tens of meters over twisted pair wiring.
举报

李新梅

2019-1-22 09:55:31
谢谢你的帮助!

以上来自于百度翻译


      以下为原文

    Thank you with all your help !
举报

夏涌革

2019-1-22 10:03:07
PIC12F1572有一个5位DAC,您可以用来产生电压,例如,5,4.875,4.750和4.625伏。增加一个具有足够输出电流的放大器来为第二板供电(甚至一个BJT电压跟随器应该工作)。在第二板的PIC可以读取自己的电源电压,并使用它来确定它对四个“危险级别”的响应。为了降低功耗,可以使用PWM和简单的降压调节器。这些方法假定不需要快速响应,对于快速响应,第二模块的功率输入可以具有二极管和电容器,以将其与输入隔离,并且提供平滑的电压,而可以监视原始输入。原始功率可以以多种方式调制,即使TTL RS-232信号突发,也可以由第二模块中的接收器读取。八比特的信息可以在9600毫秒中传输,在10毫秒。只要包之间的时间大(至少100毫秒左右),二极管上的电压和电容器上的电压应该基本保持恒定。

以上来自于百度翻译


      以下为原文

    The PIC12F1572 has a 5 bit DAC, which you could use to produce voltages of, say, 5.00, 4.875, 4.750, and 4.625 volts. Add an amplifier with enough output current to power the second board (even a single BJT voltage follower should work). The PIC in the second board can read its own power supply voltage and use it to determine its response to the four "danger levels". For lower power consumption, PWM and a simple buck regulator could be used. These methods assume that fast response is not needed.
 
For fast response, the power input of the second module could have a diode and capacitor to isolate it from the input and provide smooth voltage, while the raw input could be monitored. The raw power could be modulated in a variety of ways, even with a TTL RS-232 signal burst, that could be read by the receiver in the second module. Eight bits of information could be transmitted at, say, 9600 baud, in 10 mSec. As long as the time between packets is large (at least 100 mSec or so), the voltage on the board after the diode and on the capacitor should stay essentially constant.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分