📄 dec5502_uartonchip.c
字号:
/******************************************************************************/
/* Copyright 2004 by SEED Electronic Technology LTD. */
/* All rights reserved. SEED Electronic Technology LTD. */
/* Restricted rights to use, duplicate or disclose this code are */
/* granted through contract. */
/* */
/* */
/******************************************************************************/
/* MODULE NAME... UART */
/* FILENAME...... DEC5502_UART0NCHIP.c */
/* DATE CREATED.. Wed 6/11/2004 */
/* PROJECT....... Communicate with PC by on-chip UART of 5502 */
/* COMPONENT..... */
/* PREREQUISITS.. */
/*----------------------------------------------------------------------------*/
/* DESCRIPTION: */
/* */
/* This is an example for on-chip UART of C5502 */
/******************************************************************************/
#include <stdio.h>
#include <csl.h>
#include <csl_pll.h>
#include <csl_chip.h>
#include <csl_irq.h>
#include <csl_uart.h>
#include "Uart_Function.h"
#include "Timer.h"
#define SYSCNTL0 (*(volatile unsigned int *)(0x280000))
Uint16 i=0;
Uint16 Temp;
void main(void)
{
/* Initialize CSL library - This is REQUIRED !!! */
CSL_init();
/* Config PLL */
PLL_setFreq(1, // PLL mode
0xF, // Multiply factor, Valid values are (multiply by)10
0, // Sysclk 0 Divide Down
1, // Sysclk1 Divider 150MHz
3, // Sysclk2 Divider 75MHz
3, // Sysclk3 Divider
0); // CLKOUT3(DSP core clock) divider 300MHz
/* 配置定时器 */
Config_Timer();
/* Select on-chip uart */
SYSCNTL0 = 0x0;
/* Perform two dummy read */
Temp = (*(volatile ioport Uint16*)(0x9C00));
Temp = (*(volatile ioport Uint16*)(0x9C00));
/* Configure UART registers */
Uart_Config();
/* Clear recerver data structure */
for(i=0; i<LENGTH; i++)
{
DestData[i] = 0;
}
DataCount = 0;
for(;;)
{
// 将下列数据拷贝到PC机端串口调试助手的发送区内,当程序进入for循环后,执行手动发送
// 1112131415161718191A1B1C1D1E1F2021222324
if(PctoDsp == TRUE)
{
Write_Uart(LENGTH);
PctoDsp = FALSE;
}
}
}
/*****************************************************************************************/
// No more
/*****************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -