home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
ISC366.ZIP
/
SERIAL
/
EXAMPLES
/
MAIN.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-01
|
978b
|
64 lines
#include <conio.h> ; // kbhit.
#include "serial.h";
//#define TRANSMIT // now defined in Options|Compiler|Code generation|Defines
//#define RECEIVE // - DITTO -
SERIAL_PORT com1;
char * text= "hello there!!!";
#ifdef TRANSMIT
// simple transmit.
int main()
{
com1.activate(1); // hooks to com1.
com1.set_up_port(9600,8,'N',1); // setup port.
while (*text) {
com1<< *text++;
}
while (com1.output_buff_len()); // normally, this is not neccessary.
return 0;
}
#endif /* TRANSMIT */
#ifdef RECEIVE
int main()
{
int i= 0;
BYTE t;
com1.activate(1); // hooks to com1.
com1.set_up_port(9600,8,'N',1); // setup port.
while (text[i]&& (!kbhit())) {
if (com1>> t) {
putch(t);
if (t== text[i])
i++;
else
i= 0;
}
}
return 0;
}
#endif /* RECEIVE */