C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 09-26-2009, 02:27 AM   #1
Registered User
 
Join Date: Sep 2009
Posts: 4
Lightbulb RS232 serial port library for Linux and Windows

If you intend to write a GPL-licensed, opensource and multiplatform program in C or C++ and you want to use the serial port, look here:

RS-232 for Linux and WIN32

With this library, you can use GCC on Linux and MinGW on windows to access the serial
port without the need to make any changes in your sourcecode.

Regards.
Theodoor is offline   Reply With Quote
Old 09-26-2009, 02:36 AM   #2
Registered User
 
yann's Avatar
 
Join Date: Sep 2009
Location: Zagreb, Croatia
Posts: 179
woooooooow, thanks man!
__________________
"Hackers build things, crackers destroy them."
I am an 13 year old wannabe AI programmer.
For now I am programing with perceptrons.
yann is offline   Reply With Quote
Old 09-26-2009, 02:36 AM   #3
Registered User
 
yann's Avatar
 
Join Date: Sep 2009
Location: Zagreb, Croatia
Posts: 179
is there anything like this for the USB port?
__________________
"Hackers build things, crackers destroy them."
I am an 13 year old wannabe AI programmer.
For now I am programing with perceptrons.
yann is offline   Reply With Quote
Old 09-26-2009, 02:43 AM   #4
Registered User
 
yann's Avatar
 
Join Date: Sep 2009
Location: Zagreb, Croatia
Posts: 179
But....how to install the library?
__________________
"Hackers build things, crackers destroy them."
I am an 13 year old wannabe AI programmer.
For now I am programing with perceptrons.
yann is offline   Reply With Quote
Old 09-26-2009, 03:07 AM   #5
Registered User
 
Join Date: Sep 2009
Posts: 4
Quote:
Originally Posted by yann View Post
But....how to install the library?
Put the two files in the directory where your other C files are.
Put the following define in the headerfile of the module from
where you want to use the RS-232 functions:

#include "rs232.h"

Don't forget to tell your compiler that it has to compile and link
the rs232.c file. For example:

gcc main.c rs232.c -o myprogramname
Theodoor is offline   Reply With Quote
Old 09-26-2009, 03:13 AM   #6
Registered User
 
yann's Avatar
 
Join Date: Sep 2009
Location: Zagreb, Croatia
Posts: 179
Ok thanks, is there anything like this for USB-port?
__________________
"Hackers build things, crackers destroy them."
I am an 13 year old wannabe AI programmer.
For now I am programing with perceptrons.
yann is offline   Reply With Quote
Old 09-26-2009, 03:36 AM   #7
Registered User
 
Join Date: Sep 2009
Posts: 4
Quote:
Originally Posted by yann View Post
Ok thanks, is there anything like this for USB-port?
You can use this library for USB-devices as well in case your USB-device uses a FTDI-chip
for USB-connection in combination with a VCP-driver (Virtual ComPort).
Linux has this USB-VCP-driver already built-in. For windows you need to download
a free driver from the FTDI website.

For more info about VCP-drivers for USB-devices, visit:

Virtual COM Port Drivers

Quote:
Virtual COM port (VCP) drivers cause the USB device to appear as an additional COM port available to the PC. Application software can access the USB device in the same way as it would access a standard COM port.
Theodoor is offline   Reply With Quote
Old 09-26-2009, 05:41 AM   #8
Registered User
 
yann's Avatar
 
Join Date: Sep 2009
Location: Zagreb, Croatia
Posts: 179
Thanks man...can you give me some code examples for USB?
__________________
"Hackers build things, crackers destroy them."
I am an 13 year old wannabe AI programmer.
For now I am programing with perceptrons.
yann is offline   Reply With Quote
Old 09-26-2009, 06:45 AM   #9
Registered User
 
Join Date: Sep 2009
Posts: 4
Quote:
Originally Posted by yann View Post
Thanks man...can you give me some code examples for USB?
There is no difference with a serial port because the VCP-drivers emulates a serial port.
Except for that you have to open /dev/ttyUSB0 instead of /dev/ttyS0.

Quote:
Virtual COM port (VCP) drivers cause the USB device to appear as an additional COM port available to the PC.
Application software can access the USB device in the same way as it would access a standard COM port.
Theodoor is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
serial port control Unregistered C++ Programming 1 08-09-2002 06:44 PM
OpenGL and Windows sean345 Game Programming 5 06-24-2002 10:14 PM
Need help or info about serial port communication Unregistered Linux Programming 1 01-08-2002 01:48 PM
serial port still wont work alcoholic C++ Programming 6 10-31-2001 12:51 PM
sendng bytes to a serial port need help alcoholic C++ Programming 1 10-28-2001 11:17 AM


All times are GMT -6. The time now is 03:48 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22