#include "fw_conf.h"
#include "fw_types.h"
Go to the source code of this file.
◆ __SYSCLOCK
STC8H Clock: MCKSEL ||===> MCLKODIV ==> MCLKO_S => P1.6/P5.4 00 Internal IRC | || 01 External OSC |==> CLKDIV ==> SYSCLK 10 External 32KHz | 11 Internal 32KHz | Precompute system clock based on __CONF_FOSC and __CONF_CLKDIV
Definition at line 45 of file fw_sys.h.
◆ SYS_DisableOscillator48M
| #define SYS_DisableOscillator48M |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Disable 48MHz USB OSC
Definition at line 163 of file fw_sys.h.
◆ SYS_DisableOscillatorHSE
| #define SYS_DisableOscillatorHSE |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Disable high speed external oscillator
Definition at line 102 of file fw_sys.h.
◆ SYS_DisableOscillatorHSI
| #define SYS_DisableOscillatorHSI |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Disable high speed internal oscillator
Definition at line 66 of file fw_sys.h.
◆ SYS_DisableOscillatorLSE
| #define SYS_DisableOscillatorLSE |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Disable low speed external oscillator
Definition at line 124 of file fw_sys.h.
◆ SYS_DisableOscillatorLSI
| #define SYS_DisableOscillatorLSI |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Disable low speed internal oscillator
Definition at line 84 of file fw_sys.h.
◆ SYS_EnableOscillator48M
| #define SYS_EnableOscillator48M |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Enable 48MHz USB OSC
Definition at line 153 of file fw_sys.h.
◆ SYS_EnableOscillatorHSE
| #define SYS_EnableOscillatorHSE |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Enable high speed external oscillator
Definition at line 93 of file fw_sys.h.
◆ SYS_EnableOscillatorHSI
| #define SYS_EnableOscillatorHSI |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Enable high speed internal oscillator
Definition at line 57 of file fw_sys.h.
◆ SYS_EnableOscillatorLSE
| #define SYS_EnableOscillatorLSE |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Enable low speed external oscillator
Definition at line 115 of file fw_sys.h.
◆ SYS_EnableOscillatorLSI
| #define SYS_EnableOscillatorLSI |
( |
| ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
Enable low speed internal oscillator
Definition at line 75 of file fw_sys.h.
◆ SYS_SetClockOutputPin
System clock output pin 0:P5.4, 1:P1.6
Definition at line 148 of file fw_sys.h.
◆ SYS_SetExternal32kHighGain
Set low speed external oscillator gain
Definition at line 132 of file fw_sys.h.
◆ SYS_SetExternalOscType
Set high speed external oscillator type
Definition at line 110 of file fw_sys.h.
◆ SYS_SetFOSC
| #define SYS_SetFOSC |
( |
|
__IRCBAND__, |
|
|
|
__VRTRIM__, |
|
|
|
__IRTRIM__, |
|
|
|
__LIRTRIM__ |
|
) |
| |
Value: do { \
IRCBAND = ((__IRCBAND__) & 0x03); \
VRTRIM = (__VRTRIM__); \
IRTRIM = (__IRTRIM__); \
LIRTRIM = ((__LIRTRIM__) & 0x03); \
} while(0)
Definition at line 47 of file fw_sys.h.
◆ SYS_SetSysClockOutputDivider
| #define SYS_SetSysClockOutputDivider |
( |
|
__DIV__ | ) |
|
Value: do { \
SFRX_ON(); \
SFRX_OFF(); \
} while(0)
System clock output 0:No output, Foutput = SYSCLK / DIV
Definition at line 138 of file fw_sys.h.
◆ SYS_ExternalOSC_t
| Enumerator |
|---|
| SYS_ExternalOSC_Clock | |
| SYS_ExternalOSC_Crystal | |
Definition at line 21 of file fw_sys.h.
22{
@ SYS_ExternalOSC_Crystal
◆ SYS_SysClkOutputPort_t
| Enumerator |
|---|
| SYS_SysClkOutputPort_P54 | |
| SYS_SysClkOutputPort_P16 | |
Definition at line 27 of file fw_sys.h.
28{
@ SYS_SysClkOutputPort_P16
@ SYS_SysClkOutputPort_P54
◆ SYS_Delay()
Definition at line 65 of file fw_sys.c.
66{
68 do
69 {
72 } while (--t);
73}
◆ SYS_DelayUs()
Definition at line 75 of file fw_sys.c.
76{
78 do
79 {
82 } while (--t);
83}
◆ SYS_SetClock()
| void SYS_SetClock |
( |
void |
| ) |
|
Change system clock
- For SDCC only.
- For Keil C51, trim IRC in STC-ISP will be more accurate
- Invoke this in the beginning of main()
Definition at line 40 of file fw_sys.c.
41{
42#if defined (SDCC) || defined (__SDCC)
44 P_SW2 = 0x80;
46 {
48 do {
50 } while (--j);
51 }
52 P_SW2 = 0x00;
55#endif
56}
#define SYS_SetFOSC(__IRCBAND__, __VRTRIM__, __IRTRIM__, __LIRTRIM__)
◆ SYS_TrimClock()