Thread: RE: [Dev-C++] Serial Communication
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Alex C. <al...@ca...> - 2001-04-26 01:22:35
|
Thank for info.I understand that but: Direct hardware access in 32-bit Windows is generally not allowed. While it can be done in the Win9x OS by using inline assembly, this is generally discouraged as this technique is not supported under WinNT. The hardware port communication family of functions, such as inportb, inpw, outportb and outpw are now deprecated and are no longer supported. Is there some way to use Win32 API CreateFile and the Win32 communications functions under Dev-C++? Thanks in advance Alex Cosic -----Original Message----- From: Yeoh HS [mailto:ye...@ya...] Sent: Thursday, 26 April 2001 11:01 AM To: dev...@li... Subject: Re: [Dev-C++] Serial Communication Hi, Try this site: http://www.beyondlogic.org/serial/serial1.htm Yeoh ----- Original Message ----- From: Alex Cosic <al...@ca...> To: <Dev...@li...> Sent: Thursday, April 26, 2001 8:29 AM Subject: [Dev-C++] Serial Communication > Hi there, > > I am looking for some information on how to establish serial communication > with Dev-C++. I sthere some rourines to establish serial connection with let > 's say com2 port? > > I have read winbase.hand it seems to be possible but I could not get the > exact command. There is a structure to do that, but there is no enough > information to write simple routine for serail communication. > Thanks in davance > > Regards > > Alex Cosic > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Yeoh H. <ye...@ya...> - 2001-04-26 01:38:02
|
You might want to look at this sample code from Planet Source Code It uses Win32 API functions to access the comm ports. Class for serial port access under Windows NT. http://www.planet-source-code.com/xq/ASP/txtCodeId.677/lngWId.3/qx/vb/script s/ShowCode.htm Yeoh ----- Original Message ----- From: Alex Cosic <al...@ca...> To: <dev...@li...> Sent: Thursday, April 26, 2001 9:23 AM Subject: RE: [Dev-C++] Serial Communication > Thank for info.I understand that but: > > Direct hardware access in 32-bit Windows is generally not allowed. While it > can be done in the Win9x OS by using inline assembly, this is generally > discouraged as this technique is not supported under WinNT. The hardware > port communication family of functions, such as inportb, inpw, outportb and > outpw are now deprecated and are no longer supported. Is there some way to > use Win32 API CreateFile and the Win32 communications functions under > Dev-C++? > Thanks in advance > > Alex Cosic > > > -----Original Message----- > From: Yeoh HS [mailto:ye...@ya...] > Sent: Thursday, 26 April 2001 11:01 AM > To: dev...@li... > Subject: Re: [Dev-C++] Serial Communication > > > Hi, > > Try this site: > http://www.beyondlogic.org/serial/serial1.htm > > Yeoh > > ----- Original Message ----- > From: Alex Cosic <al...@ca...> > To: <Dev...@li...> > Sent: Thursday, April 26, 2001 8:29 AM > Subject: [Dev-C++] Serial Communication > > > > Hi there, > > > > I am looking for some information on how to establish serial communication > > with Dev-C++. I sthere some rourines to establish serial connection with > let > > 's say com2 port? > > > > I have read winbase.hand it seems to be possible but I could not get the > > exact command. There is a structure to do that, but there is no enough > > information to write simple routine for serail communication. > > Thanks in davance > > > > Regards > > > > Alex Cosic > > > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
|
From: Bolek V. <vr...@pa...> - 2001-04-26 20:12:48
|
I had written a non-overlapped serial communication in C++ some time
ago. It uses Win32 API, but it didn't work under Dev-CPP 4.0. It works
under Borland's free C++ compiler 5.5. I guess there is an error in
Dev-CPP (or in my code? - I just read the Win32 API help from Microsoft
and wrote something). It will hang at somewhere at GetCommState in open(
) under DevCPP 4.
I send it to you. It is a part of a much greater work that controls a
scientific device. The device can be controlled with serial port or GPIB
- that's why I created an abstract class TCommunicator. Just changing
the communicator used from TSerialComm to TGPIBComm will make the
program use GPIB instead of serial.
The device reads a command, obeys it and sends a response. The response
always ends with a special char - the end char. No end char means the
response didn't come. So I wait for it to come and then read the
response.
comm->send( ....);
comm->wait( ....);
comm->read( ....);
That's how I use it. TNessyException is a special class of exceptions
defined in the program and errCommError and errMemory mean an error in
communication or error in memory allocation occured. id is device id -
forget it.
The WinAPI functions used are explained in the Microsoft's Win32 API
help file. I think you can download it at Dev-CPP's web site.
--
============================================================
Ing. Boleslav Vrany
Stanice techniku DDM hl. m. Prahy
Pod Juliskou 2a
Praha 6 - Dejvice
16000
Czech Republic
tel. (420 2) 243 10 240 |