Thread: Comm Port

  1. #1
    Unregistered
    Guest

    Comm Port

    I am trying to print to a serial printer in DOS. I am using Borland. Any suggestions?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    I have these in my bios.h - look around for similar in your compiler

    Code:
    int  bioscom(int _cmd, char _data, int _port);
    
    #define _COM_INIT          0     /* Init serial port. */
    #define _COM_SEND          1     /* Send character. */
    #define _COM_RECEIVE       2     /* Receive character. */
    #define _COM_STATUS        3     /* Get serial port status. */
    
    #define _COM_CHR7          2     /* 7 bits characters. */
    #define _COM_CHR8          3     /* 8 bits characters. */
    
    #define _COM_STOP1         0     /* 1 stop bit. */
    #define _COM_STOP2         4     /* 2 stop bits. */
    
    #define _COM_NOPARITY      0     /* No parity. */
    #define _COM_ODDPARITY     8     /* Odd parity. */
    #define _COM_SPACEPARITY   16    /* Space parity. */
    #define _COM_EVENPARITY    24    /* Even parity. */
    
    #define _COM_110           0     /* 110 baud. */
    #define _COM_150           32    /* 150 baud. */
    #define _COM_300           64    /* 300 baud. */
    #define _COM_600           96    /* 600 baud. */
    #define _COM_1200          128   /* 1200 baud. */
    #define _COM_2400          160   /* 2400 baud. */
    #define _COM_4800          192   /* 4800 baud. */
    #define _COM_9600          224   /* 9600 baud. */
    
    
    int port = 2;
    int ch = 'A';
    bioscom( _COM_INIT, 0,  port );
    bioscom( _COM_SEND, ch, port );
    ch = bioscom( _COM_RECEIVE, 0, port );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Comm Port - Send Packets
    By samuelmoneill in forum C Programming
    Replies: 1
    Last Post: 04-09-2009, 07:58 AM
  2. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Serial Comm. through a Comm Port - WinXP to PIC
    By MoonlightKnight in forum Networking/Device Communication
    Replies: 5
    Last Post: 10-14-2006, 09:02 PM
  5. General overview of comm port programming.
    By Sebastiani in forum C Programming
    Replies: 2
    Last Post: 02-26-2003, 01:53 PM