📄 svr_x3.cpp
字号:
#include <stdio.h>
#include <stdlib.h>
#include "rs232x3.h"
// input parameters: baud rate index
int main(int argc, char** argv )
{
int i, ii, i1, baud[3], EndFlag;
char abyte, InStr[20];
// get baud rate indexes
for( i=0; i<3; i++ ) baud[i] = 12; // default: 9600bps
/*switch( argc )
{
case 4: baud[2] = atoi( argv[3] );
case 3: baud[1] = atoi( argv[2] );
case 2: baud[0] = atoi( argv[1] ); break;
}*/
for( i=1; i<3; i++ ) // test COM2, COM3;
{
InitUART( i, baud[i] );
InstallISR( i );
}
for( EndFlag=0; ; )
{
for( i=1; i<3; i++ )
{
i1 = GetInputData( i );
if( i1 == -1 ) continue;
abyte = (char)i1;
printf( "%c", abyte );
if( PutOutputData( i, abyte ) != 0 ) continue;
StartSend( i );
if( abyte == '!' ) EndFlag = 1;
}
if( EndFlag == 1 ) break;
}
for( i=1; i<3; i++ )
{
UninstallISR( i );
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -