Author Topic: COM Port Programming  (Read 16975 times)

jjaco160

  • Guest
COM Port Programming
« 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

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: COM Port Programming
« Reply #1 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

Offline rudin

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: COM Port Programming
« Reply #2 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.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: COM Port Programming
« Reply #3 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]

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: COM Port Programming
« Reply #4 on: October 24, 2005, 04:42:47 pm »
Thanks for the clarification, I'll take a look for my electronic projects then. :D