Home » U++ Library support » U++ Library : Other (not classified elsewhere) » About RS232
Re: About RS232 [message #13414 is a reply to message #13411] |
Fri, 04 January 2008 23:48 |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |
|
|
Nick, your code will of course throw an exception.
Mistakes you`ve made:
1) You try to read 0x2f8 address instead of port 2f8, which is usually connected with one of RS232 ports.
2) You try to read from port in Windows, where direct working with hardware ports is prohibited (if you`re not kernel-mode device driver).
3) Virtual COM-ports like bluetooth ones are not physical RS-232 ports. So there is no way to read them with any physical port, like 2f8.
Instead, you should do following:
1) Open port with CreateFile
2) Do reading/writing with ReadFile/WriteFile
3) Close the port with CloseHandle.
Things you must consider:
1) Your application must be multithreaded. One thread works with COM-port, while other thread respond to users`s GUI input.
2) You should make some kind of options or config, where to change COM-port number and it`s settings (speed, timeouts, etc) without recompiling the program
I strongly recommend you reading these topics:
(basic)
MSDN: CreateFile, ReadFile, WriteFile (COM-ports)
MSDN: Threads
U++: Config
(intermediate)
MSDN: Threads synchronization
(advanced)
MSDN: Overlapped i/o
Recently I`ve written U++ class, which makes all the hard work with COM-port. You should only write appropriate callbacks. For now, it works only for Windows, since I`m just starting learning Linux. If it`s needed in current state of development - I`ll upload it here.
|
|
|
|
|
About RS232
|
|
|
Re: About RS232
By: mirek on Mon, 26 June 2006 20:05
|
|
|
Re: About RS232
By: qwerty on Tue, 11 July 2006 19:44
|
|
|
Re: About RS232
By: qwerty on Mon, 11 September 2006 01:25
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: ebojd on Wed, 25 April 2007 20:39
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: forlano on Fri, 10 October 2008 21:33
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: forlano on Sat, 11 October 2008 11:17
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: forlano on Sat, 11 October 2008 23:07
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: forlano on Sun, 12 October 2008 23:03
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: forlano on Mon, 13 October 2008 23:00
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: forlano on Mon, 20 October 2008 19:27
|
|
|
Re: About RS232
By: gxl117 on Wed, 11 November 2009 08:44
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: gxl117 on Fri, 13 November 2009 04:40
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: Didier on Tue, 26 January 2010 22:54
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: Didier on Fri, 05 February 2010 00:19
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: Reini on Sat, 06 March 2010 18:42
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: Didier on Sun, 07 March 2010 13:38
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: Didier on Sun, 07 March 2010 19:50
|
|
|
Re: About RS232
By: Didier on Sun, 07 March 2010 20:56
|
|
|
Re: About RS232
By: mr_ped on Wed, 16 June 2010 16:55
|
|
|
Re: About RS232
By: Didier on Wed, 16 June 2010 22:08
|
|
|
Re: About RS232
By: mr_ped on Wed, 16 June 2010 16:57
|
|
|
Re: About RS232
By: jeremy_c on Fri, 20 August 2010 01:30
|
|
|
Re: About RS232
By: koldo on Fri, 20 August 2010 08:23
|
|
|
Re: About RS232
By: jerson on Fri, 20 August 2010 10:00
|
|
|
Re: About RS232
By: jeremy_c on Fri, 20 August 2010 13:58
|
|
|
Re: About RS232
By: koldo on Fri, 20 August 2010 14:30
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: jerson on Sun, 21 November 2010 16:21
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: jibe on Fri, 15 March 2013 14:40
|
|
|
Re: About RS232
By: Zbych on Fri, 15 March 2013 16:04
|
|
|
Re: About RS232
By: jibe on Fri, 15 March 2013 15:55
|
|
|
Re: About RS232
By: jerson on Fri, 15 March 2013 16:00
|
|
|
Re: About RS232
By: jibe on Fri, 15 March 2013 22:45
|
|
|
Re: About RS232
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: deep on Thu, 09 May 2013 08:58
|
|
|
Re: About RS232
|
|
|
Re: About RS232
By: jibe on Wed, 20 March 2013 15:22
|
Goto Forum:
Current Time: Sat Apr 20 11:22:51 CEST 2024
Total time taken to generate the page: 0.03408 seconds
|