Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 5 out of 5     Rate this Document

Can I Use Non-Standard Baud Rates Under LabVIEW With Serial Boards?

Primary Software: Driver Software>>NI-VISA
Primary Software Version: 3.3
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>Base Package
Hardware: Serial>>RS-232

Problem:
I am using a PCI Serial Board from a 3rd Party manufacturer and am able to specify very specific baud rates when using it under Visual C++.  How can I use non-standard baud rates in LabVIEW 7.0 with NI-VISA? 

Solution:
On Windows, VISA will pass any baud rate set by the user (the only check is to make sure that it is greater than or equal to 50 and is an integer) to "SetCommState" (this is an OS system call). It will then call "GetCommState" and see what the OS reports as the active baud rate. If the OS reports something different than what we set, it will return "VI_ERROR_NSUP_ATTR_STATE" (error -1073807330).

When changing the frequency of the physical oscillator on an NI-Serial board, the driver has no way of knowing that the frequency of the oscillator has changed, so whoever changes the frequency needs to map to the value that the oscillator previously used. For instance, if you doubled the frequency of the oscillator from the previous one, you would specify 9600 baud even though you really will get 19200 baud. There is also a slight degree of error, where you can specify a standard baud rate but still work with a device that deviates a little from that. So, if you have an instrument that requires 19210, you can get away with 19200 in your program, but you can't specify 19210 in the program because the driver would find that value invalid.

Related Links:
Developer Zone Tutorial: Serial Communication Overview
Developer Zone Tutorial: Serial Communications Hardware Concepts and Hardware Overrun Errors
KnowledgeBase Q9K92I: Serial Baud Rates Supported By NI-VISA

Attachments:





Report Date: 08/26/2004
Last Updated: 08/04/2007
Document ID: 3CPHL3SU

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit