Serial Port Information

Share your advanced PureBasic knowledge/code with the community.
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Serial Port Information

Post by TerryHough »

Here is a program to look for any installed serial ports (Com1 - 16).
For each port found, an attempt is made to send and receive data,
Actually, the data sent is a standard modem request that should return
the modem's information if the port has an attached modem.

NOTE: This uses several WinAPI calls

The code includes examples of:
Defining the DCB
Setting the COMM State
Setting the COMM Timouts
Setting the COMM Buffers
Purging the COMM Buffers
Sending data to a COMx port
Receiving data from a COMx port
Panel and ListIcon gadget handling
SplashMsg (thanks to Vanleth and PB)

An executable and the source code is available <a href="http://www.electrofile.com/purebasic/in ... P">HERE</a>.

Screenshot

Image

Hope you find this useful,

Terry
RJP Computing
Enthusiast
Enthusiast
Posts: 202
Joined: Sun Apr 27, 2003 4:44 am
Location: Michigan, USA
Contact:

Post by RJP Computing »

This looks Great :!:

Thanks. I will download it right now.
-Ryan
RJP Computing

Ubuntu 8.10/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, nVidia GeForce 7600GT 512MB
User avatar
SimpleMind
Enthusiast
Enthusiast
Posts: 112
Joined: Sun May 18, 2003 12:40 pm
Location: Netherlands

Serial I/O

Post by SimpleMind »

Hi,

Thanks for the examples. nice work.

If you want to see some more examples go to the Microssoft site and serach for MTTTY and 'Allen Denver'. He did a very good job on Serial I/O and OVERLAPPED I/O and the creating of threads and events so your interface is not blocking.

MTTTY is C but you can learn a lot of it.

David M. Hitchner wrote ModCOMM a bunch of VB routines.

Regards,

Marcel
Post Reply