Skip to content Skip to navigation

Connexions

You are here: Home » Content » Serial Write & Read VI

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • National Instruments display tagshide tags

    This module is included in aLens by: National InstrumentsAs a part of collection:"LabVIEW Graphical Programming Course"

    Comments:

    "A full introductory course on programming with LabVIEW."

    Click the "National Instruments" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • CSE & eScience Content

    This module is included inLens: Computational Science and Engineering and eScience Content
    By: Jan E. OdegardAs a part of collection:"LabVIEW Graphical Programming Course"

    Click the "CSE & eScience Content" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

Serial Write & Read VI

Module by: National Instruments. E-mail the author

User rating (How does the rating system work?)
Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

:
(0 ratings)

Summary: For this exercise, the objective is to build a VI that communicates with an RS-232 device. Complete the following steps to use the Instrument I/O Assistant to build a VI that communicates with the NI Instrument Simulator.

Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.

NI Instrument Simulator

  1. Power off the NI Instrument Simulator and configure it to communicate through the serial port by setting the following switches on the side of the box.
    Figure 1
    Figure 1 (simserial.png)
    These switch settings configure the instrument as a serial device with the following settings:
    • Baud rate=9,600 Baud rate 9,600
    • Data bits=8 Data bits 8
    • Parity=no parity Parity no parity
    • Stop bits=1 Stop bits 1
    • Flow control parameters=hardware handshaking Flow control parameters hardware handshaking
    Handshaking is a means of data flow control. Software handshaking involves embedding control characters in transmitted data. For example, XON/XOFF flow control works by enclosing a transmitted message between the two control characters XON and XOFF. Hardware handshaking uses voltages on physical wires to control data flow. The RTS and CTS lines of the RS-232 device are frequently used for this purpose. Most lab equipment uses hardware handshaking.
  2. Make sure the NI Instrument Simulator is connected to a serial port on the computer with a serial cable. Make a note of the port number.
  3. Power on the NI Instrument Simulator. The Power, Ready, and Listen LEDs are lit to indicate that the device is in serial communication mode.

Block Diagram

  1. Open a blank VI and build the block diagram shown in Figure 2.
    Figure 2
    Figure 2 (Serialbd.png)
    1. ioassist.png Place the Instrument I/O Express VI, located on the Functions>>Input palette, on the block diagram. Complete the following steps in the Instrument I/O Assistant dialog box that appears to configure the Express VI.
      1. Choose COM1 (or COM2 depending on the connection port of the NI Instrument Simulator) from the Select an instrument pull-down menu.
      2. Click the Add Step button and click Write. In the command field, type *IDN? and select \n as the Termination character.
      3. Click the Add Step button and click Read and Parse.
      4. Click the Add Step button and click Read and Parse again.

        Note:

        The Instrument Simulator returns the byte size of the response, the termination character, the response, then another termination character. Therefore, after *IDN? is sent to the instrument, the response must be read twice.
      5. Click the Run button (not the Run this step button). The Run button runs the entire sequence.
      6. Return to the first Read and Parse step.
      7. Click the Auto parse button. The value returned is the size in bytes of the query response.
      8. Rename Token to String Length in the Token name text box.
      9. Select the second Read and Parse step.
      10. Click the Auto parse button. The value returned is the identification string of the NI Instrument Simulator.
      11. Rename Token to String in the Token name text box. The configuration window should be similar to the Figure 3.
        Figure 3
        Figure 3 (IOSerial.png)
      12. Select OK to return to the block diagram.
    2. Right-click the String output and select Create>>Indicator from the shortcut menu.
    3. Right-click the String Length output and select Create>>Indicator from the shortcut menu.

      Tip:

      Since LabVIEW is set to handle errors automatically, there is no need to connect a Simple Error Handler VI to error out.
  2. Display the front panel and run the VI.
  3. Save the VI as Serial Communication.vi in the C:\Exercises\LabVIEW Basics I directory.
  4. Close the VI when finished.

Content actions

Give Feedback:

E-mail the module author | Rate module ( How does the rating system work?)

Rating system

Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

(0 ratings)

Download:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.

| A lens (?)

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks