basicqbasicqb64

does 8250 uart require to match modem baud


I am studying modem i/o and am setting the uart through com1: and the base address x03f8 and am wondering if the uart connection to the modem must be equal? I am doing this in QB64.


Solution

  • Found this DLAB subroutine:

    ' sets port dlab (Divisor Latch Access Bit)
    SUB SetBPS (Var)
    SELECT CASE Var
    CASE 1 ' 19200
        LByte = 6
    CASE 2 ' 38400
        LByte = 3
    CASE 3 ' 57600
        LByte = 2
    CASE 4 ' 115200
        LByte = 1
    END SELECT
    Var2 = Base.Address
    IF Var2 = 0 THEN
        SELECT CASE Port
        CASE 0
            Var2 = &H3F8
        CASE 1
            Var2 = &H2F8
        CASE 2
            Var2 = &H3E8
        CASE 3
            Var2 = &H2E8
        CASE 4
            Var2 = &H3E0
        CASE 5
            Var2 = &H2E0
        CASE 6
            Var2 = &H338
        CASE 7
            Var2 = &H238
        CASE ELSE
            EXIT SUB
        END SELECT
    END IF
    ' divisor latch low
    LSB = Var2 ' 3F8x
    ' divisor latch high
    MSB = Var2 + 1 ' 3F9x
    ' line control register
    LCR = Var2 + 3 ' 3FBx
    MSBSave = INP(MSB)
    OUT MSB, 0
    OUT LCR, 128 ' dlab
    ' set baud rate
    OUT LSB, LByte ' least significant byte
    OUT MSB, 0 ' most significant byte
    OUT LCR, 3 ' n,8,1
    OUT MSB, MSBSave
    END SUB