Solved

baudrate 76800

Posted on 2004-04-28
11
687 Views
Last Modified: 2010-04-05
I need to interface with an electronic card that works at 76800 baud. I thought it was easy, but I found this speed is not standard. Can I set this speed ???
0
Comment
Question by:gianluca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 10937144
Try this

     m_hPort := CreateFile(PChar(sP),
                        GENERIC_READ or GENERIC_WRITE,
                        0, nil,
                  OPEN_EXISTING,
                        FILE_ATTRIBUTE_NORMAL,
                         LongInt(0));
     if m_hPort = INVALID_HANDLE_VALUE then
       begin
// error create
       end
     else
       begin
       if GetCommState(m_hPort, dcbPort) then
           begin
                 { fill in the fields of the structure }
           dcbPort.BaudRate := 76800;
           dcbPort.ByteSize := 8;  // or ...
           dcbPort.Parity := NOPARITY;
          dcbPort.StopBits := ONESTOPBIT;
         dcbPort.Flags := 0;
            { flag bit fields:
            dcb_Binary, dcb_Parity, dcb_OutxCtsFlow, dcb_fOutxDsrFlow,
            dcb_fOutX, dcb_fInX, dcb_DtrFlow, dcb_RtsFlow
            }
         SetCommState(m_hPort, dcbPort);
0
 

Author Comment

by:gianluca
ID: 10937227
I try this way :

dcbPort.BaudRate := 76800;

but the actual baudrate sending out from port is 2.2 Kbaud
0
 
LVL 17

Expert Comment

by:mokule
ID: 10937348
I remember that long ago the divider for baud rate 38400 was 3.
Achieving 76800 was then impossible.
I've had little hope that maybe something was changed. :(
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:gianluca
ID: 10937507
yes you're right. the divider is 2 for 57600 and 1 for 115200.
But looking at CBR_xx constant, there is also a CBR_128000 and CBR_256000,

how is it possible ???
0
 
LVL 17

Expert Comment

by:mokule
ID: 10937552
I've just look at the same. Also CBR_56000.
Maybe try CBR_57600 and then CBR_56000 and watch what is going on?
0
 

Author Comment

by:gianluca
ID: 10937748
today I can not test what happen when I set speed to CBR_56000, I will do tomorrow in office. Do you have another suggestion ?

PS : I already try CBR_57600 and CBR_115200 and it's OK. I've measured the bitlength using a digital oscilloscope and the timing is correct.
0
 
LVL 17

Expert Comment

by:mokule
ID: 10943342
I've tested function
    SetCommState(m_hPort, dcbPort);
giving
  dcbPort.BaudRate
from 100 to 256000 with step 100
For baud rates listed below the result is OK for other there is error 87 - invalid parameter and the value of baud rate remains such as last succesfull setting.


100 : OK
Each from this range OK
9600 : OK

10400 : OK

11500 : OK

12700 : OK
12800 : OK

14300 : OK
14400 : OK

16300 : OK
16400 : OK

19100 : OK
19200 : OK

22900 : OK
23000 : OK

28600 : OK
28700 : OK
28800 : OK

38100 : OK
38200 : OK
38300 : OK
38400 : OK

56000 : OK

57100 : OK
57200 : OK
57300 : OK
57400 : OK
57500 : OK
57600 : OK

114100 : OK
114200 : OK
114300 : OK
114400 : OK
114500 : OK
114600 : OK
114700 : OK
114800 : OK
114900 : OK
115000 : OK
115100 : OK
115200 : OK

128000 : 87
256000 : 87
0
 

Author Comment

by:gianluca
ID: 10943413
How about 76800 ??? is it OK ???
0
 

Author Comment

by:gianluca
ID: 10943423
You mean others from your list are not OK, right ???
0
 
LVL 17

Accepted Solution

by:
mokule earned 125 total points
ID: 10943551
They are not OK.
I'm afraid the only solution is special card something like this

http://www.brainboxes.com/downloads/manuals/serial/MANUAL_CC-279-275_PCI_8_PORT_LYNX_RS232_9-25PIN.pdf
0
 

Author Comment

by:gianluca
ID: 10943605
Yes I think so. Thanks a lot.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Microsoft Access 97 and Delphi XE2 9 85
Browsing a TTreeView in Delphi 5 50
Firemonkey Listview item popup menu ? 1 78
Connect to SQL 2008 r2 server over the Internet 4 85
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question