Thread: RS232 connection set up

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    7

    RS232 connection set up

    Hi,
    I am trying to write a program that will read data coming in from the RS232 connection, however I am having trouble figuring out how to set up the connection in C. Can anyone help pls???
    Thanks!

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I just googled this up:
    Creating a Serial communication on Win32 - CodeProject

    If this looks too difficult, I'd advise using one of the libraries that handles this, instead.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    7
    I have been told by one of my lecturers that I will have to use bios.h and conio.h but I cant seem to find the header files to download. Do you know where I can get them from?
    thanks

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You can search on this very board for that very name. You won't find it, of course, since bios.h hasn't been around since the 16-bit era, but it will tell you what you should be looking for instead.

  5. #5
    Registered User jephthah's Avatar
    Join Date
    May 2010
    Location
    seattle
    Posts
    49
    Quote Originally Posted by cs342 View Post
    I have been told by one of my lecturers that I will have to use bios.h and conio.h but I cant seem to find the header files to download. Do you know where I can get them from?
    thanks
    do they insist you use an abacus also? do they make you write your reports on papyrus?

    your poor class. too bad you can't fire your lecturer. he's wasting your time and crippling your ability to transition to the real world.


    at any rate, you cant just "download" a header file. it doesn't work like that.

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    7
    Yeah i know! Can you please explain how Im going to be able to use bios.h and conio.h because im really lost! when I run it it says 'no such file found'

  7. #7
    Registered User jephthah's Avatar
    Join Date
    May 2010
    Location
    seattle
    Posts
    49
    Quote Originally Posted by cs342 View Post
    Yeah i know! Can you please explain how Im going to be able to use bios.h and conio.h because im really lost! when I run it it says 'no such file found'

    i guess you need to throw away your modern, standards-compliant compiler and IDE -- one that you may have spent a good amount of money on -- and replace it with a crusty old piece of deprecated crap just so you can fulfil the arbitrary requirements developed by your instructor's outdated ideas on how serial programming is done.

    but, hey, let's not forget those old compilers with the conio and bios libraries were once considered state of the art ... back in the late 1980's. and if you get you some parachute pants too, you'll be totally rad.


    ...........


    but seriously, you need to find yourself some relatively modern standards-compliant library and install it. read the documentation. then post in their forums if you get stuck. this is not as easy as it seems as the RS232 comm port is now considered a "legacy" device -- therefore most of the libraries you will find, are not free.

    I can't really help you with specifics. For my RS232, I use the proprietary (and rather expensive) National Instruments' CVI libraries .... If I had to do it on my own, i would look into something open source like this library I just found at teuniz.net I've not ever used it, but it looks promising.

    Your other option (for windows) is to learn the Windows API. A worthwhile endeavor, but probably quite out of scope for your project.


    (I will say that, at least in in the manufacturing arena, you will find A LOT of RS-232 equipment, and code running it. so it's useful to learn how to talk to RS232, even if only to give you a foundation for other protocols like USB and perhaps network sockets. However, using conio and bios is not a reasonable way to go about it.)


    .
    Last edited by jephthah; 05-17-2010 at 07:01 PM.

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    If they are expecting very specific hardware and compiler requirements, then it is fair for you to expect they provide the correct compiler for you to use.


    Quzah.
    Hope is the first step on the road to disappointment.

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    My mocking forum colleagues will have various nervous afflictions and nausea, but here it is:

    You need to download Turbo C or TurboC/C++ and use the C compiler for the latter (by default, a file with the extension .c is handled by the C compiler, and one with .cpp is handled via the C++ compiler.

    To find it, google Borland Legacy, and it should be the top of the list.

    I use Turbo C/C++ version 1.01, but for the earlier Turbo C product, I would be sure to get version 2 or 3.

    All these products are free, and have both of the header files you need. Don't try to use these header files on other compilers - that's like to cause a lot of problems, if they're not made for them.

    I hope you'll let me know how you're coming along with this program.

  10. #10
    Registered User jephthah's Avatar
    Join Date
    May 2010
    Location
    seattle
    Posts
    49
    Turbo C?

    well, that's a crappy thing to tell someone to do. seriously i wouldn't tell my worst enemy to do something like that.

    i mean, how about you dress him up in a poodle skirt and propeller beanie and send him out to the ballgame with a "kick me" sign taped to his ass while you're at it?

  11. #11
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Did you not read this Jephthah?

    I have been told by one of my lecturers that I will have to use bios.h and conio.h but I cant seem to find the header files to download. Do you know where I can get them from?
    thanks
    Turbo C is the only free compiler I know of, that has these headers, and is available today.

    I'm not judging it, I'm just trying to help him solve the problem, as the OP has defined it.

  12. #12
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    @jedphthah You have to realize that Adak is pretty much in love with Turbo C, and every time he recommends it I can't help smiling, because I too am a bit nostalgic over it since it was the IDE I used when I first learnt C : Turbo C 1.0 on DOS baby! Woooooo!
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  13. #13
    Registered User jephthah's Avatar
    Join Date
    May 2010
    Location
    seattle
    Posts
    49
    yeah, and i'm nostalgic about BASIC on the TRS-80, but i don't go around hollerin' about it. Seriously, show me one competent credible C programming shop that makes meaningful commercial software that uses Turbo C. you can't do it.

    at any rate, he most definitely does not need to use <conio> or <bios> to read serial rs232. i posted a modern open source standard C library earlier -- one that won't require him to jump into a wayback machine or program with punchcards.

    here, I'll post it again: A Win32 and Linux compatible, open source C library for reading/writing RS-232.

    This library has the same type of simple straightforward interfaces as conio and bios, but doesnt require you to junk up your computer by forcing you to install some 20-year old deprecated old dog turd of a compiler.

    not to mention half of the places you find Turbo C available for download, it's bundled with all sorts of malware to target the retards who don't know well enough to not use it in the first place.


    Turbo C will only serve to impede your progress as a competent modern C programmer.
    Last edited by jephthah; 05-19-2010 at 12:01 AM.

  14. #14
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You've completely misunderstood - <sigh>.

    1) His lecturer told him he had to use the bios.h and conio.h header files.

    2) Turbo C is the only compiler I know of that has both those files, and is freely available.

    Your suggestion is good, but doesn't meet the criteria set by the instructor. It isn't about how I feel about TC.

  15. #15
    Registered User jephthah's Avatar
    Join Date
    May 2010
    Location
    seattle
    Posts
    49
    No, I understand completely and better than you do.

    because, I don't believe that he "has to". i dont' beleive that lecturer actually literally said "you have to" use that steaming pile of crap.

    If he did say that, then he was exaggerating, because he was in a hurry to go play handball.

    and if he did mean it literally, then notice that the OP said "one of his lecturers" told him this .... so obviously he asked the wrong lecturer. He needs to go ask other ones until he gets the right answer.

    Actually what he really needs to do is STOP ASKING and just use a cotdam modern library to on a modern standard C compiler, and once they notice his superior judgment and creativity in finding a credible and worthwhile source to use, he can then demand bonus points for the assignment for being smarter than the retards who continue to yammer on about how people in the 21st century should even attempt to use Turbo C.
    Last edited by jephthah; 05-19-2010 at 12:26 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 01-18-2008, 04:06 AM
  2. Replies: 4
    Last Post: 01-13-2008, 02:14 AM
  3. Replies: 7
    Last Post: 08-19-2007, 08:10 AM
  4. The new FAQ
    By Hammer in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 08-30-2006, 10:05 AM
  5. Set default directory with GetTempDir?
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 05-04-2003, 11:36 PM