home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / elem-c.zip / SETHAYES.C < prev    next >
Text File  |  1985-05-18  |  2KB  |  43 lines

  1. /***********************************************************************
  2.  *  This is to serve as an example of how to initialize a Hayes Smart- *
  3.  *  modem out of Lattice C.  It initialize the baud  rate divisors  at *
  4.  *  baud, sets the parametes at 8 data bits, no parity, and 1 stop bit *
  5.  *  You can replace the pointer *mdmstg to the command values that you *
  6.  *  want to set the Hayes to.                                          *
  7.  *               Program By:                           *
  8.  *                           Lynn Long                                 *
  9.  *                           Tulsa IBBS C-SIG                          *
  10.  *                           300/450/1200, XMODEM, 24 hours            *
  11.  *                           Registration Required                     *
  12.  ***********************************************************************/
  13.  /*    for comm port # 1.  i will make this into a function as soon as  *
  14.   *    i have time and pass the comm port, baud rate and setup string   *
  15.   *    to it.     Lynn Long   */
  16.  
  17.  
  18. main() 
  19. {      
  20.  
  21.  
  22.     unsigned byte=0x00;
  23.     char *mdmstg =    "ATE0X1V1Q0M0ST=45S2=255S0=1\r";
  24.  
  25.     outp(0x3fb,0x80);     /* to access baud rate divisors */
  26.     outp(0x3f8,0x60);     /* set baud    rate divisor lsb for 1200 bd */
  27.     outp(0x3f9,0x00);     /* set baud    rate divisor msb for 1200 bd */
  28.     outp(0x3fb,0x23);     /* set line    control    reg for    8 bits,    !parity, and 1 stop bit    */
  29.     outp(0x3fc,0x03);     /* force dtr and cs    signals    on */
  30.     outp(0x3f9,0x00);     /* disable interrupts */
  31.     
  32.     while(*mdmstg != '\0'){           
  33.         byte = inp(0x3fd);            /* input line    status register    byte */
  34.         byte &= 0x20;           /* look at transmit    hold status bit    */
  35.         if(byte == 0x20){
  36.             outp(0x3f8,*mdmstg);    /* if transmit hold reg    empty then */
  37.             *mdmstg++;        /* output a byte    and bump pointer to string */
  38.         }
  39.     }
  40.  
  41. }
  42.         
  43.