I want to run a PC comport with a baudrate of 31250 (Yes, I know it is a
crazy value, but I need to interface an old system running this). But when I
plunk in 31250 for BaudRate member of the DCB my call to SetCommState fails
with "Invalid Parameter" Errorcode 87. When I use a value of 19200
everything is fine.

The Platform SDK help says:
"Baud rate at which the communications device operates. This member can be
an actual baud rate value, or one of the following indexes: CBR_110 bla bla
bla"

I always thought that it would be possible to use any desired value, but
sofar I have no luck. I have been googling and googling for help, but all to
no avail.

Any help on this topic is greatly appreciated. Thanking you all in advance.

Henrik Nowak

10-01-2007, 01:29 PM

unix

Re: Setting a "unsupported" baudrate fails

Henrik Nowak wrote:[color=blue]
> Hello group,
>
> I want to run a PC comport with a baudrate of 31250 (Yes, I know it is a
> crazy value, but I need to interface an old system running this). But when I
> plunk in 31250 for BaudRate member of the DCB my call to SetCommState fails
> with "Invalid Parameter" Errorcode 87. When I use a value of 19200
> everything is fine.
>
> The Platform SDK help says:
> "Baud rate at which the communications device operates. This member can be
> an actual baud rate value, or one of the following indexes: CBR_110 bla bla
> bla"
>
> I always thought that it would be possible to use any desired value, but
> sofar I have no luck. I have been googling and googling for help, but all to
> no avail.
>
> Any help on this topic is greatly appreciated. Thanking you all in advance.
>
> Henrik Nowak[/color]

Standard hardware probably can't do it. The baud rate is determined by
dividing down a basic clock frequency, and only selected integer
divisors are possible.

--
Scott McPhillips [VC++ MVP]

10-01-2007, 01:29 PM

unix

Re: Setting a "unsupported" baudrate fails

"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote:
[color=blue]
>Henrik Nowak wrote:[color=green]
>> I want to run a PC comport with a baudrate of 31250 (Yes, I know it is a
>> crazy value, but I need to interface an old system running this). But when I
>> plunk in 31250 for BaudRate member of the DCB my call to SetCommState fails
>> with "Invalid Parameter" Errorcode 87. When I use a value of 19200
>> everything is fine.[/color][/color]
[color=blue][color=green]
>> I always thought that it would be possible to use any desired value, but
>> sofar I have no luck. I have been googling and googling for help, but all to
>> no avail.[/color][/color]
[color=blue]
>Standard hardware probably can't do it. The baud rate is determined by
>dividing down a basic clock frequency, and only selected integer
>divisors are possible.[/color]

Maybe, GetCommProperties, especially the COMMPROP-struct, gives hints
about the baud rates available? Anyway, you have to check the return
of SetCommState.

Andreas
--
"The superior pilot uses his superior judgement to avoid those
situations that would otherwise require his superior skill".

10-01-2007, 01:29 PM

unix

Re: Setting a "unsupported" baudrate fails

"Henrik Nowak" <henrik8381@ofir.dk> wrote:
[color=blue]
>I want to run a PC comport with a baudrate of 31250[/color]

For most serial ports, only baud rates that meet this equation
are allowed:

baud = 115200 / N (N is an integer >= 1)

10-01-2007, 01:30 PM

unix

Re: Setting a "unsupported" baudrate fails

MIDI.

"Henrik Nowak" <henrik8381@ofir.dk> wrote in message
news:42652521$0$188$edfadb0f@dread11.news.tele.dk...[color=blue]
> Hello group,
>
> I want to run a PC comport with a baudrate of 31250 (Yes, I know it is a
> crazy value, but I need to interface an old system running this). But when
> I
> plunk in 31250 for BaudRate member of the DCB my call to SetCommState
> fails
> with "Invalid Parameter" Errorcode 87. When I use a value of 19200
> everything is fine.
>
> The Platform SDK help says:
> "Baud rate at which the communications device operates. This member can be
> an actual baud rate value, or one of the following indexes: CBR_110 bla
> bla
> bla"
>
> I always thought that it would be possible to use any desired value, but
> sofar I have no luck. I have been googling and googling for help, but all
> to
> no avail.
>
> Any help on this topic is greatly appreciated. Thanking you all in
> advance.
>
> Henrik Nowak
>
>
>
>[/color]