CREATING A COMMUNICATION BETWEEN A PIC18F4550 MICROCONTROLLER AND A PC VIA USB PORT TYPE IN ORDER TO ACHIEVE INDUSTRIAL AUTOMATION

: This paper addresses the possibility of making a communication between a PC and a PIC18F4550 microcontroller through the USB port type, in order to achieve industrial automation. In order to prove the communication, it will be made a software in Visual Basic v.6 environment that will exchange information with the PIC18F4550 microcontroller.


INTRODUCTION
The USB communications (Universal Serial Bus) are communications between certain equipment and the host which manages the communications (usually a PC). The USB standard was created in 1996. At the standard's base, there are giants such as Intel, Compaq, Microsoft, Digital Equipment Corporation, IBM and Northern Telecom [1].
The USB main line is a solution offered to the serial communications by the new generation of computers. It is a line that provides a bidirectional communication. Nowadays, almost every new hardware generation equipment that connects to a PC via a foreign port is made via USB port, the old RS-232 and LPT ports are losing ground in favor of USB port, such as major manufacturers began to give them up [1].
When you want to realize an industrial automation or to monitor the process parameters through a PC serial communication, among the disadvantages of using the USB port would be: that no more devices can connect directly to that port, or the need to use a machine to translate the USB protocol.
The proposed solution includes communication between a PIC microcontroller (PIC18F4550) and a PC via USB port. This solution enables the developer to develop custom applications. The utilities of this solution include: control of equipment or processes, bidirectional data exchange with certain equipment, by acquiring data from analog or digital processes.
The application which will be made in order to prove a USB connection with a microcontroller, it will allow analog or digital data acquisition, digital control by PC, from a simulation module process through the microcontroller.

The Electric Diagram
The electric diagram (Figure 2) was conceived in Proteus 7 [2]. It is composed of the following parts: USB connector, circuit development for microcontroller, power supply circuit (the power is supplied directly from USB port without needing an external power supply circuit), manual simulation circuit of the processes. Manual simulation circuit of the processes, in turn, consists of the following sub-circuits: the sub-circuit simulating analog voltage to the microcontroller pins (declared as analog inputs RA0, RA1), the sub-circuit viewing the status pins coming from the microcontroller (declared as outputs Digital RB0, RB1, RB2, RB3), the sub-circuit changing the status of the logic pins coming from the microcontroller (declared as digital inputs RB4, RB5, RB6, RB7) [3].

The development of the program for the microcontroller
The microcontroller program was developed in the PCD IDE program and it is based on C ++ programming language. In this program, there were included the libraries needed as a USB port emulation as a serial COM port. When the development board's USB cable will be plugged into the USB port of your PC, you will recognize it as a serial COM port whose serial number is already recognized as a continuation of ports [4, 5, 6].

The development of the interface with the user
The user interface (Figure 3) program was developed in Visual Basic v.6. It is composed of the following modules: the command module digital outputs (RB0, RB1, RB2, and RB3), module visualizing the status of digital inputs (RB4, RB5, RB6, and RB7), module visualizing analog voltages from analog inputs (RA0, RA1) [7]. Regarding the implementation of the program because of the fact that Visual Basic does not have a library for directly accessing the USB port and this would have required writing a driver in assembly language to appeal to the USB port emulation solution into a serial COM port. Data exchange with the microcontroller will be done according to the standard serial COM [8].

THE SIMULATION OF THE APPLICATION
The simulation of the application was developed by modifying the status of the switches located on the board when testing the responsiveness of the signals from digital inputs (from 1 logical to 0 or vice versa) or when modifying the digital output status buttons located in the software interface (from ON to OFF or vice versa) and referring to the analog input, the variable resistance values were modified while being on the testing board, this is the result (Figure 4).

CONCLUSION
Upon implementation and simulation of the application, the following are revealed: -because the microcontroller has a large number of pins that can be configured as digital inputs or as digital outputs, analog inputs can develop complex applications; -because of the USB emulation in serial COM port, the communication speed decreases the speed of standard COM 9600 bps; -the applications developed with this method are cheap applications.