⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 promodem.doc

📁 MODEM驱动程序
💻 DOC
📖 第 1 页 / 共 2 页
字号:




  Page 12 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: int GetCarrierDetect(AJMS *controlBlock);

  Description: Checks the status of the DCD (Data Carrier Detect) line
	       on the serial port. This is used to detect if a modem
	       has a carrier or not.

  Return Value: CARRIER    - If there is a carrier.
		NO_CARRIER - If there isn't a carrier.

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously */
			    /* been set up and the COM port is OPEN   */

  if (GetCarrierDetect(&controlBlock) == NO_CARRIER) /* Check DCD */
  printf("\nThere is no Carrier\n"); /* Display Loss of Carrier.  */
  }






  Page 13 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: void SetBaudRate(AJMS *controlBlock, unsigned long baudRate);

  Description: Sets up the baud rate for the serial port.

  Return Value: None.

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously */
			    /* been set up and the COM port is OPEN   */

  SetBaudRate(&controlBlock, (unsigned long)38400); /* set to 38.4k Baud */
  }






  Page 14 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: void SetDTR(AJMS *controlBlock);

  Description: Turns ON the DTR (Data Terminal Ready) line on the
	       serial port. OpenCom() automaticly turns on DTR
	       when a COM port is initially opened. DTR needs to
	       be turned on to talk to a modem.

  Return Value: None.

  Also see: DropDTR()

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously */
			    /* been set up and the COM port is OPEN   */

  SetDTR(&controlBlock); /* Turns on DTR (Data Terminal Ready) */
  }






  Page 15 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: void DropDTR(AJMS *controlBlock);

  Description: Turns OFF the DTR (Data Terminal Ready) line on the
	       serial port. CloseCom() does NOT automatically turn
	       OFF DTR. Some modems when set up correctly will
	       drop carrier when DTR is toggled from ON->OFF->ON.
	       Your modem manual will explain more about this
	       and how to set up your modem to respond to DTR.

  Return Value: None.

  Also see: SetDTR()

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously */
			    /* been set up and the COM port is OPEN   */

  DropDTR(&controlBlock); /* Turns off DTR (Data Terminal Ready) */
  }






  Page 16 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: void SetDataFormat(AJMS *controlBlock, int options);

  Description: Sets the Data format for a COM port. OpenCom()
	       automatically sets the COM port to 8 Bits, 1 stop,
	       no parity. To override this, use this function.

  Return Value: None.

  Example Usage:

  /* BITS_7       - Sets COM port for 7 bits                */
  /* BITS_6       - Sets COM port for 6 bits                */
  /* BITS_7       - Sets COM port for 7 bits                */
  /* BITS_8       - Sets COM port for 8 bits                */
  /* STOP_BITS_1  - Sets COM port for 1 stop bit            */
  /* STOP_BITS_2  - Sets COM port for 2 stop bits           */
  /* PARITY_ON    - Sets COM port to use parity             */
  /* NO_PARITY    - Sets COM port not to use a parity bit   */
  /* EVEN_PARITY  - Sets COM port to use even parity        */
  /* ODD_PARITY   - Sets COM port to use odd parity         */
  /* STICK_PARITY - Sets COM port to use stick parity       */
  /* SET_BREAK    - Sets COM port to set break              */

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously  */
			    /* been set up and the COM port is OPEN    */

    /* Sets COM port for 8-N-1, simply Bitwise OR anything you want. */
  SetDataFormat(&controlBlock, BIT_8 | NO_PARITY | STOP_BITS1);
  }






  Page 17 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: int SendString(AJMS *controlBlock, char *string);

  Description: Sends a NULL terminated string to the COM port.

  Return Value: CARRIER    - If there was a carrier while sending string.
		NO_CARRIER - If there wasn't a carrier while sending string.

  Also see: SendCharacter()

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously  */
			    /* been set up and the COM port is OPEN    */

  SendString(&controlBlock, "\nHello World!"); /* Send string to COM port */
  }






  Page 18 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: SetFIFOMode(AJMS *controlBlock);

  Description: Turns on the FIFO buffer for a COM port. This will only
	       work with a UART 16550.

  Return Value: FIFO_ENABLED    - The FIFO has been enabled.
		NO_FIFO_PRESENT - No FIFO present (16550 Uarts ONLY)

  Also see: SetFIFOTriggerLevel()

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously  */
			    /* been set up and the COM port is OPEN    */

    /* Try to enable the FIFO */
  if (SetFIFOMode(&controlBlock)==FIFO_ENABLED)
     printf("\nFIFO has been enabled.");
  else
     printf("\nNo FIFO Present, not a 16550.");
  }






  Page 19 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: SetFIFOTriggerLevel(AJMS *controlBlock, unsigned char mode);

  Description: Sets the FIFO trigger level for the RCVR FIFO Interrupt.
	       This only works with a UART 16550.

  Return Value: None.

  Also see: SetFIFOMode()

  Example Usage:

  /* FIFO_1_TRIGGER  - IRQ will trigger with 1 byte in FIFO buffer   */
  /* FIFO_4_TRIGGER  - IRQ will trigger with 4 bytes in FIFO buffer  */
  /* FIFO_8_TRIGGER  - IRQ will trigger with 8 bytes in FIFO buffer  */
  /* FIFO_16_TRIGGER - IRQ will trigger with 16 bytes in FIFO buffer */

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously  */
			    /* been set up and the COM port is OPEN    */

    /* Sets FIFO to trigger on 16 characters in RCVR buffer */
  SetFIFOTriggerLevel(&controlBlock, FIFO_16_TRIGGER);
  }






  Page 20 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: int WaitForCharacter(AJMS *controlBlock, double seconds);

  Description: Waits for a character to be received in the IRQ receive
	       queue for a specified number of seconds.

  Return Value: (int)         - Character received (high byte masked)
		WAIT_TIME_OUT - Time out, no character received.

  Also see: GetCharacter()

  Example Usage:

  #include "promodem.h"
  example()
  {
  unsigned char ch;

  extern AJMS controlBlock; /* Assumes a control block has previously */
			    /* been set up and the COM port is OPEN   */

   /* wait 3.5 seconds for a character, or timeout */
  ch = WaitForCharacter(&controlBlock, 3.50);
  if (ch==WAIT_TIME_OUT)
    printf("\nTimeout, no character received.\n");
  else
    printf("\nHere is the character '%c'\n", ch);
  }







  Page 21 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: DisableIRQ(AJMS *controlBlock);

  Description: Turns OFF the IRQ vector and restores it to the
	       original vector before the com port was opened.
	       This should ALWAYS be done if you are doing any spawning
	       that swaps your program to Disk or EMS.

  Return Value: None.

  Also see: EnableIRQ()

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously */
			    /* been set up and the COM port is OPEN   */

  DisableIRQ(&controlBlock); /* Restores IRQ vector to original  */
  }






  Page 22 - ProModem Users Manual        Interactive Telecommunication Systems


  Function: EnableIRQ(AJMS *controlBlock);

  Description: Sets up the IRQ vector to point to ProModem's serial
	       receive IRQ internal routine. This should only be used
	       if DisableIRQ() was previously called. OpenCom()
	       automatically sets up the IRQ vector when the com port
	       is originally opened.

  Return Value: None.

  Also see: DisableIRQ()

  Example Usage:

  #include "promodem.h"
  example()
  {
  extern AJMS controlBlock; /* Assumes a control block has previously */
			    /* been set up and the COM port is OPEN    */

  EnableIRQ(&controlBlock); /* Sets IRQ vector to point to ProModem's IRQ */
  }




  Page 23 - ProModem Users Manual        Interactive Telecommunication Systems

  TERMINAL.C - Example terminal program using ProModem.

  TERMINAL.C is a demo program written using the routines in the
  ProModem library to demonstrate the library functions.

  To build the program you need to have the PROMODEM.H file that came in
  the archive and the PROM_TC.LIB or PROM_MSC.LIB to link with.
  Once you have the correct LIBs and .H files in your INCLUDE and
  LIB directories, compile and link:

  nmake PROMODEM.MAK                   ;Microsoft QuickC
  cl terminal.c /link PROM_MSC.LIB     ;Microsoft C
  tcc terminal.c PROM_TC.LIB           ;Turbo C

  TERMINAL.C is yours to do what you want with.

  NOTE: With Microsoft compilers, you must <<TURN OFF>> the DEBUG flag
	if it is set.



  Page 24 - ProModem Users Manual        Interactive Telecommunication Systems

  BBS.C - Example Bulletin Board System using ProModem.

  BBS.C is a demo BBS program written using the routines in the
  ProModem library to demonstrate the library functions.

  To build the program you need to have the PROMODEM.H file that came in
  the archive and the PROM_TC.LIB or PROM_MSC.LIB to link with.
  Once you have the correct LIBs and .H files in your INCLUDE and
  LIB directories, compile and link:

  nmake BBS.MAK                   ;Microsoft QuickC
  cl bbs.c /link PROM_MSC.LIB     ;Microsoft C
  tcc bbs.c PROM_TC.LIB           ;Turbo C

  BBS.C is yours to do what you want with.

  NOTE: With Microsoft compilers, you must <<TURN OFF>> the DEBUG flag
	if it is set.


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -