Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

BACHELOR OF ENGINEERING IN MECHATRONICS [BN009/121]

Interfacing & DAQ

Exercise 4 READ AND WRITE COMMUNICATIONS

STUDENT NAME: AUGUSTO CSAR MAGALHAES STUDENT ID:


B00075193

GROUP PARTNER (S): JEFERSON AUGUSTO SCHNEIDER

DATE SUBMITTED: 19/12/2013

Page 1 of 4

INTRODUCTION
This exercise is mainly focused on the serial interface and how to write and read some data from a computer to another. This exercise contains two parts, both of them use the LabVIEW running a program and having the read and write functions, the first part it will be used two computers to read and write the data, and in the second part it will be obtained a waveform from a oscilloscope and display it on the LabVIEW. SERIAL INTERFACE The serial interface or serial port is a communication port also known as RS-232, it was designed to communicate the computer hardware with devices so as printers, mouse, modems and pen drives. The original format of this port contained 25 wires that could pass the information, but after it the American company IBM designed the actual used port (RS-232) using only 9 pins to make the same communication. This communication is based on a line communication, this means that just one bit of data is transferred at each time, what makes this communication slow compared to other kind of interfaces, but still it is very cheap and trustful.

PART A: CIRCUIT EXPLANATIONS


This circuit is given by the exercise is the following:

Page 2 of 4

Figure 1: Circuit given by the exercise. This VI was used in both computers and the computers are connected by the serial port, then both of the computers run the VI and one of them writes while the other one reads the information sent. One thing noticed in the beginning is that is impossible to write and read at the same time, what is obvious by the theory because it transfers just one bit at a time so one of the computers send the bit and the other one just receives it. Originally the VI given has a constant wired to the function VISA Read, the constant was called BYTES TO READ and both of the computers had to use the same number inside this constant to make the communication works, this constant limited the communication for this number of bytes, any additional byte from the number already used would make the communication lost data. Then the exercise asked to take this constant out and then make the VI work again, in fact if the bytes to read is taken out the VI wont work properly, so as indicated by the exercise and the lecturer it was needed to use another function called Property: Number of bytes at Serial Port, this function was needed to be wired to the VISA Read function and to an indicator to show how many bytes were read in the communication. The outcome of this is that the code is not anymore limited by the number once putted on the constant informed by the user, now the user that writes the data is the one that will chose how many byte will be written. And this is a very important principle because the VI is not limited anymore to a number of acquired data, what is very close to the spaces that an engineer will work into, in many cases informations given by a machine wont be limited to a number of bytes but the machine will generate as much as it performance can generate data, and the system has to read all of it without limiting it. Another important thing to report from the VI is the constant found on the given code, the timeout. The exercise ask to change that value to a very large number and to a zero, to find out what that value can modify in the program, after the two tests, the timeout value is the time that the reading computer waits to receive and data from the other computer, if the data does not arrive it prints an error message. The timeout value is important too because it can serve as a sample for different types of communication that an engineer can use in his work life, there are many different types of machines or devices that need a long time to send a signal or a very short time to do this, the point is when we have a priority of communication, the user needs to decide what will be the first and the last device in the priority of the time to read and information from that certain device. It is complex concept but still very important and this exercise was essential to introduce this concept to the students.

Page 3 of 4

CODE EXPLANATIONS: Summary: What was learned about to Read and Write Serial Communication?
This exercise brought new concepts to the students that will be essential on the formation of an engineer, the serial port was presented so as the possibility of read and write data from another computer or an instrument, what is much the same in a factory or in any place that a engineer will work. The introduction of serial port was very important because its another way to receive and send information without the use of the DAQ device, even though the serial port cannot have all the versatility of the DAQ device, the serial port is cheaper and very used for communication. The DAQ device is a other kind of technology and has other functions. Other concepts were studied not indicated by the exercise but were stimulated by it, so as the relation between timeout value and the priority from a device to read different kind of instruments, a great value from the timeout will mean that the computer reading this device will have to present a great value of waiting to read the signal, time that could be spent to others procedures so as reading other instruments, and an instrument with a minor timeout will send many data that cannot be lost, so this indicates that the computer that reads that instrument has to determine that instrument as a high priority one because if not, that data will be lost, what compromise the efficiency of the system. This exercise of reading and writing from a serial port by the LabVIEW was very important because it doesnt limit the actuation of the software, because it was seen that the DAQ device isnt the only way to receive measurements and to send signals, what amplifies the use of the software. This is essential because in a factory of a work place of an engineer the computer has to read as many ways that a machine can offer what indicates that the software used has to be versatile so as LabVIEW. The learning of this different way of reading and writing was a success.

Page 4 of 4

You might also like