Summary of the invention
In order to overcome the shortcoming of above-mentioned prior art, the object of the present invention is to provide a kind of communication interface converter, can realize the transparent transmission of the data of multiple interfaces.
In order to achieve the above object, technical scheme of the present invention is achieved in that
A kind of communication interface converter, comprise RS232 interface module, RS485 interface module, CAN interface module, usb interface module, WIFI interface module and main control module, RS232 interface module, RS485 interface module, usb interface module, WIFI interface module are communicated by letter and are connected with main control module by UART, UART communication only needs a pair of transmission line, article one, as data, send, another is as data receiver, be a full duplex serial communication, the connection of modules and data-switching are all the realizations that is connected to each other by UART; CAN interface module is connected with main control module, and main control module is realized communicating by letter and data-switching between CAN interface and UART interface.
Described main control module comprises main control chip, clock circuit, reset circuit and jtag interface circuit, and clock circuit, reset circuit and jtag interface circuit are connected with main control chip respectively.
Beneficial effect of the present invention: can realize the transparent transmission of the data of multiple interfaces, can be applied to the debugging work in industry spot and laboratory, facilitate the debugging of digital circuit, the debugging of digital circuit be there is to the meaning of positive important.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in detail.
With reference to Fig. 1, a kind of communication interface converter, comprise RS232 interface module, RS485 interface module, CAN interface module, usb interface module, WIFI interface module and main control module, RS232 interface module, RS485 interface module, usb interface module, WIFI interface module are communicated by letter and are connected with main control module by UART, UART communication only needs a pair of transmission line, article one, as data, send, another is as data receiver, be a full duplex serial communication, the connection of modules and data-switching are all the realizations that is connected to each other by UART; RS232 interface module and RS485 interface module adopt MAX232 and MAX485 to drive chip, two kinds of chips are all supported UART interface, CAN interface module adopts 3.3V CAN transceiver SN65HVD230 as driving chip, USB module adopts USB-UART bridgt circuit CP2102 to realize data transmission, WIFI module is used embedded module USR-WIFI232-X, this module is supported TCP/IP/UDP network protocol stack, support UART/GPIO/ ethernet data communication interface, can realize data and do transparent transmission between serial ports and WIFI interface, not do any parsing; Except CAN module, modules all comprises UART interface, and the connection of modules and data-switching are all the realizations that is connected to each other by UART.
With reference to Fig. 2, described main control module comprises main control chip, clock circuit, reset circuit and jtag interface circuit, and clock circuit, reset circuit and jtag interface circuit are connected with main control chip respectively; Main control chip adopts fully-integrated mixed signal SOC (system on a chip) type microcontroller C8051F060, inner integrated CAN controller and UART interface, CAN controller connects the data transmit-receive module of the driving circuit formation CAN module in CAN module, the data layout of CAN interface converts serial data to by main control chip internal conversion and programmed control, and realization is connected with UART interface.
Principle of work of the present invention is: five kinds of interfaces that the present invention relates to are all asynchronous serial communications, transmitting terminal and receiving end do not need clock synchronous, because the form of data-signal is different with level, cause each interface not communicate by letter, when one of them interface has data to send, can be converted to UART by its driving circuit, then mate with the UART of another interface, realize data receiver, finally by the driving circuit switching signal of this interface, meet the semaphore request of this interface.For example, RS232 interface will be communicated by letter with USB interface, first signal is converted to UART by the level shifting circuit MAX232 of RS232, then the transmission pin of the integrated UART of MAX232 connects the reception pin of the integrated UART of CP2102, finally by CP2102 bridgt circuit, be converted to the signal of USB interface, realize the intercommunication mutually between two interfaces.
CAN interface communication not only needs CAN driving circuit, also need CAN controller, CAN interface is not supported UART simultaneously, in order to realize and the communicating by letter of other interfaces, need control chip to realize the conversion of data layout, control chip C8051F060 that the present invention adopts is integrated CAN controller and UART, by the data between programmed control CAN controller and UART, transmit, signal procedure mainly comprises main program module, serial communication modular and CAN bus communication module, master routine comprises that initialization and inquiry send two parts, the reception program that serial ports is communicated by letter with CAN can complete and not need to occur mutual with master routine in interrupt handling routine, it is mainly to be undertaken by inquiry zone bit that the inquiry of master routine sends, if have data in CAN bus, will enter program interrupt, interrupt handling routine receives the data in CAN bus, juxtaposition bit flag position, master routine inquires position, CAN bus receiving flag position, enter serial ports and send master routine, CAN communications reception to data deliver to serial ports and send program, same, the data that serial ports receives are sent to CAN communication transmission program, both need clear flag position after sending, wait for data transmission next time.Main control module has jtag interface circuit, and user can be according to the service condition of oneself, and configuration CAN register, writes signal procedure, meets the CAN communications applications of oneself.