Serial Port (2) Initializing Com port

xiaoxiao2021-03-06  113

How to make the COM port in the interrupt mode: 1, open the interrupts corresponding to the COM port 2, MCR bit3 (OUT2) 3, and Ier put the needed interrupts,

How to make COM ports in FIFO mode: 1. Setting FCR bit0 Let COM know that the following is a command to set the FIFO mode. 2. Set FCR bit7-bit6 to determine the buffer size 0 1BYTE 0 1 4Byte 1 0 8byte 1 1 14Byte3. Set the FCR bit3 to start the FIFO mode The code below is initializing the COM port, and working in the FIFO mode. Sample Code; SET IRQ ENABLE AND OUT2 TO SET Enable Interrupts MOV CL, COM_IRQ; MOV DX, 21H CMP CL, 7; Judge IRQ> 7 JBE SHORT WLSP_00 MOV DX, 0A1H SUB CL, 8

WLSP_00: IN AL, DX; Program Interrupt Controller To

MOV AH, 01 SHL AH, CL XOR AH, 0FFH and Al, Ah Out DX, Al

MOV CL, COM_IRQ; CMP CL, 7 JBE WLSP_01

In Al, 21h and Al, 0FBH OUT 21H, Al

WLSP_01:

MOV BH, MCR; Modem Control Register Call Read_com_reg; Read the Reg To

MOV BH, MCR MOV BL, 008H; set out2 to set enable interrupts call prog_com_reg; Program THE REG

; Set enable bud_rate MOV BX, 0383H; PROG 3FB REG TO; DATA BITS = 8, Access Baud Rate Generator Call PROG_COM_REG

PROGRAM The BAUD RATE DIVISOR MOV BH, 00H; PROG 3FB REG TO SET MOV BL, DIVISER; BAUD RATE DIVISOR LSB CALL PROG_COM_REG

MOV BX, 0100H; PROG 3F9H REG TO SET; Baud Rate Divisor MSB Call PROG_COM_REG; Reset DLAB, Program 8 Bits, 1 Stop Bit, No Parity Checking Mov BX, 0303H; 3FB, 8 BITS Per Char Call PROM_REG

PROGRAM COM Port Interrupt Enable Register Mov BX, 0100H; PROG 3F9 Reg To; Disable Thre, Line Status,; Modem-Status-Change, Data Available Int Call PROG_COM_REG

; FIFO Control Register MOV BX, 0201H; Prog 3fa Reg To; Enable Fifos Call PROG_COM_REG

MOV BX, 02C7H; PROG 3FA REGT, TX FIFO RESET, ENABLE FIFO; Clear Fifos, 14-Byte Level Call PROG_COM_REG

; Interrupt Ident Register MoV Bh, 02H; 3FAH REG CALL READ_COM_REG

Modem Conltrol Register Mov BX, 040BH; PROG 3FC Reg To; Activate DTR, RTS, OUT2 CALL PROG_COM_REG

Interrupt Enable Register MoV BX, 010FH; Prog 3f9 Reg To; Enable Thre, Line Status,; Modem-Status-Change, Data Available Int Call PROG_COM_REG

Line Status Register - LSR; Reset The LSR; RESET IIR MOV BH, 05H; 3FDH REG CALL READ_COM_REG

Modem Status Register - MSR; Reset MSR; Reset IIR MOV BH, 06H; 3FEH REG CALL READ_COM_REG Series Article Connection CMO 1

转载请注明原文地址:https://www.9cbs.com/read-99068.html

New Post(0)