Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: jjaco160 on October 23, 2005, 07:24:50 pm

Title: COM Port Programming
Post by: jjaco160 on October 23, 2005, 07:24:50 pm
I am trying to write a console application in Windows 2000 to talk to the serial port in C/C++.

I have been able to use Turbo C++ to talk to the serial ports using the dos.h inportb/outportb. I tried editing my main.cpp to include the dos.h from Turbo C, but the compiler says undefined reference to outportb/inportb.

I like the user friendliness of Codeblocks when writing code. Can someone tell me where I can get a serial/com port library that I can link to Codeblocks, or how to use the dos.h that Turbo C uses in Codeblocks?

Thanks,

JM
Title: Re: COM Port Programming
Post by: takeshimiya on October 23, 2005, 08:04:58 pm
You can't access directly to the serial port in windows 2000 (or any windows in the post-98 era).

As for a library for accesing serial port, I don't know any multiplatform one, but just search in google.

But if you're using wxWidgets, try with wxCtb http://sourceforge.net/project/showfiles.php?group_id=51305&package_id=45182
located at wxCode http://wxcode.sourceforge.net
Title: Re: COM Port Programming
Post by: rudin on October 24, 2005, 08:59:20 am
CTB (or wxCTB) is a multiplatform library, and actually doesn't need any wxWidgets component. See more detail explanation at http://www.iftools.com/ctb.en.html. In Windows platform, it will be easier if we use MinGW compiler + MSYS (http://www.mingw.org) to build CTB as a static library.

HTH.
Title: Re: COM Port Programming
Post by: tiwag on October 24, 2005, 09:08:12 am
i've made a CB project file, just copy it in the root-ctb directory and change your pathes to wx-2.4.2 (this is needed as i know)

[attachment deleted by admin]
Title: Re: COM Port Programming
Post by: takeshimiya on October 24, 2005, 04:42:47 pm
Thanks for the clarification, I'll take a look for my electronic projects then. :D