?? shiyan8.c
字號(hào):
#include<spce061a_chf.h>
int recData[0x0a];
int main()
{
unsigned int j=0;
unsigned int temp;
unsigned int uiData,Ret;
Set_SystemClock(0x10);//在睡眠狀態(tài)下,32768Hz仍然工作,處于弱振模式,24.576
Set_IOB_Dir(0x0400);
Set_IOB_Attrib(0x0480);
Set_IOB_Data(0x0000);//010 :懸浮式輸入;110:低電平輸出
for(;j<0x0a;j++)
recData[j]=0;//初始化數(shù)組為0
j=0;
Set_UART_Command1(0x04);
temp=*P_UART_Command1;
Set_UART_Command2(0x80);
temp=*P_UART_Command2;
Set_UART_BaudRate(0x0500);
Ret=Get_UART_Data();
while(1)
{
Watchdog_Clear();
Ret=Get_UART_Command2();
Ret=Ret&0x0080;
while(Ret==0)
{
Ret=*P_UART_Command2;
Ret=Ret&0x0080;
Watchdog_Clear();
}
uiData=Get_UART_Data()&0x00ff;//保留低8位
if(uiData)
{
recData[j]=uiData;
j++;
}
}
while(1)
{
j=0;
Set_UART_Command2(0x40);
while(j<0x0a)
{
Ret=Get_UART_Command2();
Ret=Ret&0x0040;
while(Ret==0)
{
Ret=Get_UART_Command2();
Ret=Ret&0x0040;
Watchdog_Clear();
}
Set_UART_Data(recData[j]);
j++;
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -