Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:sw:01-mervis:automatic-restart-of-1-wire-hidden [2018/12/11 14:37]
mkudlacek
en:sw:01-mervis:automatic-restart-of-1-wire-hidden [2021/08/05 14:33] (current)
avsetula
Line 1: Line 1:
 ====== Automatic restart of the 1-Wire bus ====== ====== Automatic restart of the 1-Wire bus ======
 +<WRAP group>
 +<WRAP half column 81%>
 The 1-Wire bus is prone to EMI which can result in sensors being "​stuck"​ and disabling the whole bus communication. With our PLCs you are able to turn the power off for the whole 1-Wire bus and forcing the sensors to reset. The 1-Wire bus is prone to EMI which can result in sensors being "​stuck"​ and disabling the whole bus communication. With our PLCs you are able to turn the power off for the whole 1-Wire bus and forcing the sensors to reset.
 +</​WRAP>​
 +<WRAP half column 15%>
 +;;#
 +<​html><​span class="​dev-tag dev-patron">​Patron</​span></​html>​ \\
 +<​html><​span class="​dev-tag dev-neuron">​Neuron</​span></​html>​ \\
 +<​html><​span class="​dev-tag dev-axon">​Axon</​span></​html>​
 +;;#
 +</​WRAP>​
 +</​WRAP>​
  
 <WRAP center round info 60%> <WRAP center round info 60%>
Line 7: Line 18:
 </​WRAP>​ </​WRAP>​
  
-You can reset the power supply manually, but with the help of **commerror** attributes, you can let Mervis do it automatically. The attributes are available on the particular device or the whole channel and they indicate when the Mervis wasn't able to read the datapoints.+You can reset the power supply manually, but with the help of **commerror** attributes, you can let Mervis do it automatically. The attributes are available on the particular device or the whole channel and they indicate when the Mervis wasn't able to read the datapoints ​for given device/​channel.
  
 We will start the project in the **Full mode**, attaching to the controller, creating a FBD program and setting a task executing this program. Next we create ModbusTCP channel for the IOs of the PLC and 1-Wire channel for the 1-Wire bus. Then deploy the solution and detect the 1-Wire sensors. Your workspace should look like this: We will start the project in the **Full mode**, attaching to the controller, creating a FBD program and setting a task executing this program. Next we create ModbusTCP channel for the IOs of the PLC and 1-Wire channel for the 1-Wire bus. Then deploy the solution and detect the 1-Wire sensors. Your workspace should look like this:
Line 17: Line 28:
 {{ :​en:​sw:​01-mervis:​automatic-restart-of-the-1-wire-02-attributes.png?​direct |}} {{ :​en:​sw:​01-mervis:​automatic-restart-of-the-1-wire-02-attributes.png?​direct |}}
  
-The most important is the attribute **commerror**,​ which indicates if there is a communication error with **any** of the connected sensors. The attribute'​s type is bool and when the value is ''​TRUE'',​ it means there is a communication error and once the error disappears, the attribute is ''​FALSE''​. As you can see, attribute of the same name is in the section ​**office**. This attribute indicates communication error **only** for the sensor called **office**.+The most important is the attribute **commerror**,​ which indicates if there is a communication error with **any** of the connected sensors. The attribute'​s type is bool and when the value is ''​TRUE'',​ it means there is a communication error and once the error disappears, the attribute is ''​FALSE''​. As you can see, attribute of the same name is in the **office** ​section as well. This attribute indicates communication error **only** for the sensor called **office**.
  
 The solution for automatic restart needs to check the value of the **commerror** and when it is ''​TRUE''​ we need to briefly set the **OW_off_1** to ''​TRUE''​ and then set it back to ''​FALSE''​. Better yet, if the **commerror** stays in ''​TRUE''​ we will try resetting the bus periodically. For this function, we can use block **Pulse Generator (BD2)**: The solution for automatic restart needs to check the value of the **commerror** and when it is ''​TRUE''​ we need to briefly set the **OW_off_1** to ''​TRUE''​ and then set it back to ''​FALSE''​. Better yet, if the **commerror** stays in ''​TRUE''​ we will try resetting the bus periodically. For this function, we can use block **Pulse Generator (BD2)**:
Line 29: Line 40:
 {{ :​en:​sw:​01-mervis:​automatic-restart-of-the-1-wire-04-complete-project.png?​direct |}} {{ :​en:​sw:​01-mervis:​automatic-restart-of-the-1-wire-04-complete-project.png?​direct |}}
  
-All we need to alter is the length of the pulse and the pause between pulses to some reasonable values such as Ttrue = 1s and Tfalse = 4s, deploy the solution and start debugging. Then you can unplug the 1-Wire sensor and you will see that the measured values are red and the commerror attribute is ''​TRUE''​ and the **Pulse Generator** is sending reset pulses to the bus:+All we need to alter is the length of the pulse and the pause between pulses to some reasonable values such as Ttrue = 1 s and Tfalse = 4 s, deploy the solution and start debugging. Then you can unplug the 1-Wire sensor and you will see that the measured values are red and the **commerror** attribute is ''​TRUE''​ and the **Pulse Generator** is sending reset pulses to the bus:
  
 {{ :​en:​sw:​01-mervis:​automatic-restart-of-the-1-wire-05-debugging.png?​direct |}} {{ :​en:​sw:​01-mervis:​automatic-restart-of-the-1-wire-05-debugging.png?​direct |}}