CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    3

    How to set the UART's Divisor Register in NT using API

    I have a question about how to change the Divisor Latch in the serial port. In win98, _inp() and _outp() can work, but in NT it don't work. The source is as following:
    unsigned char result;
    unsigned short ppport = 0x2EB;

    result = _inp( ppport );
    _outp( ppport, (result | 0x80));
    _outp( 0x2E8, 21 );
    _outp( 0x2E9, 0x00 );
    _outp( 0x2EB, (result & 0x7F));

    Roy Wang

  2. #2
    Guest

    Re: How to set the UART's Divisor Register in NT using API

    This is (nearly) not possible using NT. Direct hardware access, and by all
    means, hardware access of a device already controlled by a device driver, is
    not supported on NT. There _is_ a way doing this (see DrDobb's Journal, the
    undocumented NT corner, for an article about a device driver named Giveio.sys),
    but this really isn't feasible due to several reasons :

    1) Programming the divider latch register of the UART means setting a new
    baudrate - the COMM API of NT (and Win95) allows for that.

    2) You might not know the I/O address of the serial port in use; NT does not
    always use the direct COM1 = 0x3f8, COM2 = 0x2f8, COM3 = 0x3e8,
    COM4 = 0x2e8 mapping; there may be more than four serial ports
    (I've seen NT machines using 12 serial ports).

    3) You might have serial ports using some completely different hardware;
    that is, no 16550 at all - consider a USB to serial adapter.
    OK, this can't yet be used with NT, but some bright sunny day, Redmond
    might decide to ship Windows 2000 (formerly known as NT 4.0).

    Post a follow-up if you have any further questions; detail what you intend to do.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured