communication

This is a discussion on communication within the C Programming forums, part of the General Programming Boards category; hi im trying to do serial communication between two computers using bioscom. I have two graphics programs in a win ...

  1. #1
    in need of help
    Guest

    Unhappy communication

    hi im trying to do serial communication between two computers using bioscom. I have two graphics programs in a win 32 environment not DOS.

    Basically if i press a key say a 4 on the keyboard on one of the computers i need it to go thru the communications line and carry out a function in the program on the other computer. My problem is i dont know how to send a character to the other computer and get it to act as if a key was hit on that computer. and take input and carry out a function.

    I know bioscom only deals with characters and as im sending integers i need to translate them using itoa......but how do i do it all?

    ive established communication between the computers using

    Code:
    #include <bios.h>
    
    #define DATA_READY 0x100
    
    #define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
    
    
    int main (void){
    
    int COM1 = 0;
    int status, OK=0;
    
            printf("\t\t\tSetting up communications");
            printf("\n\n\nEnter Communication port being used: ");
    
            scanf("%d", &COM1);
            COM1--;
    
            bioscom(0, SETTINGS, COM1);  
            status=bioscom(3, 0, COM1);
    
            if (status & DATA_READY){
            printf("communication OK - any key to continue");
            OK=1;
    
             getch();
             }
    
              return 0;
    }
    i've looked all over the net and thru books but i cant find anything that i understand plz can someone help me?

  2. #2
    in need of help
    Guest
    because i was told that i have to use bioscom but i dont know how to....

  3. #3
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    I got this from Borland's library reference book (watered down for length) for _bios_serialcom if it will be of any use.

    Code:
    #define com1 0
    #define DATA_READY 0x100
    #define TRUE 1
    #define FALSE 0
    #define SETTINGS (_COM_1200 | _COM_CHR7 | _COM_STOP1 | COM_NOPARITY)
    ...// main
    unsigned in, out, status;
    _bios_serialcom(_COM_INIT, COM1, SETTINGS);
    for(;;)
    {
        status = _bios_serialcom(_COM_STATUS, COM1, 0);
        if(status & DATA_READY)
            if((out = _bios_serialcom(_COM_RECIEVE, COM1, 0) & 0x7F) != 0)
                putch(out);
         in = getch();
         _bios_serialcom(_COM_SEND, COM1, in);
    }
    ../ end main
    I'd expect that in could also be used to send one byte at a time from a string using something like

    Code:
    char string[] = "test string";
    int i;
    
    for(;;) // from Borland's code
     {
    for(i = 0; string[i] != '\0'; i++)
    _bios_serialcom(_COM_SEND, COM1, string[i]);
    I haven't tried that myself, but I'd be interested in knowing if any part of it works. Good luck.
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    247
    It is ammazing what you can find on google, and this is one of many hits....

    http://www.delorie.com/djgpp/doc/libc/libc_68.html

    this one looks what you maybe after

    http://www.ontrak.net/c.htm

    and the search took the same time to type this reply..hope it helps.
    Last edited by bigtamscot; 12-27-2002 at 03:59 PM.
    hoping to be certified (programming in c)
    here's the news - I'm officially certified.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unkown Hang
    By Bladactania in forum C Programming
    Replies: 31
    Last Post: 04-22-2009, 10:33 AM
  2. Communication skills
    By itsme86 in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 09-14-2006, 02:19 PM
  3. Communication between programs?
    By johny145 in forum Windows Programming
    Replies: 3
    Last Post: 06-01-2005, 11:14 PM
  4. Looking for communication lib
    By BrownB in forum C Programming
    Replies: 3
    Last Post: 04-27-2005, 11:01 AM
  5. Serial communication packets
    By Roaring_Tiger in forum C Programming
    Replies: 3
    Last Post: 04-26-2003, 09:33 AM

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