I could safely say that at this point we have seen enough information to design our own control systems, we could focus on the design of sensors and actuators however, as it is still fresh information to work with microcontrollers I think we should take the momentum to introduce us to the subject of electronic communications.
In this article we will briefly investigate the concept of serial communication, why it is important for us to understand this concept and describe some tools that we will use for our future simulations on serial communication between devices.
Podría decir con mucha seguridad que en este punto hemos visto suficiente información para diseñar nuestros propios sistemas de control, podríamos enfocarnos en el diseño de sensores y actuadores sin embargo, como aún está fresca la información para trabajar con microcontroladores considero que debemos aprovechar el impulso para introducirnos en el tema de las comunicaciones electrónicas.
En este artículo vamos a indagar brevemente en el concepto de comunicación serial, por que es importante para nosotros comprender este concepto y describiremos algunas herramientas que vamos a usar para nuestras simulaciones futuras sobre comunicación serial entre dispositivos.
Need for communication |
|---|
During our applications with microcontrollers we have made some in which we could say that a communication was established between the microcontroller and the operator, a clear form of this was the use of an LCD since its only function in a process is to provide information to the operator.
There are also applications in which we provide information to the microcontroller by means of push buttons, keyboards or potentiometers as there was a bidirectional exchange of information between the microcontroller and we could say that we established a communication with the device that was previously programmed to respond.
Communication (between electronic devices and human beings) arises as a need to know the data in a process and to take action on them, a system can operate without being monitored but no system is invulnerable to failures, it is for this reason that a monitored system can have a more efficient corrective, predictive and preventive maintenance.
Durante nuestras aplicaciones con microcontroladores hemos realizado algunas en las que se podría decir que se estableció una comunicación entre el microcontrolador y el operador, una forma clara de ello fue el uso de una LCD ya que su unica funcion en un proceso es la de brindar información al operador.
También existen aplicaciones en las que le suministramos información al microcontrolador mediante pulsadores, teclados o potenciómetros como hubo un intercambio de información en forma bidireccional entre el microcontrolador y nosotros podríamos afirmar que establecimos una comunicación con el dispositivo que fue previamente programado para responder.
La comunicación (entre dispositivos electrónicos y seres humanos) surge como una necesidad de poder conocer los datos en un proceso y poder tomar acción en ellos, un sistema puede operar sin ser monitoreado pero ningún sistema es invulnerable a fallas, es por esta razón que un sistema monitoreado puede tener un mantenimiento correctivo, predictivo y preventivo más eficiente.
There are cases where several microprocessors must operate together in the same process, it would not be convenient to place LCDs to each microcontroller involved, that is when the need arises to establish communication between different devices so that only one (master) which consult all others (slaves) and provide us with the information, that we call master would be like a representative of all others and is the only one with whom we will interact as it will also be responsible for warning the others about the instructions we give.
Earlier we said that machines have their own language (machine language) and it is logical to think that if there will only be communication between two devices do not need to convert this language to one that can be interpreted by humans, that task will only be performed by the master or representative within the system.
However, some guidelines must be established within the communication to avoid errors or misinterpretations by a device, thinking about this have been created what is known as communication protocols which are the rules that must be followed in a given communication so that it can be executed successfully.
Existen casos en los que varios microprocesadores deben operar juntos en un mismo proceso, no sería conveniente colocar LCDs a cada microcontrolador implicado, es ahí cuando surge la necesidad de establecer comunicación entre distintos dispositivos de manera que sea uno solo (maestro) el que consulte a todos los demás (esclavos) y nos facilite la información, ese que llamamos maestro sería como un representante de todos los demás y es el unico con el que vamos a interactuar ya que también se encargará de avisarle a los demás sobre las instrucciones que demos.
Antes dijimos que las máquinas tienen su propio lenguaje (lenguaje máquina) y es lógico pensar que si solo habrá comunicación entre dos dispositivos no necesitan convertir este lenguaje a uno que pueda ser interpretado por humanos, esa tarea solo la va a realizar el maestro o representante dentro del sistema.
Sin embargo, se deben establecer unas pautas dentro de la comunicación para evitar errores o malas interpretaciones por parte de un dispositivo, pensando en esto se han creado lo que se conoce como protocolos de comunicación que son las reglas que se deben seguir en una comunicación determinada para que esta pueda ejecutarse satisfactoriamente.
There are different communication protocols and each one has different rules, so it is necessary to know the protocol used and its rules to establish communication between devices. Among the rules we can also find two ways in which data can be sent, which are through serial communication and parallel communication.
Existen diferentes protocolos de comunicación y cada uno tiene diferentes reglas, por eso es necesario conocer el protocolo usado y sus reglas para establecer la comunicación entre dispositivos. Entre las reglas podemos también encontrar dos formas en las que se pueden enviar datos que son mediante comunicación serial y comunicación en paralelo.
Serial communication |
|---|
I will focus on this type of communication because it is the one we will be using in the future, it consists of sending data as bits through the same wire (conductor), a train of pulses is sent (8 usually) and depending on the state of the bits a message is interpreted, sometimes a confirmation bit is needed so that would make a total of 9 bits.
The devices that have serial communication will have two pins, one for transmission and one for reception if they are asynchronous, otherwise (if they are synchronous) one pin will be used for sending and receiving and the other for the clock signal or synchronism signal.
Me centraré en este tipo de comunicación porque es la que vamos a estar usando en el futuro, consiste en enviar datos en forma de bits a través de un mismo hilo (conductor), se envía un tren de pulsos (8 por lo general) y segun el estado de los bits se interpreta un mensaje, en ocasiones se necesita un bit de confirmación por lo que harían un total de 9 bits.
Los dispositivos que disponen de comunicación serial tendrán dos pines, uno para la transmisión y otro para la recepción si son asíncronos, de lo contrario (si son síncronos) un pin se usará para el envío y recepción y el otro para la señal de reloj o señal de sincronismo.
Tools we will use |
|---|
If you notice, so far I have only been using the Proteus simulator to test the operation of our designs, the advantage of using the simulator is that I have no limits with the availability of components, since I am not doing a project but trying to encompass all the control features of a microcontroller a simulator is very useful for this purpose.
We could simulate communication between several microcontrollers using only Proteus but the most used device and as for control systems is a PC so I consider of utmost importance to achieve that our projects communicate with a computer without problems, usually you would need a device that connects our circuit with the PC adjusting the voltage levels and should be done physically, but fortunately there is a software called VSPE that allows us to open a virtual port on our PC that can be detected by our Proteus simulator.
Si te fijas, hasta hora solo he estado usando el simulador Proteus para comprobar el funcionamiento de nuestros diseños, la ventaja de usar el simulador es que no tengo limites con la disponibilidad de componentes, ya que no estoy haciendo un proyecto sino intentando englobar todas las características de control de un microcontrolador un simulador nos es de mucha utilidad para este propósito.
Podríamos simular comunicación entre varios microcontroladores usando solo Proteus pero el dispositivo más usado y como para sistemas de control es un PC por lo que considero de suma importancia lograr que nuestros proyectos se comuniquen con un computador sin problemas, generalmente se necesitaría un dispositivo que conecte nuestro circuito con el PC adecuando los niveles de voltaje y debería hacerse de forma física, pero afortunadamente existe un software llamado VSPE que nos permite abrir un puerto virtual en nuestro PC que puede ser detectado por nuestro simulador Proteus.
For the reception and sending of data using the PC we will rely on the program Hercules that will give us the interface to monitor the data received by the serial port and to send data through it using the PC.
It is probable that when we are already advanced in the subject of communications we will begin to use LABVIEW and we will enter in the design of SCADAs (I will consider it) but the important thing for now is that we learn to design systems capable of communicating with other devices, in the process we will understand the importance and usefulness of it.
Para la recepcion y envio de datos usando el PC nos apoyaremos en el programa Hercules que nos brindara la interface para monitorear los datos recibidos por el puerto serial y para enviar datos a través de él usando el PC.
Es probable que cuando ya estemos avanzados en el tema de comunicaciones comencemos a usar LABVIEW y nos adentramos en el diseño de SCADAs (lo voy a considerar) pero lo importante por ahora es que aprendamos a diseñar sistemas capaces de comunicarse con otros dispositivos, en el proceso vamos a comprender la importancia y utilidad de ello.
I feel a lot of satisfaction for having reached this point and I want to thank all the readers who have accompanied me in the journey, many interesting things are to come for all the lovers of electronic systems.
Siento mucha satisfacción por haber llegado a este punto y quiero agradecer a todos los lectores que me han acompañado en el trayecto, muchas cosas interesantes están por venir para todos los amantes de los sistemas electrónicos.