How to connect LED display screen with computer
Time:2018-11-28
Views:177
LED screen has obviously become the leader of display devices. Whether outdoors or indoors, LED screen has occupied a large market. Maintenance personnel need to have a more comprehensive knowledge of LED screen maintenance.
1. Major functional requirements analysis and model construction
For direct network connection, the PC and the display screen are connected by direct network connection, and then their IP addresses are manually set in the same network segment for communication.
But in this way, if you don‘t know the IP address of the LED screen in advance, it will be difficult to communicate.Don‘t know to achieve display IP address can also realize the PC and display, the purpose of direct communication is solved with the aid of a DHCP service principle: setting the LED display as a DHCP server for a fixed IP address, set the PC card to obtain IP address automatically, through the DHCP service functions, automatic configuration of PC LAN IP address, it established a network connection channel.Some developers use this method to achieve direct network connection, but this method has some problems: first, because UDP communication is not connected communication, its communication reliability is poor, easy to fail;Second, it can only be done through the operating system‘s own system, without intervention, users can not set the timeout, sometimes the waiting time is too long, the maximum is 60 seconds;Third, DHCP is a fixed IP mode, which is obviously not good in practical application.Fourth, when exiting the system, the original network card configuration information of PC cannot be restored.
Based on this, through research, this paper proposes a new method of directly connected network, can realize the network direct PC machine, automatic acquisition IP address and network adapter configuration information save and restore functions, overcome the shortcomings of the current implementation method to improve the reliability, stability and timeliness and so on various aspects of performance, the system model as shown in figure 2, the main function and work flow is as follows:
(1) when starting the system, retrieve and access all network CARDS of the PC, and save their network card configuration information for recovery when exiting the system;(2) start the direct network connection process;(3) broadcast IP address request packet;(4) return IP address packet;(5) unpack, obtain the IP address of PC and LED display, and set the IP address of PC;(6) return the IP address of LED display screen, close direct network connection, and complete the establishment of communication channel;(7) after establishing the communication channel between PC and LED display, the display can be read/written parameters, send programs, switch screen and other communication control operations;(8) when exiting the system, restore the original state of PC network card according to the network card configuration information saved in (1).
In the above process, (2) ~ (6) is the core process. It simulates DHCP service, realizes the IP address broadcast request of PC, obtains and sets the IP address of PC, uploadsled display IP address, and completes the establishment of network direct connection channel.(1) and (8) are operations to save PC network card configuration information and restore network card configuration information when starting and exiting the system;(7) it is the general operation controlled by the display screen after completing the direct network connection channel;
2. Design and implementation of key functions
2.1 save PC network card configuration information
PC used for debugging LED display screen, is generally a multi-purpose machine, debugging the display screen at the same time, also used for office, the Internet, the network card IP address may be fixed or automatic access.When doing network direct connection, its IP address may be changed, in order not to affect the user‘s work, exit the need to automatically restore its IP address.And to do this, but when start the LED control software, read the current network configuration information, such as IP address, network card name, MAC address, card type, whether it is automatically configured IP address, and so on, to save this information in a linked list, and set a mark at the same time, record the user in the process of debugging screen, whether to use the network direct operation, to withdraw from the system.
In Windows operating system, the IP Helper interface can be used to read network card information. It is a set of API for managing local network Settings. By using the IP_ADAPteR_INFO structure, the above network card configuration information can be conveniently extracted and saved into the linked list.
2.2 refer to DHCP service principle to build network direct connection channel
In order to achieve direct communication between PC and LED display network, two key problems must be solved: first, PC and LED display screen should be in the same network segment;Second, know the IP address of LED display screen.
In addition, the interference of multi-network card and wireless network card on direct network connection should be solved.Drawing lessons from DHCP principle, the main solutions are as follows:
(1) design a network direct connection control process on the PC side;(2) when direct network connection is needed, start the process. Determine the non-wireless network card connected to the LED screen through Windows related network API functions and registry information, put its MAC address into the UDP packet building the request IP address, and then broadcast it out. Meanwhile, start the internal UDP packet capturing sub-process;(3) after the LED screen receives the UDP package with the requested IP address, it constructs the IP address of a PC according to its IP address and broadcasts it out. In order not to cause confusion, the pseudo-dhcp package is constructed here. When normal Windows clients receive the UDP package, they will not automatically change its IP address.(4) the UDP packet of the direct network connection control process captures the UDP packet of the assigned IP address received by the sub-process, and unpacks the IP address of the PC and the IP address of the LED display screen;(5) set the IP address of PC network card, upload the IP address of LED display screen to the control software, and close the direct network connection control process after success to complete the establishment of direct network connection channel.
This network connected directly involved in the process of the three systems: (1) the network direct control process, it build request IP address and UDP packets to broadcast, monitoring targets at the same time the network card in the port 68, capture the return of UDP packets, resolve the IP address of the PC and the IP address of the LED display, and then set the IP address of the PC, the LED display the IP address of the submitted to the main process, complete network direct task;(2)LED screen DHCP service sub-process, which receives IP address request of PC, builds and sets its own IP address, and returns pseudo-dhcp package of IP address of PC;(3)LED control software. When the user selects the direct network connection mode, the direct network connection control sub-process is started to realize the establishment of direct network channel. After completion, the process is closed.
2.3 restore the configuration information of PC network card
When exiting the system, judge whether the network direct connection is used according to the identity saved in 2.1. If the network direct connection is not used, the network IP recovery function is not required.Otherwise, the recovery function will be performed to restore the saved network card configuration in 2.1. The netsh interface IP set command can be used to restore the IP address of the network card.At the same time, in order to speed up the processing speed and improve the success rate, the steps of disabling the network card, setting the IP address of the network card and enabling the network card can be followed:
(1) disable the target network card by using the SetupAPI related interface API function of Windows;
(2) restore the IP setting of the target network card, and use different commands according to the static IP address and the dynamic IP address:
A. Restore the static IP address command.
Netsh interface IP set address name= "local connection"
Source = STatic addr = 192.168.1.19 mask = 255.
255.255.0 gateway = nONe
B. Restore dynamic IP address command.
Netsh interface IP set address DHCP
(3) use SetupAPI related interface API function to enable the target network card, so as to complete the recovery of network card configuration information.
The above are various ways of connecting LED screen with computer. I hope you can help the maintenance personnel of LED screen.
分享