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.
54 lines
1.6 KiB
54 lines
1.6 KiB
1 year ago
|
////////////////////////////////////////////////////////////////////////////
|
||
|
///@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);
|
||
|
}
|
||
|
|
||
|
|