* device/include/Makefile.in: fix install
[fw/sdcc] / device / examples / serialcomm / windows / test_serialcomm.cpp
1 // Test program for serial communication. Visual C / MFC Version
2 // Bela Torok / bela.torok@kssg.ch, March 2001
3
4 #include <afxwin.h>    // Defines the entry point for the console application.
5
6 #include <string.h>
7 #include <stdio.h>
8
9 #include "serial.h"
10
11 int main(int argc, char* argv[])
12 {
13
14         HANDLE  hComPort;
15
16         int ComPortNumber = 1;
17
18         hComPort = SerialInit("com1", 1200);  // 1200 Baud
19
20         if( hComPort == 0) {
21                 printf("\n\nError initializing %s!\n", "com1");
22                 exit(1);
23         }
24
25         // write string to RS232
26         SerialPuts(&hComPort, "\nInitialize\n");
27 //      sleep(5000);
28         
29         // read string from RS232
30         printf("\nString received: %s\n", SerialGets(&hComPort));
31
32         CloseHandle(hComPort);
33
34         return 0;
35 }
36