[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rxtx
Subject:    Re: RXTX build instructions on Windows?
From:       Bob Jacobsen <Bob_Jacobsen () lbl ! gov>
Date:       2002-07-06 4:33:01
[Download RAW message or body]

At 2:36 AM +0100 7/5/02, Trent Jarvi wrote:
>
>Hmm I think I see why I did not finish this in the first place.  The DCB
>struct in win32 has something that looks like the custom buad rate
>selection:  Commprop->dwMaxBaud  "BAUD_USER indeicates a nonstandard baud
>rate can be programmed."
>
>while the above can be selected in about three places I dont see how to
>tell the UART the divisor and and baudbase.  My documentation of win32
>API's is minimal and I've only got the GNU tools to work with here.

It's my understanding that you can set the baud rate as an integer in 
the DCB, and it (?) will work out the divisor, etc, to make it 
happen.  If it can't do it exactly, it finds the "closest" available 
rate, which is usually good enough.

Earlier, one of my colleagues had suggested setting the baud rate by 
writing a little bit of JNI code to do this:

    DCB dcb;

    FillMemory(&dcb, sizeof(dcb), 0);
    if (!GetCommState(hComm, &dcb))     // get current DCB
       // Error in GetCommState
       return FALSE;

    // Update DCB rate.
    dcb.BaudRate = 16457;

    // Set new state.
    if (!SetCommState(hComm, &dcb))
       // Error in SetCommState.

so I think a similar construct (except for the hard-coded baud rate) 
ends up doing the right thing.

>Bob:
>
>You mentioned the speeds are defined.  What are the headers showing?

Sorry, I'm not sure what you're asking.

Bob

-- 
--------------
Bob Jacobsen (Bob_Jacobsen@lbl.gov, 510-486-7355, fax 510-495-2957)
Am working off a huge email backlog, call if it's urgent.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic