?? main.c
字號:
#include "s3c2410.h"
#include "serial.h"
#define GPB7_out (1<<(7*2))
#define GPB8_out (1<<(8*2))
#define GPB9_out (1<<(9*2))
#define GPB10_out (1<<(10*2))
static unsigned long m_RandSeed;
/* 隨機函數 */
inline unsigned long Rand()
{
return (m_RandSeed=1664525L*m_RandSeed+1013904223L)>>5;
}
void wait(unsigned long dly)
{
for(; dly > 0; dly--);
}
int main()
{
unsigned long i = 0, cnt = 0;
unsigned char c;
GPBCON = GPB7_out|GPB8_out|GPB9_out|GPB10_out;
init_uart( ); //波特率57600,8N1(8個數據位,無校驗位,1個停止位)
while(1){//本程序從串口接收數據后,判斷其是否數字或子母,若是則加1后輸出
GPBDAT = (~( (i++)<<7));
c = getc( ) + 1;
if ( (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ){
putc( c );
cnt++;
}
if( cnt == 40){
cnt = 0;
putc(0x0d); //回車
putc(0x0a); //換行
}
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -