You are on page 1of 5

EXPERIMENT-03 Aim of the experiment: Study of Serial port communication between two systems using LabVIEW.

(Control of stepper motor through serial port communication.) Apparatus required: LabVIEW software DAQ assistant-NI PXI -8430/16 RS-232 Serial ports DB-9 connector Stepper motor Bread Board-2T4D Multiple power supply unit Connecting wires Chassis Theoretical Descriptions: LabVIEW software : LabVIEW is a graphical programming environment used to develop sophisticated measurement, test, and control systems using intuitive graphical icons and wires that resemble a flowchart. It offers unrivaled integration with many hardware devices and provides numbers of built-in libraries for advanced analysis and data visualization all for creating virtual instrumentation. Some of the key features include faster Programming, Data display & User Interfaces, multicore Programming, Hardware Integration, Multiple Targets and Oss, Data storage and reporting, advanced analysis and Multiple Programming approaches. Serial port communication : In computing, a serial port is a serial communication physical interface through which information transfers in or out one bit at a time (in contrast to a parallel port where multiple flows of data is possible).It is a popular means of transmitting data between a computer and a peripheral device such as a programmable instrument or even another computer. Serial communication uses a transmitter to send data, one bit at a time, over a single communication line to a receiver. This method can be used when data transfer rates are low or must be transferred over long distances. Serial communication is popular because most computers have one or more serial ports, so no extra hardware is needed other than a cable to connect the instrument to the computer or two computers together. While such interfaces as Ethernet, FireWire, and USB all send data as a serial stream, the term "serial port" usually identifies hardware more or less compliant to the RS-232 standard, intended to interface with a modem or with a similar communication device. It is characterized by: The baud rate of the transmission The number of data bits encoding a character The sense of the optional parity bit The number of stop bits

RS-232port : The RS-232 is a standard developed by the Electronic Industries Association (EIA) and other interested parties, specifying the serial interface between Data Terminal Equipment (DTE) and Data Communications

Equipment (DCE). The RS-232 standard includes electrical signal characteristics (voltage levels), interface mechanical characteristics (connectors), functional description of interchange circuits (the function of each electrical signal), and some recipes for common kinds of terminal-to-modem connections. The RS-232 port was once a standard feature of a personal computer for connections to modems, printers, mice, data storage, un-interruptible power supplies, other peripheral devices or other system. However, the limited transmission speed, relatively large voltage swing, and large standard connectors motivated development of the universal serial bus, which has displaced RS-232 from most of its peripheral interface roles. RS-232 Cabling:

Devices that use serial cables for their communication are split into two categories. These are DCE and DTE. DCE are devices such as a modem, TA adapter, plotter, and so on, while DTE is a computer or terminal. RS-232 serial ports come in two sizes, the D-Type 25-pin connector and the D-Type 9-pin connector. Both of these connectors are male on the back of the PC. Thus, another female connector on the device is required to transmit information. The pin connections for the 9-pin and 25-pin D-Type connectors are different. DB-9 connector: The DB-9 connector consists of 9 pins which is occasionally found on smaller RS-232 lab equipment. It is compact, yet has enough pins for the core set of serial pins (with one pin extra). The details of the pin connection are given in the following table.
Function Data Handshake Signal TxD RxD RTS CTS DSR DCD STR Common Other Com RI PIN 3 2 7 8 6 1 4 5 9 DTE Output Input Output Input Input Input Output -Output DCE Input Output Input Output Output Output Input -Input

Terms associated : Speed of DATA transfer: It is the rate at which data or information is being transferred through serial ports. It is expressed in terms of bit rate or baud rate. Bit rate: Number of bits transferred per second Baud rate: Information per second transferred Data bits: It is the smallest unit of data transfer. 1 byte consists of 8 bits. The number of data bits in each character can be 5 (for Baudot code), 6 (rarely used), 7 (for true ASCII), 8 (for any kind of data, as this matches the size of a byte), or 9 (rarely used). Stop bits: Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. If slow electromechanical teleprinters are used, one-and-one half or two stop bits are required. Parity: Parity is a method of detecting errors in transmission. When parity is used with a serial port, an extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with

the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check. The parity bit in each character can be set to none (N), odd (O), even (E), mark (M), or space (S). Flow: Transfer of data or information through serial ports and cables from one system to another is called as flow. To control the flow a serial port may use signals in the interface to pause and resume the transmission of data. For example, a slow printer might need to handshake with the serial port to indicate that data should be paused while the mechanism advances a line.

Experimental Descriptions: Objectives: 1. Use of serial port for transferring string data between two systems. 2. Control of stepper motor through serial port communication. Procedures: Objective 1: In the sender computer, a LabVIEW program using the visa serial pallete was created. The necessary data to the visa serial pallete such as baud rate(9600 bits/sec) ,data bits(8),parity(0:none),stop bits(10:1 bit) and flow control(0:none) are entered. There are two serial ports in the CPU that are used for the experiment. COM1 was selected as the visa resource input serial port and the DB-9 connector cable was extended from the sender computer using a ribbon type cable and this was finally connected to other computer where the output had to be received. In the receiver computer, another LabVIEW program using the same visa serial pallete was created by introducing the essential input parameters as before. The visa resource COM 6 at the output was selected. Input in the form of a string was given to the serial port using the LabVIEW program in sender computer and the output was obtained on the Read Buffer of the lab view program in the receiver computer.
LabVIEW program window-1(sender):

LabVIEW program window-2(receiver):

Objective 2: DB-9 connector was connected to the RS-232 Serial port of the sender system. Input in the form of a string was given to the write buffer section of the LabVIEW program using visa serial palate in the sender. COM1 was selected as the visa resource to input serial port and Connector cable was extended using a ribbon cable and was connected to NIPXI-8430/16 port of the receiver computer. In the receiver computer, another LabVIEW program using the visa serial pallete, DAQ assistant, array, structure, while loop, etc. was created so as to generate a four step switching sequence for stepper motor control. The visa resource COM 6 was the output terminal. The chassis and the connector were connected by cable to the NIPXI-6602 port of the chassis board. The hardware and the computer are interfaced by means of DAQ assistant and output from PXI system was connected to the four input pins of ULN-2003. Four output pins of ULN-2003 were connected four terminals of stepper motor. +5V supply was connected to common terminal of motor and to the common pin on driver (pin 9). Pin 8 was connected to negative terminal, the ground terminal of driver was connected to one of the pins of connector that is marked gnd.Based on the output in the read buffer the motor was run.

LabVIEW program window-3(sender):

LabVIEW program window-4(receiver):

Submitted by: Gyanadutta Swain Roll no.:-ME11M05 Design Stream

You might also like