IoT Supervisor 0.0
Loading...
Searching...
No Matches
Modbus WDT State Machine

The modbus watchdog timer state machine. More...

Macros

#define C_DEFAULT_MB_WD_TIMEOUT   (15)
 
#define C_MB_WD_COUNT2MIN   (7500)
 
#define C_WDT_PET   0x5A
 
#define C_WDT_DIS   0xA5
 

Enumerations

enum  mbWDTsmS_t { eMW_Ini = 0 , eMW_En , eMW_Timeout }
 

Functions

void mbWDTsm (void)
 

Variables

uint8_t MB_WD_TIMEOUT = C_DEFAULT_MB_WD_TIMEOUT
 
bool mbWDTen = false
 
bool mbWDTpet = false
 

Detailed Description

The modbus watchdog timer state machine.

stateDiagram-v2 direction LR [*] --> Ini Ini --> En: WDT Enable En --> Timeout: WDT Timeout En --> Ini: WDT Pet or WDT Disable Timeout --> Ini
flowchart LR start(( )) subgraph Interrupts.c subgraph TIMER1_ISR["TIMER1_ISR()"] div8["Divide By 8 Calls"] end end subgraph IoT supervisor_main.c mbWDTsm["mbWDTsm( )"] end start -->|every 1 ms| div8 div8 -->|every 8 ms| mbWDTsm
The watchdog state machine is specifically implemented to "bite" after it has not received a watchdog "pet" for a certain number of minutes (configurable).

It starts as disabled and can be enabled through modbus. After biting, it returns to being disabled.

Macro Definition Documentation

◆ C_DEFAULT_MB_WD_TIMEOUT

#define C_DEFAULT_MB_WD_TIMEOUT   (15)

Default number of minutes before modbus timeout.

Definition at line 294 of file IoT Supervisor_main.c.

◆ C_MB_WD_COUNT2MIN

#define C_MB_WD_COUNT2MIN   (7500)

number of watchdog counts to minutes

Definition at line 296 of file IoT Supervisor_main.c.

◆ C_WDT_DIS

#define C_WDT_DIS   0xA5

Definition at line 23 of file IoT_Supervisor.h.

◆ C_WDT_PET

#define C_WDT_PET   0x5A

Definition at line 22 of file IoT_Supervisor.h.

Enumeration Type Documentation

◆ mbWDTsmS_t

enum mbWDTsmS_t

Modbus Watchdog Timer State Machine Status _ Type

Modbus Watchdog Timer State Machine Status _ Type

Enumerator
eMW_Ini 

Initial State.

eMW_En 

Enable State.

eMW_Timeout 

Timeout State. This watchdog bites!

Definition at line 71 of file IoT_Supervisor.h.

Function Documentation

◆ mbWDTsm()

void mbWDTsm ( void  )

This is the implementation of the modbus watchdog state machine.

It follows the same structure as the rest of the state machines in this application where the transitions are first and the states follow.

Definition at line 308 of file IoT Supervisor_main.c.

Variable Documentation

◆ MB_WD_TIMEOUT

uint8_t MB_WD_TIMEOUT = C_DEFAULT_MB_WD_TIMEOUT

Definition at line 298 of file IoT Supervisor_main.c.

◆ mbWDTen

bool mbWDTen = false

Definition at line 299 of file IoT Supervisor_main.c.

◆ mbWDTpet

bool mbWDTpet = false

Definition at line 300 of file IoT Supervisor_main.c.