main.c

来自「此例程是基于ARMS3C44B0的经典例程 对于嵌入式开发而言很有用 需要硬件平」· C语言 代码 · 共 79 行

C
79 行
字号
/*********************************************************************************************
* File:	main.c
* Author:	embest
* Desc:	c main entry
* History:	
*********************************************************************************************/

/*--- include files ---*/
#include "44blib.h"
#include "44b.h"
#include "Uart.h"
/*--- function code ---*/
char str_send[17] = "Embest S3CEV40 >\0";
char str_error[50] = "TERMINAL OVERFLOW : 256 character max !";
char str[256];
char CR[1] = {0x0A};

/*********************************************************************************************
* name:		main
* func:		c code entry
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
int main(void)
{

    char *pt_str = str;
	
	sys_init();
	rI_ISPC = 0xffffffff;			/* clear all interrupt pend	*/
	uart_init(0,115200);			/* Initial Serial port 1	*/
	
	/* printf interface */
	uart_printf("\n");
	uart_printf(str_send);
	/* get user input */
	delay(2000);
    //* Terminal handler
    
	while(1)
    {
      //Test_Uart0()       ;
      //Test_Uart0Fifo()   ;
      //Test_Uart1()       ;
      //Test_Uart1Fifo()   ;
      //Test_Uart1IrDA_Rx();
      //Test_Uart1IrDA_Tx();
      //Test_UartAFC_Rx()  ;
      //Test_UartAFC_Tx()  ;
		
        *pt_str = uart_getch();
		uart_sendbyte(*pt_str);
        if (*pt_str == 0x0D)
        {
	        if (pt_str != str)
	        {
	            // Send str_send
	            uart_sendbyte(CR[0]);
	            //Send received string
	            pt_str = str;
				uart_printf("the string you just input is:\n\n");
	            while (*pt_str != 0x0D)
	            {
	                uart_sendbyte(*pt_str);
	        		pt_str++;
	            }
	            pt_str = str;
	        }
            uart_sendbyte(CR[0]);
			uart_printf("\n");
			uart_printf(str_send);
        }
        else
             pt_str++;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?