You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
////////////////////////////////////////////////////////////////////////////
|
|
///@copyright Copyright (c) 2018, 传控科技 All rights reserved.
|
|
///-------------------------------------------------------------------------
|
|
/// @file bsp_func.c
|
|
/// @brief bsp @ fuctiong ; io复用选择等,和cpu型号息息相关
|
|
///-------------------------------------------------------------------------
|
|
/// @version 1.0
|
|
/// @author CC
|
|
/// @date 20180308
|
|
/// @note cc_AS_stc02
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "bsp_func.h"
|
|
#include "../msp/uart0.h"
|
|
//#include "../tpc/tpc_modbus.h"
|
|
|
|
///struct _s_sysclk s_sysclk;
|
|
|
|
|
|
////MCLK0 配置 不需要的时候关闭以节约电
|
|
void L0_MCLKO_init(U8 onf)
|
|
{
|
|
BITN_1(P_SW2,EAXFR);
|
|
CKSEL &= B0000_0011;
|
|
if (D_ON == onf)
|
|
{
|
|
///-----------------------------------------------------
|
|
// p107@stc8.pdf
|
|
///step 1 :设置system out clock
|
|
//BITS_CLR(CKSEL,BITC_4,BIT4); /// 对REG的 从BITx开始 清除 N位
|
|
///多位配置,一定要配对使用,先清除再设置。
|
|
BITS_SET(CKSEL,D_CLKODIV_DIV8);/// sytem out clock 300k
|
|
///step 2 :设置IO
|
|
BITN_0(CKSEL,MCLKO_S);/// P5.4 SELECTED
|
|
BITN_0(P5M1,BITN4);BITN_1(P5M0,BITN4);/// 01 推挽
|
|
}
|
|
else
|
|
{
|
|
BITS_CLR(CKSEL,BITC_4,BIT4);
|
|
BITN_1(P5M1,BITN4);BITN_0(P5M0,BITN4);/// 00 准双向口01 推挽输出10 高阻11 开漏
|
|
//// 32k 下L1_task_Tdelay(D_Tdelay_ms); 变成了大约8s
|
|
///fixme
|
|
/// BITN_1(P5M1,BITN4);BITN_0(P5M0,BITN4);/// 00 准双向口01 推挽输出10 高阻11 开漏
|
|
///? 使用10 功耗增加11.130 使用01 功耗为10.65
|
|
//P54 = 1; 推挽 居然比高阻省电 另外推挽下面 =1比=0省电 10uA
|
|
}
|
|
BITN_0(P_SW2,EAXFR);
|
|
}
|
|
|
|
|
|
|