WDT works with Open Close and timer - Printable Version +- Ewon Technical Forum (https://techforum.ewon.biz) +-- Forum: Development (https://techforum.ewon.biz/forum-50.html) +--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html) +--- Thread: WDT works with Open Close and timer (/thread-1003.html) |
WDT works with Open Close and timer - m-harigaya - 19-08-2019 Let me ask you a question. WDT works and reboots in a few minutes using the timer and open-close Is the usage incorrect? The code is below. WDT works even without put and get. Thank you. //Init Section Tset 1,1 //***WDT works and reboots in a few minutes using the timer *** //Cyclic Section //modbus tcp open-close If t%=0 Then Open "tcp:192.168.1.1:502,1" FOR BINARY OUTPUT AS 1 t%=1 Endif If t%=1 Then a%=Getsys PRG,"ACTIONSTAT" If a%=0 Then t%=2 //conection OK If a%>0 Then Close 1 : t%=0 //connection NG Endif If t%=2 Then //modbus s$=Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(6)+Chr$(1)+Chr$(3) s$=s$+Chr$(0)+Chr$(1-1)//address s$=s$+Chr$(0)+Chr$(150)//size //modbus Put 1,s$ t%=3 Endif If t%=3 Then r$=Get 1 If r$<>"" THEN CLOSE 1 :t%=0 //OK(read) Endif RE: WDT works with Open Close and timer - simon - 19-08-2019 Hi, What is the watchdog reason in your event logs ? I have tried your script in my Cyclic section and my Ewon (running 13.3) run properly during 20 min... Usually when I do such a script and I trigger it using a timer (1-2 second polling rate is enough) : [To copy in init section] TSET 1,1 ONTIMER 1, "GOTO COMM" COMM: TSET 1,0 Open "tcp:192.168.120.98:502,1" FOR BINARY OUTPUT AS 1 LIVEFEEDSOCKETOPEN: S% = GETSYS PRG,"ACTIONSTAT" IF S% > 0 THEN GOTO LIVEFEEDSOCKETCLOSE IF S% = -2 THEN GOTO LIVEFEEDSOCKETCLOSE IF S% = -1 THEN GOTO LIVEFEEDSOCKETOPEN PRINT "opened" s$=Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(0)+Chr$(6)+Chr$(1)+Chr$(3) s$=s$+Chr$(0)+Chr$(1-1)//address s$=s$+Chr$(0)+Chr$(150)//size //modbus Put 1,s$ retryread: r$=Get 1 If r$ = "" THEN Goto retryread If r$<>"" THEN GOTO LIVEFEEDSOCKETCLOSE END LIVEFEEDSOCKETCLOSE: PRINT "close" CLOSE 1 TSET 1,1 END Does it reboot with this script too ? Simon RE: WDT works with Open Close and timer - m-harigaya - 20-08-2019 Hi Simon, Thanks for getting back to me and thanks for your code. I tried my code again and it stopped with reboot in a few minutes. Attach the LOG at that time. I also tried your code. Your code did not reboot. However, I think that is due to the frequency of open-close. Actually, I want to connect with 200 devices while changing the IP address, so I need to open-close quickly. Thank you. Masa RE: WDT works with Open Close and timer - simon - 20-08-2019 Masa, Indeed that is perhaps the case. Do you see lots of "TCP connect failed" in your scheduled actions ? Also, I guess you removed the line "Tset 1,1" in your init ? Because it is totally useless as you put your code in the cyclic section. Simon RE: WDT works with Open Close and timer - m-harigaya - 21-08-2019 Hi Simon, Thanks for getting back to me again. The original code was processed differently every second by the Timer. In order to find out why WDT works, I made it a simple code. After leaving “Tset” alone, it was decided whether WTD would work. "ssnd-Connect socket failed " remaind in Event Logs . Thank you. Masa RE: WDT works with Open Close and timer - simon - 22-08-2019 Hi Masa, "ssnd-Connect socket failed means Ewon cannot connect to the device. I don't get you when you say " After leaving “Tset” alone, it was decided whether WTD would work." When you just execute the line TSET 1,1 in your init, you get a watchdog too ? Please clarify. Simon RE: WDT works with Open Close and timer - RKMadBiker - 23-08-2019 Hello Simon, this is Peter Tazaki of Riken Keiki. I work in the same department as Masa. Basically what he is saying is that the code in the OP above originally had calls using the TSET 1,1 but he removed those calls for debugging purposes. Basically, just having the TSET 1,1 line in the code seems to cause the reboot. Without the TSET 1,1 line, the simplified code does not reboot. In the WDTREBOOT.JPG file, we can see there are "ssnd-Connect socket failed" errors but the frequency is low. The connect socket failed error frequency does not change with or without the TSET 1,1 line. Could you also please explain what exactly does the "Watchdog in process (timer)" error mean? Thank you for your support. Peter RE: WDT works with Open Close and timer - simon - 04-09-2019 Hi Peter, The Watchdog in process (timer) means that the TIMER thread in the firmware is somehow stuck. So could be related to the timer TSET you use in combination of the cyclic section... The error "ssnd-Connect socket failed" means that the connection to the device could not be opened. Simon |