Cómo usar el Watchdog con tu PLC industrial

4 de enero de 2019 por
Cómo usar el Watchdog con tu PLC industrial
Boot & Work Corp. S.L., Support Team


En este post veremos cómo utilizar el Watchdog y cuál es el límite de su controlador industrial Arduino diseñado para la automatización industrial.

Requisitos

PLC Arduino Ethernet o 20 I/Os:      Ethernet PLC        20 I/Os PLC

Librería Watchdo:  Librería avr/wdt.h 

¿Qué es el Watchdog?

El Watchdog es un temporizador electrónico que permite reiniciar el sistema en caso de mal funcionamiento del ordenador y recuperarse.

El Watchdog consiste en un temporizador decreciente: cuando el temporizador llega a cero, el sistema se reinicia. Entonces siempre hay que refrescar el "watchdog".g.

Software

Debes usar la biblioteca de Watchdog "#include <avr/wdt.h>" proporcionada por Arduino para programar tu propio Watchdog.


Funciones:


#define 

wdt_reset()   __asm__ __volatile__ (“wdr”)

#define 

WDTO_500MS   5

#define 

WDTO_1S   6

#define 

WDTO_2S   7

#define 

WDTO_4S   8

#define 

WDTO_8S   9


IMPORTANTE: El Watchdog del Ardbox no puede trabajar por debajo de los 500ms. No hay limitaciones para el PLC M-Duino.

A continuación encontrarás un ejemplo de cómo usarlo: el Watchdog lib

/*
   Copyright (c) 2017 Boot&Work Corp., S.L. All rights reserved

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <avr/wdt.h>

//////////////////////////////////////////////////////////////////////////////////////////////
void setup() {
	Serial.begin(9600L);
  // Set the watchdog on 500 ms 
  wdt_enable(WDTO_500MS);
}

//////////////////////////////////////////////////////////////////////////////////////////////
void loop() {
  // Refresh the watchdog
  wdt_reset();

  // WORK HERE, but faster than 500ms
  
  Serial.println("Watchdog is working if you don't see the points");
  delay(550);
  
  

  Serial.println("...");
}

¿Tiene preguntas sobre nuestros dispositivos de código abierto?

Contacta con nuestro equipo técnico comercial para resolver tus dudas. ¡Te esperamos! 


Buscar en nuestro blog

Cómo usar el Watchdog con tu PLC industrial
Boot & Work Corp. S.L., Support Team 4 de enero de 2019
Compartir

¿Estás buscando tu Controlador Lógico Programable ideal?

Echa un vistazo a esta comparativa de producto de varios controladores industriales basados en Arduino.

Comparamos entradas, salidas, comunicaciones y otras especificaciones con las de los equipos de otras marcas destacadas.


Industrial PLC comparison >>>