📄 main.c
字号:
// This program shows how to work with USART port
// USART0 and USART 1 (respectively RS232_0 connector and RS232_1 connector) returns echo + *
// Notice: Jumper RXDO/DRXD must be in position RXDO
// Jumper TXDO/DTXD must be in position TXDO
#include "AT91SAM7S64.h"
#include "system.h"
#include "usart.h"
//it's a simple delay
void Delay (unsigned long a) { while (--a!=0); }
//variables for readed char from uart
unsigned int ch1 = 0;
unsigned int ch2 = 0;
int main()
{
/**** System init ****/
InitFrec();
/**** UART ****/
InitUSART0();
InitUSART1();
while(1)
{
/*** UART ***/
ch1 = read_char_USART0_nonstop();
if(ch1 != 0)
{
write_char_USART0(ch1);
write_char_USART0('*');
ch1 = 0;
}
ch2 = read_char_USART1_nonstop();
if(ch2 != 0)
{
write_char_USART1(ch2);
write_char_USART1('*');
ch2 = 0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -