ATY_LIB V2_102_230218
ATY_LIB for general devices or ALGO
 
Loading...
Searching...
No Matches
fw_wdt.h
Go to the documentation of this file.
1// Copyright 2021 IOsetting <iosetting(at)outlook.com>
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef ___FW_WDT_H___
16#define ___FW_WDT_H___
17
18#include "fw_conf.h"
19#include "fw_types.h"
20
21/********************************************************
22 * STC8 watchdog behavior is different from STC15
23 *
24 * STC8 watchdog will ALWAYS reset chip from ISP code region inspite of the
25 * setting of SWBS in IAP_CONTR
26 *
27*/
28
33#define WDT_StartWatchDog() SFR_SET(WDT_CONTR, 5)
37#define WDT_ResetCounter() SFR_SET(WDT_CONTR, 4)
41#define WDT_EnableCounterWhenIdle(__STATE__) SFR_ASSIGN(WDT_CONTR, 3, __STATE__)
47#define WDT_SetCounterPrescaler(__PRE_SCALER__) (WDT_CONTR = WDT_CONTR & ~0x07 | (__PRE_SCALER__ & 0x07))
48
49#endif