?? main_beep.c
字號:
/*
***********************************************************
* Copyright (c)
* All rights reserved.
*
* 文件名稱:main_beep.c
* 文件標識:程序實現體
* 摘 要:本文件是對beep功能的測試
*
* 當前版本:1.0
* 作 者:劉征
* 完成日期:2005.4.3
*
* 取代版本:
* 作 者:
* 完成日期:
***********************************************************
*/
#define GLOBAL_CLK
/*
===========================================================
* 頭文件 *
===========================================================
*/
#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
extern void BUZZER_PWM_Test(void);
void *func_uart_test[][2]=
{
//iic
(void *)BUZZER_PWM_Test, " Beep test ",
0,0
};
/* ===================== 配置主頻 ======================== */
void CLOCK_Init() // set MPLL = 400M
{
/* MPLL = (2*M*Fin)*Fin/(P*n) (n等于2的s次方)
Fin = 12,000,000
m = (MDIV+8), p = (PDIV+2), s = SDIV
MDIV PDIV SDIV */
ChangeMPllValue( 92, 1, 1 );
}
/*
***********************************************************
* 函數介紹:本函數被使用來做測試beep的功能。
* 輸入參數:無
* 輸出參數:無
* 返回值 :無
***********************************************************
*/
void Main(void)
{
int i;
Port_Init(); // 端口初始化
Isr_Init(); // 中斷初始化
CLOCK_Init(); // set MPLL = 400M
ChangeClockDivider(14, 12); // FCLK:HCLK:PCLK = 1:4:8
cal_cpu_bus_clk();
Uart_Init(0,115200); // 串口初始化 波特率為115200
Uart_Select(0); // 選者串口0
Clk0_Disable();
Clk1_Disable();
while(1)
{
Uart_Printf("\n\n");
while(1)
{ //display menu
Uart_Printf("%2d:%s",i,func_uart_test[i][1]);
i++;
if((int)(func_uart_test[i][0])==0)
{
Uart_Printf("\n");
break;
}
if((i%4)==0)
Uart_Printf("\n");
}
Uart_Printf("\nPress Enter key to exit : ");
i = Uart_GetIntNum();
if(i==-1) break; // return.
if(i>=0 && i<7 ) // select and execute...
( (void (*)(void)) (func_uart_test[i][0]) )();
}
Uart_Printf("\n**************** Test end ****************\n");
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -