diff --git a/docs/FAQ/RS485_tips_and_tricks.md b/docs/FAQ/RS485_tips_and_tricks.md index 84fae2d..bd75dc0 100644 --- a/docs/FAQ/RS485_tips_and_tricks.md +++ b/docs/FAQ/RS485_tips_and_tricks.md @@ -24,3 +24,16 @@ The led will light up everytime data passes over the bus providing more informat Consider [this article on electrical-engineering](https://electrical-engineering-portal.com/correct-cabling-modbus-rs485) a must read. + +### **Using a dedicated Wago RS485 module** +Depending on requirements a dedicated RS485 module might be required instead of using the onboard serial port of the device (if available). + +Based on user experience in this field, pay attention to: +- reset the module to factory settings before using. +- last confirmed working version of required libraries: + - WagoSysModule_75x_65x: Version 1.9.5.2 + - WagoTypesCom: Version 1.6.1.3 +- change the 'comport' in the RS485 master function block you intend to use. +- make sure the wiring of the module is correct: + + \ No newline at end of file diff --git a/docs/_img/WagoRS485ExternalWiring.gif b/docs/_img/WagoRS485ExternalWiring.gif new file mode 100644 index 0000000..0cc08e8 Binary files /dev/null and b/docs/_img/WagoRS485ExternalWiring.gif differ diff --git a/src/Exports/CodesysV3.export b/src/Exports/CodesysV3.export index 00c1659..b66bc78 100644 --- a/src/Exports/CodesysV3.export +++ b/src/Exports/CodesysV3.export @@ -10980,7 +10980,7 @@ a9ed5b7e-75c5-4651-af16-d2c27e98cb94 3b83b776-fb25-43b8-99f2-3c507c9143fc - 638115485363855446 + 638647811006771283 None @@ -11002,6 +11002,11 @@ tonDelay.IN := TRUE; + + 67 + + failSafeTimer.PT := T#10S; + 6 @@ -11032,6 +11037,11 @@ tonDelay(); + + 68 + + failSafeTimer(); + 12 @@ -11127,6 +11137,36 @@ END_IF + + 70 + + + + + 71 + + //if nothing is happening for to long, release the bus + + + 72 + + IF BusOcupied AND failSafeTimer.Q THEN + + + 73 + + devices[selectedDevice].ProcessDataArray(ADR(failSafeTimer.Q), BusData); + + + 74 + + THIS^.ReleaseBus(); + + + 69 + + END_IF + 31 @@ -11229,10 +11269,20 @@ /// To manage silence time and startup delay - 49 + 65 tonDelay: TON; + + 66 + + /// in case the bus is occupied for an unusual long time, release it + + + 49 + + failSafeTimer: TON; + 50 @@ -11316,7 +11366,7 @@ - 64 + 74 Standard False @@ -37508,32 +37558,42 @@ a9ed5b7e-75c5-4651-af16-d2c27e98cb94 3b83b776-fb25-43b8-99f2-3c507c9143fc - 638115485363925025 + 638647811426705746 - 3 + 7 // Start a timer to release the bus - 4 + 8 THIS^.tonDelay.PT := THIS^.SilenceTime; - 5 + 9 THIS^.tonDelay.IN := TRUE; - 2 + 10 + + THIS^.failSafeTimer.IN := FALSE; + + + 11 THIS^.deviceActive := FALSE; + + 2 + + + @@ -37590,17 +37650,22 @@ a9ed5b7e-75c5-4651-af16-d2c27e98cb94 3b83b776-fb25-43b8-99f2-3c507c9143fc - 638115485363965028 + 638647811276812596 - 3 + 5 THIS^.tonDelay.IN := FALSE; + + 6 + + THIS^.failSafeTimer.IN := TRUE; + 2 diff --git a/src/Exports/PLCopen.xml b/src/Exports/PLCopen.xml index d3664f4..b73c1de 100644 --- a/src/Exports/PLCopen.xml +++ b/src/Exports/PLCopen.xml @@ -1,7 +1,7 @@  - - + + @@ -9328,6 +9328,14 @@ END_WHILE To manage silence time and startup delay + + + + + + in case the bus is occupied for an unusual long time, release it + + @@ -9427,12 +9435,14 @@ END_WHILE IF Startup THEN tonDelay.PT := StartupDelay; tonDelay.IN := TRUE; + failSafeTimer.PT := T#10S; Startup := FALSE; END_IF QueryReady(CLK := BusTrigger^); BusOcupied := NOT(tonDelay.Q); tonDelay(); +failSafeTimer(); // check if there's a device that requires bus time and if so, launch the query IF busOcupied = FALSE AND deviceActive = FALSE AND devicesCount <> 0 AND NOT QueryReady.Q THEN @@ -9453,6 +9463,12 @@ IF QueryReady.Q THEN THIS^.ReleaseBus(); END_IF +//if nothing is happening for to long, release the bus +IF BusOcupied AND failSafeTimer.Q THEN + devices[selectedDevice].ProcessDataArray(ADR(failSafeTimer.Q), BusData); + THIS^.ReleaseBus(); +END_IF + //let the busdevices to their work //FOR loopCounter := 0 TO devicesCount - 1 DO @@ -9542,6 +9558,7 @@ THIS^.BusError := BusError; THIS^.tonDelay.IN := FALSE; +THIS^.failSafeTimer.IN := TRUE; THIS^.deviceActive := TRUE; @@ -9562,7 +9579,9 @@ THIS^.deviceActive := TRUE; // Start a timer to release the bus THIS^.tonDelay.PT := THIS^.SilenceTime; THIS^.tonDelay.IN := TRUE; -THIS^.deviceActive := FALSE; +THIS^.failSafeTimer.IN := FALSE; +THIS^.deviceActive := FALSE; + diff --git a/src/HomeAutomation.ecp b/src/HomeAutomation.ecp index ebd7de9..a175570 100644 Binary files a/src/HomeAutomation.ecp and b/src/HomeAutomation.ecp differ