home *** CD-ROM | disk | FTP | other *** search
- #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 */
-