Presentation is loading. Please wait.

Presentation is loading. Please wait.

PC Modem Control The 8250 UART supplied with the PC supports a limited number of RS-232-C modem functions: The UART can be programmed to interrupt the.

Similar presentations


Presentation on theme: "PC Modem Control The 8250 UART supplied with the PC supports a limited number of RS-232-C modem functions: The UART can be programmed to interrupt the."— Presentation transcript:

1 PC Modem Control The 8250 UART supplied with the PC supports a limited number of RS-232-C modem functions: The UART can be programmed to interrupt the PC when modem status changes occur. - The ability to control modem conditions (through Modem Control Register). - The ability to determine the modem’s status (from the Modem Status Register).

2 UART Port Addresses and Functions
Port Port Address Offset Uses 0x3F x2F Base address Transmission Register Buffer Receive Register Buffer Line Speed (LSB) 0x3F x2F Base address Interrupt Enable Line Speed (MSB) 0x3FA x2FA Base address Interrupt Identification Register 0x3FB x2FB Base address Line Control Register 0x3FC x2FC Base address Modem Control Register 0x3FD x2FD Base address Line Status Register 0x3FE x2FE Base address Modem Status Register

3 Modem Control Register
DTR: data terminal ready RTS: request to send Out1: not used Out2: enable UART interrupt Loop: enter loopback mode RTS Out1 Out2 Loop DTR

4 MCR Example #define MCR 0x3FC #define DTR 0x01 #define RTS 0x02
#define OUT x08 - To signal the modem that the PC is connected to the channel and has data to send: outportb(MCR, DTR+RTS+OUT2); - To clear the modem: outportb(MCR, OUT2);

5 Modem Status Register - CTS: There has been a change in the Clear to Send signal since the last time the MSR was read. - CTS: The value of the Clear to Send signal DSR RI CD CTS

6 Modem Interrupts - UART generates 4 types of interrupts (interrupt enable register). - Modem status changes can be made to cause interrupts by setting IER to 0x08. #define IER x3F9 #define DATA_AV x01 #define TX_HR_MT x02 #define RVC_LS x04 #define MDM_CHG x08 outportb(IER, MDM_CHG), Data available Tx holding reg. empty Receive Line Status Modem status change

7 Interrupt identification register
Modem Interrupts - Interrupt identification register indicates the cause of the interrupt. IIR Interrupt Receive line status (overrun, parity error, etc.) Received data available TX holding Reg. empty Modem status change Interrupt identification register Interrupt pending Interrupt id (b0) Interrupt id (b1) - The status of modem can be obtained by reading the MSR status = inportb(MSR);

8 Example: Commkit External Modem
- Extends the point-to-point utility to handle modems. - The following modem status changes are recognized: CTS, DSR, RI, RLSD (CD) - Once carrier is detected, the modem enters the DSR state and signals both DSR and RLSD to the UART. - Upon detection of DSR and DLSD, the DTE responds with DTR and RTS. - At this point, DTE is connected DCE and communications can commence.

9 Implementation - Three states: WAIT_FOR_CARREIR, CONNECTED, DISCONECTING - When a modem status change occurs, control is passed to low_level( ), which sends modem status to Application. - Foreground process controls the modem or sends messages to serial port via low_level( ) too. - Create two new process identifiers: MODEM_DATA --> SP1IH (send data) MODEM_CHANGE --> SP2IH (control modem) - MODEM_DATA + code=MODEMSTATUS --> AP AP --> MODEM_CHANGE both cause control to pass to modem_change( )

10 Implementation KEYIH do_modem( ) keyboard_data() do_rmt_scr() XMITDONE
MODEM_DATA (SP1IH) do_rmt_scr() MODEM_CHANGE (SP2IH)

11 Hayes’ Commands - Not all UART Manufacturers conform to RS-232-C signals. - Programs may not be portable across different modems. - Many modems support Hayes’ commands, a set of textual strings that are recognized and interpreted by the modem. - Hayes modem has a front-end that interprets the modem commands issued by the application software, converting them into the signals required by the modem. - When first initialized, the front-end is in “command” state, interpreting any data supplied to it. - Once a connection is established with another modem, the front-end enters the “on-line” state, passing data directly to modem.

12 Hayes’ Commands - +++ : from “on-line” to “command”.
- AT: command prefix - DTxxxx: dial phone number xxxx. - H : hang up - O : from “command” to “on-line” - &Zn=x: assign a phone number, x, to an internal register n. - S=n: dial phone number stored in register n.

13 Hayes Modem State Diagram
All Keystrokes To Internal Modem Command State Successful Call Out, Successful Call In, ATO Connect Message +++ OK Message On-Line State All Keystrokes To Remote

14 Example: Commkit Internal Modem
- Internal Modem is installed as a card in PC. - Most internal modems support Hayes’ AT commands. - For a Hayes modem, - The control software is not in direct communication with UART; rather, all modem control signals are via the AT Commands. - All modem status changes are interpreted by the internal modem and returned to the control software as text via the UART’s data-available interrupt.


Download ppt "PC Modem Control The 8250 UART supplied with the PC supports a limited number of RS-232-C modem functions: The UART can be programmed to interrupt the."

Similar presentations


Ads by Google