Thread: serial communication and general issues

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    68

    serial communication and general issues

    Hello Everyone
    I'm a newbe to these forums and my apologies if i post a few threads in wrong sections for these boards.

    I have learnt c a few months back and have got the basics of it and can write a few complicated programs
    I am used to programming in old compilers (turbo c v3...) and quiet frankly i find them much easier to work with.
    But some(well many features..) don't work with them so i tried my hand with a gcc compiler(code blocks) and it works pretty good too.But then again....they also have some flaws (functions that work in borland dont work in gcc ..isnt there a common compiler for all...?)

    I have searched a few threads on these boards and still haven't got a good enough answer to my queries..
    1.Which is better, a GCC compiler or Borland?
    2.Can someone please give me an alternative for the bios.h header,as it is outdated and none of those functions(bioscom..etc) work on windows(vista,7,8) anymore...
    3.I have gone through msdn,and found a few functions like

    HANDLE,read(),write() but do not know how to implement them.
    If someone could give me an example program (including all the headers required,and on which compiler the code would work),i would really appreciate it)
    Here's the sample program using bios.h,which i want to write using the msdn functions.

    Code:
    //basically i have a usb to db9(rs232) connecter and i short the tx and rx pins...so what data i send,it prints the same thing on the screen
    #include <bios.h>
    #include <conio.h>
    #include <dos.h>
    
    
    #define COM1        14
    #define DATA_READY 0x100
    #define TRUE       1
    #define FALSE      0
    
    #define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
    
    int main(void)
    {
       int in, out, status, DONE = FALSE;
       clrscr();
      bioscom(0, SETTINGS, COM1);
       cprintf("... BIOSCOM [ESC] to exit ...\n");
       while (!DONE)
       {
          status = bioscom(3, 0, COM1);
         if (status & DATA_READY)
        if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)
             putch(out);
         if (kbhit())
         {
            if ((in = getche()) == '\x1B')
               DONE = TRUE;
            bioscom(1, in, COM1);
         }
       }
       return 0;
    }
    I will post a few more of these kinds of questions(mostly serial communication based),so i would request the admins to please keep this thread open for sometime.
    Last edited by ak47; 09-17-2012 at 11:56 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Serial Communication in C++
    By NewGuy100 in forum C++ Programming
    Replies: 8
    Last Post: 04-24-2006, 01:56 PM
  2. Serial Communication
    By Korn1699 in forum C# Programming
    Replies: 0
    Last Post: 11-29-2005, 12:50 PM
  3. C Serial Communication BCD
    By ZoomCities in forum C Programming
    Replies: 1
    Last Post: 10-13-2005, 07:00 PM
  4. Serial Communication Help
    By NewGuy100 in forum C Programming
    Replies: 4
    Last Post: 07-28-2005, 09:15 AM
  5. serial communication
    By hick.hack in forum C++ Programming
    Replies: 1
    Last Post: 02-13-2003, 12:18 PM