From: Lofstad E. <crc...@ya...> - 2000-10-31 13:59:58
|
Is there a good way to access the serial port using mingw since is does not have the termios functions? I've tried using some Windows code (CreateFile, BuildCommDBC, and WriteFile). That compiles and links without any warnings but always crashes on execution with a invalid page fault in Kernel32.dll. Listed below are the main lines for I used for opening the port. char *SerPort = "com1"; HANDLE Comm; DCB dcb; COMMTIMEOUTS cto = {0}; Comm = CreateFile(SerPort, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); cto.ReadTotalTimeoutConstant = 500; SetCommTimeouts(Comm, &cto); FillMemory(&dcb, sizeof(dcb), 0); dcb.DCBlength = sizeof(dcb); BuildCommDCB("19200,n,8,1", &dcb); Eric __________________________________________________ Do You Yahoo!? Yahoo! Messenger - Talk while you surf! It's FREE. http://im.yahoo.com/ |
From: <gui...@ya...> - 2002-08-18 03:38:00
|
Hi, since I decided to use Dev-C++ as my primary IDE, I feel I must join this MingW-users mail list. Hello, everybody! Is there a good solution in mingw that operate serial communication port? I searched out some C/C++ libraries, but they only mentioned VC++ / Borland C++ compiler, I think I must ask here for any experiences from mingw users. How do you access serial port? What library is your favorite? Or even pure win32 api? For non-blocking (event driven) programming, pure win32 api must has many work to do. Am I right? Thanks! Leon Wang Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com --------------------------------- Do You Yahoo!? 雅虎娱乐新鲜到底,电子周报快乐到家! |
From: Oscar F. <of...@wa...> - 2002-08-18 06:19:24
|
Guidance <gui...@ya...> writes: > Hi, since I decided to use Dev-C++ as my primary IDE, I feel I must > join this MingW-users mail list. Hello, everybody! Welcome! > Is there a good solution in mingw that operate serial communication > port? I searched out some C/C++ libraries, but they only mentioned > VC++ / Borland C++ compiler, I think I must ask here for any > experiences from mingw users. If the library comes with source code included, and it builds fine with MSVC++ and Borland, it should build fine with MinGW too. Probably you will need to create the Makefile (or whatever Dev-C++ uses) for MinGW, if the library does not comes with one included, but most of the time this is an easy task. > How do you access serial port? What library is your favorite? Or even > pure win32 api? For non-blocking (event driven) programming, pure > win32 api must has many work to do. Am I right? If you don't have a trusty library at hand and you are comfortable with the Win32 API and the serial device you need to manage has a precise and fixed communication specifications, the Win32 API is possibly as good choice as locating, learning and verifying a C/C++ library. -- Oscar |
From: <gui...@ya...> - 2002-08-18 09:05:47
|
Yes, it's source code. It need multi-thread support enabled by the compiler, how can I enable that in mingw? And all you ever accessed serial port in mingw is win32 api? If the library comes with source code included, and it builds fine with MSVC++ and Borland, it should build fine with MinGW too. Probably you will need to create the Makefile (or whatever Dev-C++ uses) for MinGW, if the library does not comes with one included, but most of the time this is an easy task. Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com --------------------------------- Do You Yahoo!? 雅虎娱乐新鲜到底,电子周报快乐到家! |
From: Alberto L. <al...@na...> - 2002-08-18 09:36:39
|
Hope you'll find this useful: http://www.iseran.com/Win32/FAQ/section5.html#84 At 17:05 18/08/02 +0800, you wrote: >Yes, it's source code. It need multi-thread support enabled by the >compiler, how can I enable that in mingw? > >And all you ever accessed serial port in mingw is win32 api? |
From: Luke D. <cod...@ho...> - 2002-08-19 01:25:33
|
To use threads with Mingw, compile and link all of your objects = (including libraries) with the "-mthreads" option to gcc. Yes, I have only used the Win32 API to access serial ports, though with = MSVC not Mingw (but there is no difference). I noticed that the Common = C++ library (http://sourceforge.net/projects/cplusplus/) has = platform-independent classes for multithreaded serial I/O and lots more. Luke Dunstan ----- Original Message -----=20 From: Guidance=20 To: Min...@li...=20 Sent: Sunday, August 18, 2002 5:05 PM Subject: Re: [Mingw-users] serial port Yes, it's source code. It need multi-thread support enabled by the = compiler, how can I enable that in mingw?=20 And all you ever accessed serial port in mingw is win32 api?=20 =20 If the library comes with source code included, and it builds fine with MSVC++ and Borland, it should build fine with MinGW too. = Probably you will need to create the Makefile (or whatever Dev-C++ uses) for MinGW, if the library does not comes with one included, but most of the time this is an easy task. Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com -------------------------------------------------------------------------= ----- Do You Yahoo!? = =D1=C5=BB=A2=D3=E9=C0=D6=D0=C2=CF=CA=B5=BD=B5=D7,=B5=E7=D7=D3=D6=DC=B1=A8= =BF=EC=C0=D6=B5=BD=BC=D2! |
From: Luke D. <cod...@ho...> - 2002-08-18 07:37:36
|
If you can find C/C++ libraries for MSVC or Borland that are open = source, they should compile with Mingw without too much trouble (unless = of course they require MFC or something like that). You may already know = that you can usually use MSVC static libraries or DLLs with Mingw if = they are written in C, but not C++. When looking for open source = libraries, you should also search for cross-platform libraries (e.g. on = SourceForge). If a suitable library is not available, the Win32 API would be the next = option. Using overlapped I/O is not too difficult if you need = non-blocking serial I/O. I don't know about event-driven programming, = but multithreading is another option worth considering. Luke Dunstan ----- Original Message -----=20 From: Guidance=20 To: min...@li...=20 Sent: Sunday, August 18, 2002 11:37 AM Subject: [Mingw-users] serial port Hi, since I decided to use Dev-C++ as my primary IDE, I feel I must = join this MingW-users mail list. Hello, everybody! Is there a good solution in mingw that operate serial communication = port? I searched out some C/C++ libraries, but they only mentioned VC++ = / Borland C++ compiler, I think I must ask here for any experiences from = mingw users. How do you access serial port? What library is your favorite? Or even = pure win32 api? For non-blocking (event driven) programming, pure win32 = api must has many work to do. Am I right? Thanks! Leon Wang Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com -------------------------------------------------------------------------= ----- Do You Yahoo!? = =D1=C5=BB=A2=D3=E9=C0=D6=D0=C2=CF=CA=B5=BD=B5=D7,=B5=E7=D7=D3=D6=DC=B1=A8= =BF=EC=C0=D6=B5=BD=BC=D2! |
From: E L. <cr...@my...> - 2002-08-19 12:22:37
|
http://www.iftools.com/ This library is basically a wrapper for the serial port API (and some timer stuff) that can be used on both win32 and linux. It is intended for wxWindows, but it works fine with out it. On Sun, 2002-08-18 at 02:43, Luke Dunstan wrote: > If you can find C/C++ libraries for MSVC or Borland that are open source,= they should compile with Mingw without too much trouble (unless of course = they require MFC or something like that). You may already know that you can= usually use MSVC static libraries or DLLs with Mingw if they are written i= n C, but not C++. When looking for open source libraries, you should also s= earch for cross-platform libraries (e.g. on SourceForge). >=20 > If a suitable library is not available, the Win32 API would be the next o= ption. Using overlapped I/O is not too difficult if you need non-blocking s= erial I/O. I don't know about event-driven programming, but multithreading = is another option worth considering. >=20 > Luke Dunstan >=20 > ----- Original Message -----=20 > From: Guidance=20 > To: min...@li...=20 > Sent: Sunday, August 18, 2002 11:37 AM > Subject: [Mingw-users] serial port >=20 >=20 > Hi, since I decided to use Dev-C++ as my primary IDE, I feel I must joi= n this MingW-users mail list. Hello, everybody! >=20 > Is there a good solution in mingw that operate serial communication por= t? I searched out some C/C++ libraries, but they only mentioned VC++ / Borl= and C++ compiler, I think I must ask here for any experiences from mingw us= ers. >=20 > How do you access serial port? What library is your favorite? Or even p= ure win32 api? For non-blocking (event driven) programming, pure win32 api = must has many work to do. Am I right? >=20 > Thanks! >=20 > Leon Wang >=20 >=20 >=20 >=20 > Join Rapid-Q & B++ WebRing now! http://citymap.getmyip.com >=20 >=20 >=20 >=20 >=20 > -------------------------------------------------------------------------= ----- > Do You Yahoo!? > =E9=9B=85=E8=99=8E=E5=A8=B1=E4=B9=90=E6=96=B0=E9=B2=9C=E5=88=B0=E5=BA= =95,=E7=94=B5=E5=AD=90=E5=91=A8=E6=8A=A5=E5=BF=AB=E4=B9=90=E5=88=B0=E5=AE= =B6! |