MIDAS
Loading...
Searching...
No Matches
rs232test.cxx File Reference
#include <midas.h>
#include "rs232.c"
Include dependency graph for rs232test.cxx:

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void  )

Definition at line 16 of file rs232test.cxx.

17{
19 char str[10000];
20
21 printf("Enter port [/dev/ttyS0]: ");
22 fgets(str, sizeof(str), stdin);
23 if (strchr(str, '\n'))
24 *strchr(str, '\n') = 0;
25
26 if (!str[0])
27 strcpy(str, "/dev/ttyS0");
28
29 info.fd = rs232_open(str, 9600, 'N', 8, 1, 0);
30
31 if (info.fd < 0) {
32 printf("Cannot open ttyS0\n");
33 return 0;
34 }
35
36 /* turn on debugging, will go to rs232.log */
38
39 printf("Connected to ttyS0, exit with <ESC>\n");
40
41 do {
42 memset(str, 0, sizeof(str));
43 str[0] = ss_getchar(0);
44 if (str[0] == 27)
45 break;
46
47 if (str[0] > 0)
49
50 rs232_gets(&info, str, sizeof(str), "", 10);
51 printf(str);
53
54 } while (1);
55
58
59 return 1;
60}
#define CMD_DEBUG
Definition midas.h:815
INT ss_getchar(BOOL reset)
Definition system.cxx:7503
void ** info
Definition fesimdaq.cxx:41
#define TRUE
Definition midas.h:182
char str[256]
Definition odbhist.cxx:33
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function: