MicroBasic interfering with Watchdog timeout? HDC2450S

9 years 9 months ago #29528289 by mjdesrosiers
Hello,
I\'m running a script that checks a couple of different conditions to open a contactor at an appropriate time. I\'ve got another switch ahead of the contactor going to the main battery voltage, so if the first switch is open, I want the contactor open as well, to save power.

This is the script I\'ve got so far:
Option Explicit
dim CaughtEStop as Boolean
CaughtEstop = false

top:
\' volts, 2 == main battery voltage
\' volts, 1 == logic battery voltage
if (GetValue(_VOLTS, 2) < GetValue(_VOLTS, 1)) then
	\' if the main voltage is less than the logic voltage
	\' ( which happens because of a diode drop )
	if CaughtEStop then
		\' only act on e stop if other if clause has seen it first
		SetCommand(_EX, 1)
		\' set reset the boolean to false
		CaughtEstop = false
	end	if	
	\' set speed to 0
	SetCommand(_G, 1, 0)
end if

wait(250)

\' if the fault flag is not one of the acceptable kinds
\' 0 == no fault flag
\' 4 == undervoltage, which would happen if the contactor was open
if (GetValue(_FF) <> 0 and GetValue(_FF) <> 4) then
	\' turn off contactor
	SetCommand(_D0, 0, 3)
else
	CaughtEStop = true\' 
	SetCommand(_D1, 1, 3)
end if

wait(250)

goto top		

The script works fine, it\'s not my problem. My problem is that the watchdog timeout never happens when I\'m running the script. Is this a known issue? Product is HDC2450S.

Please Log in or Create an account to join the conversation.

9 years 9 months ago #29528290 by Griffin Baker
The default timeout is 1 second. So if the controller sees a command every 1 second, then the watchdog timer wouldn\'t time out.

Please Log in or Create an account to join the conversation.

9 years 9 months ago #29528291 by mjdesrosiers
Am I understanding you correctly, then, that each of those SetCommand calls is resetting the watchdog timer?

Please Log in or Create an account to join the conversation.

9 years 9 months ago #29528292 by Griffin Baker
yes.

Please Log in or Create an account to join the conversation.

9 years 9 months ago #29528293 by mjdesrosiers
Does only the SetCommand trigger the reset? If I query the state and only set if needed, that would drastically lower the frequency of setting the commands.

Please Log in or Create an account to join the conversation.

9 years 9 months ago #29528294 by Griffin Baker
To get a better idea try this.

Go to the console tab of the roborun utility. Send in the go command for a motor.

!G 1 200

if you click send it will give the motor go command. After one second, the motor will then stop as the watchdog timer has now timed out.

If you set the watchdog timer higher say 5 seconds, ^RWD 5000, then the watch will time out after 5 seconds.

If you send the go command and repeatedly send the command every 2 seconds, you\'ll notice that the watchdog never times out. If you click it once, and wait 5 seconds, it will time out.

Please Log in or Create an account to join the conversation.

9 years 9 months ago #29528295 by mjdesrosiers
I understand this part of the watchdog timeout. My primary commands are coming in over RS232. My initial understanding, which has proven wrong, was that the watchdog was only responding to what came over RS232. I now understand that any command, whether it be over RS232 or by a \'SetCommand\' function, resets the watchdog timer. I suppose I\'ll have to tweak my code to get clever and not trigger the timer reset.

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds