CN103984665A - Serial port communication device and method based on LabVIEW - Google Patents

Serial port communication device and method based on LabVIEW Download PDF

Info

Publication number
CN103984665A
CN103984665A CN201410246988.XA CN201410246988A CN103984665A CN 103984665 A CN103984665 A CN 103984665A CN 201410246988 A CN201410246988 A CN 201410246988A CN 103984665 A CN103984665 A CN 103984665A
Authority
CN
China
Prior art keywords
data
event
queue
frame
sent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410246988.XA
Other languages
Chinese (zh)
Other versions
CN103984665B (en
Inventor
薛红琳
王强
吴钊君
罗晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Harbin Institute of Technology Institute of artificial intelligence Co.,Ltd.
Original Assignee
Harbin Institute of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Harbin Institute of Technology filed Critical Harbin Institute of Technology
Priority to CN201410246988.XA priority Critical patent/CN103984665B/en
Publication of CN103984665A publication Critical patent/CN103984665A/en
Application granted granted Critical
Publication of CN103984665B publication Critical patent/CN103984665B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Communication Control (AREA)

Abstract

The invention provides a serial port communication device and method based on LabVIEW, and belongs to the technical field of serial port communication. The serial port communication device and method based on the LabVIEW aim to solve the problems that in existing serial port communication based on LabVIEW programming, data are lost, and the data frame analyzing process is cumbersome and wastes time. The device comprises a UI event generation module, a UI event processing module, a data sending and receiving module, a data analyzing module and a data display module. In the method, four layers of producer and consumer frameworks are formed and all modules are executed in parallel. In the data analyzing step, data received by a serial port are analyzed by means of a state machine analyzing method according to an analyzing frame protocol to obtain a complete analyzing data frame. Integrity of communication data transmission is guaranteed, programs are concise and clear, high in execution speed and stable in operation. The device and the method are used for serial port communication between an upper computer and a lower computer.

Description

Serial communication device and method based on LabVIEW
Technical field
The present invention relates to the serial communication device and method based on LabVIEW, belong to serial port communication technology field.
Background technology
Serial ports is a kind of very general devices communicating agreement on computing machine, it is the data transmission channel between conventional computing machine and external series equipment, be one of constituted mode of current virtual instrument by serial bus and PC computing machine composition virtual instrument system, there is interface feature simple, easy to use.
In virtual instrument field, the LabVIEW of NI company is more and more noticeable as a programming language that aims at thermometrically design, it has overcome, and traditional high-level language programs code such as VC, VB, C#, Java is tediously long, the shortcomings such as functions expanding are carried out in inconvenience, there is ease in use, graphic programming mode intuitively, the advantage such as its human-computer interaction interface close friend, data visualization fractional analysis, equipment control ability are strong, make, having great advantage aspect data acquisition and instrument control, to be more and more used to serial communication field.
But in the prior art, the serial communication based on LabVIEW programming there will be data receiver complete or be the lengthy and jumbled problems such as many consuming time of empty, resolution data frame program, this has a strong impact on the communication quality of data.
Summary of the invention
The present invention seeks to have loss of data and the lengthy and jumbled many problems consuming time of resolution data frame program in order to solve the existing serial communication based on LabVIEW programming, a kind of serial communication device and method based on LabVIEW is provided.
Serial communication device based on LabVIEW of the present invention, described communicator is realized and the communicating by letter of slave computer as host computer, and it comprises:
For the action of perception human-computer interaction interface control, generation event is also sent into the event of generation the UI event generation module of event message queue with character string forms as the producer;
For receive the character string of event message queue as consumer, and the corresponding event of character string representative is carried out to framing produce Frame, be re-used as the producer Frame of generation is sent into the UI event processing module of instruction queue;
For receive the Frame of instruction queue as consumer, this Frame serial ports is sent to slave computer; Receive the serial data that slave computer transmits simultaneously, and as the producer, the serial data of reception is sent into the data send and receive module of data receiver queue;
For receiving the data of data receiver queue and utilize parse state machine to resolve the data in data receiving queue as consumer, and the data that parsing obtained as the producer are sent into the data resolution module of parse for frame queue;
For receiving the data of parse for frame queue the data disaply moudle showing as the producer.
Described UI event generation module specifically comprises:
For the action of perception human-computer interaction interface control, generation event, and this event is changed to the application affairs structure function of identifying by value;
For using the action of each control as an event branch, the element that deposits event command corresponding each event branch in event message queue with the character string forms array function of joining the team.
Described UI event processing module specifically comprises:
For obtaining the element dequeue function of event message queue;
For event branch is corresponding with conditional branching, and require to carry out framing according to protocol frame, by becoming Frame to be sent after CRC16 verification, the element of sending into instruction queue after Frame to be sent and command string the are bundled array function of joining the team.
Described data send and receive module specifically comprises:
For carrying out the initial configuration of VISA string slogan parameter, baud rate parameter, data bit parameter, position of rest parameter, check bit parameter and stream range control parameter and forbidding respective attributes node to prevent the serial ports configuration module of described configuration change in the time of serial ports transceiving data;
For obtaining the Frame of instruction queue and the command string of binding by element dequeue function, command string is used for to construction of condition and judges branch, Frame is write to serial ports and is sent to the serial ports sending module of slave computer by VISA;
For reading the serial data of slave computer by VISA, and the slave computer data that read are sent into the serial ports receiver module of data receiver queue;
Close serial ports for closing function by VISA, the serial ports closing module of disabled attribute node when recovering initial configuration.
Described data resolution module specifically comprises:
Be used for the element dequeue function of the data of obtaining data receiver queue;
For the parse state machine that the data of data receiving queue are resolved;
Be converted to for parse state machine being resolved to the data that obtain the function of sending into parse for frame queue after character string with command string binding cluster;
Described data disaply moudle specifically comprises:
Be used for the element dequeue function of the data of obtaining parse for frame queue;
For the data of parse for frame queue are removed to binding, command character is series-connected to the branching selection device of construction of condition function, data character string is converted after byte arrays to the function showing.
Based on a serial port communication method of LabVIEW, described communication means is for realizing communicating by letter of host computer and slave computer, and it comprises:
For the action of perception human-computer interaction interface control, generation event the UI event of the event of generation being sent into event message queue with character string forms as the producer produce step;
For receive the character string of event message queue as consumer, and the corresponding event of character string representative is carried out to framing produce Frame, be re-used as the producer Frame of generation is sent into the UI event handling step of instruction queue;
For receive the Frame of instruction queue as consumer, this Frame serial ports is sent to slave computer; Receive the serial data that slave computer transmits simultaneously, and as the producer, the serial data of reception is sent into the data send and receive step of data receiver queue;
For receiving the data of data receiver queue and utilize parse state machine to resolve the data in data receiving queue as consumer, and the data that parsing obtained as the producer are sent into the Data Analysis step of parse for frame queue;
For receiving the data of parse for frame queue the data displaying showing as the producer.
Described UI event produces step and specifically comprises:
For passing through the action of application affairs structure function perception human-computer interaction interface control, generation event, and this event is changed to the step of identifying by value;
For joining the team array function using the action of each control as an event branch by element, event command corresponding to each event branch deposited in to the step of event message queue with character string forms.
Described UI event handling step specifically comprises:
For obtain the step of event message queue by element dequeue function;
For the array function of joining the team by element, event branch is corresponding with conditional branching, and require to carry out framing according to protocol frame, by becoming Frame to be sent after CRC16 verification, the step of instruction queue will be sent into after Frame to be sent and command string binding.
Described data send and receive step specifically comprises:
For carrying out the initial configuration of VISA string slogan parameter, baud rate parameter, data bit parameter, position of rest parameter, check bit parameter and stream range control parameter by serial ports configuration module and forbidding respective attributes node to prevent the step of described configuration change when the serial ports transceiving data;
For obtaining the Frame of instruction queue and the command string of binding by serial ports sending module by element dequeue function, command string is used for to construction of condition and judges branch, Frame is write to serial ports and is sent to the step of slave computer by VISA;
For reading the serial data of slave computer by the VISA of serial ports receiver module, and the slave computer data that read are sent into the step of data receiver queue;
Close serial ports for closing function by the VISA of serial ports closing module, the step of disabled attribute node when recovering initial configuration.
Described Data Analysis step specifically comprises:
For obtain the step of the data of data receiver queue by element dequeue function;
For the step of the data of data receiving queue being resolved by parse state machine;
Be converted to for parse state machine being resolved to the data that obtain by function the step of sending into parse for frame queue after character string with command string binding cluster;
Described data displaying specifically comprises:
For obtain the step of the data of parse for frame queue by element dequeue function;
For the data of parse for frame queue being removed to binding by function, command character is series-connected to the branching selection device of construction of condition function, data character string is converted after byte arrays to the step showing.
Advantage of the present invention: in device of the present invention or method, UI event generation module is communicated by letter by event message queue with UI event processing module, UI event processing module is communicated by letter by instruction queue with data send and receive module, data send and receive module is communicated by letter by data receiver queue with data resolution module, data resolution module is communicated by letter by parse for frame queue with data disaply moudle, four layers of producer consumer framework and each module executed in parallel are formed, the data that data resolution module or step are used the method for parse state machine to receive serial ports obtain complete resolution data frame according to parse for frame protocol analysis, ensure the integrality of communication data transmission, program simple and clear, execution speed is fast and stable.
The present invention utilizes producer consumer framework and state machine to realize serial ports and receives, sends and resolve demonstration, guarantees that data avoid having ensured that program is succinct when loss, moves consuming time short.Its uses on the one hand four layers of producer consumer framework between five functional modules, and program orderliness is clear and take full advantage of the advantage of LabVIEW executed in parallel, has improved operating rate; With parse state machine, data are resolved on the other hand, solved the reception data that often occur in program in the past complete or be the problems such as sky and the lengthy and jumbled length consuming time of program, greatly degree has been optimized serial communication program.
Brief description of the drawings
Fig. 1 is the Organization Chart of the serial communication based on LabVIEW of the present invention;
Fig. 2 is the mode that the stops schematic diagram of the program of the serial communication based on LabVIEW of the present invention;
Fig. 3 is the schematic diagram of data send and receive module.
Embodiment
Embodiment one: below in conjunction with Fig. 1 and Fig. 2, present embodiment is described, the serial communication device based on LabVIEW described in present embodiment, described communicator is realized and the communicating by letter of slave computer as host computer, and it comprises:
For the action of perception human-computer interaction interface control, generation event is also sent into the event of generation the UI event generation module 1 of event message queue with character string forms as the producer;
For receive the character string of event message queue as consumer, and the corresponding event of character string representative is carried out to framing produce Frame, be re-used as the producer Frame of generation is sent into the UI event processing module 2 of instruction queue;
For receive the Frame of instruction queue as consumer, this Frame serial ports is sent to slave computer; Receive the serial data that slave computer transmits simultaneously, and as the producer, the serial data of reception is sent into the data send and receive module 3 of data receiver queue;
For receiving the data of data receiver queue and utilize parse state machine to resolve the data in data receiving queue as consumer, and the data that parsing obtained as the producer are sent into the data resolution module 4 of parse for frame queue;
For the data disaply moudle 5 that receives the data of parse for frame queue and show as the producer.
Embodiment two: below in conjunction with Fig. 1 and Fig. 2, present embodiment is described, present embodiment is described further embodiment one, described UI event generation module 1 specifically comprises:
For the action of perception human-computer interaction interface control, generation event, and this event is changed to the application affairs structure function of identifying by value;
For using the action of each control as an event branch, the element that deposits event command corresponding each event branch in event message queue with the character string forms array function of joining the team.
In present embodiment, UI event generation module 1 application affairs structure function is identified by value change event the action of each control on human-computer interaction interface panel, the action of each control is as an event branch, array function deposits in event message queue that each branch produces corresponding event command and the element that carries by LabVIEW using character string forms is joined the team now UI event generation module 1 as the producer.
Embodiment three: below in conjunction with Fig. 1 and Fig. 2, present embodiment is described, present embodiment is described further embodiment one or two, described UI event processing module 2 specifically comprises:
For obtaining the element dequeue function of event message queue;
For event branch is corresponding with conditional branching, and require to carry out framing according to protocol frame, by becoming Frame to be sent after CRC16 verification, the element of sending into instruction queue after Frame to be sent and command string the are bundled array function of joining the team.
In present embodiment, UI event processing module 2 obtains the data of event message queue by the element dequeue function in LabVIEW, now UI event processing module 2 is as consumer, application conditions structure function is realized the corresponding independent conditional branching of each event, require to carry out framing according to event according to protocol frame, the Frame obtaining becomes Frame to be sent after by CRC16 verification, utilize and show that control shows with hexadecimal string frame to be sent at man-machine interface panel, the element simultaneously carrying by LabVIEW is joined the team array function bundlees Frame with command string after and is sent into instruction queue, now UI event processing module 2 is as the producer.
Embodiment four: below in conjunction with Fig. 1 to Fig. 3, present embodiment is described, present embodiment is described further embodiment three, described data send and receive module 3 specifically comprises:
For carrying out the initial configuration of VISA string slogan parameter, baud rate parameter, data bit parameter, position of rest parameter, check bit parameter and stream range control parameter and forbidding respective attributes node to prevent the serial ports configuration module of described configuration change in the time of serial ports transceiving data;
For obtaining the Frame of instruction queue and the command string of binding by element dequeue function, command string is used for to construction of condition and judges branch, Frame is write to serial ports and is sent to the serial ports sending module of slave computer by VISA;
For reading the serial data of slave computer by VISA, and the slave computer data that read are sent into the serial ports receiver module of data receiver queue;
Close serial ports for closing function by VISA, the serial ports closing module of disabled attribute node when recovering initial configuration.
Present embodiment comprises serial ports configuration module, serial ports sending module, serial ports receiver module and serial ports closing module, and serial ports configuration module carries out the initial configuration of VISA string slogan, baud rate, data bit, position of rest, these parameters of check bit sum flow process control and forbids that by the method for forbidding respective attributes node these configurations are changed in the time that serial ports is received and dispatched; Serial ports sending module obtains the data of instruction queue by the element dequeue function in LabVIEW, after now data send and receive module 3 bundlees data solution as consumer, command string judges branch for construction of condition, data character string is used for sending to slave computer, the serial ports function VISA carrying with LabVIEW carries out transceiving data, is write and is sent the data to slave computer by VISA; Serial ports receiver module is read slave computer data is read back in real time and are shown to man-machine interface panel and send into data receiver queue by VISA, and now data send and receive module 3 is as the producer; Close serial port module and close function by VISA and close serial ports, disabled each parameter attribute node while simultaneously recovering initialization.
Embodiment five: below in conjunction with Fig. 1 to Fig. 3, present embodiment is described, present embodiment is described further embodiment four, described data resolution module 4 specifically comprises:
Be used for the element dequeue function of the data of obtaining data receiver queue;
For the parse state machine that the data of data receiving queue are resolved;
Be converted to for parse state machine being resolved to the data that obtain the function of sending into parse for frame queue after character string with command string binding cluster;
Described data disaply moudle 5 specifically comprises:
Be used for the element dequeue function of the data of obtaining parse for frame queue;
For the data of parse for frame queue are removed to binding, command character is series-connected to the branching selection device of construction of condition function, data character string is converted after byte arrays to the function showing.
Described branching selection device is on construction of condition function.
In present embodiment, shown in Fig. 3, data resolution module 4 obtains by the element dequeue function in LabVIEW the data that serial ports reads back, resolve by protocol analysis state machine, now data resolution module 4 is as consumer, data resolution module 4 outermost layers are operations that while circulates to maintain state machine, inferior skin is a construction of condition, be used for judging whether overtime, lower one deck be for circulation so that the data in the data receiver queue that receives of data resolution module 4 enter one by one and loop parsing with the form of byte, construction of condition at for circulation internal layer, be used for each different state to judge, under each state, handling data can indicate next step to enter which state, the function of Here it is shift register, by next state transfer in the judgement of recurrent state next time, data resolution module 4 obtains the data of data receiver queue, by character string to byte arrays transfer function, data is converted to byte arrays, and then for that sends into of byte circulates one by one, and now data resolution module is as consumer, the data that serial ports reads back are through obtaining parse for frame after state machine, and parse for frame array is sent into parse for frame queue with command string binding cluster after being converted to character string, and now data resolution module 4 is as the producer.
Data disaply moudle 5 skins are operations that while circulates to ensure display module, internal layer is construction of condition, data disaply moudle 5 obtains the data in parse for frame queue by the element dequeue function in LabVIEW, after dequeuing data row, remove binding, command character is wherein series-connected to the branching selection device of construction of condition, data character string converts to after byte arrays for showing, now data disaply moudle 5 is as consumer.
The present invention is applied in Practical Project, realizes communicating by letter of slave computer and host computer, and then control motor operation by the operation of front panel in host computer:
Adopt the serial communication framework shown in Fig. 1, form four layers of producer consumer framework and each module executed in parallel, the action of UI event generation module 1 perception front panel control, generation event is also sent into event message queue by event with character string forms as the producer, character string relative each event that UI event processing module 2 receives in event message queue as consumer are carried out framing, this is ground floor producer consumer framework, UI event processing module 2 is re-used as the producer Frame of generation is sent into instruction queue, the data that data send and receive module 3 receives in instruction queue as consumer are carried out serial ports transmission and receive serial data, this is second layer producer consumer framework, data send and receive module 3 is re-used as the producer data that receive is sent into data receiver queue, data resolution module 4 receives the data in data receiver queue and resolves as consumer, this is the 3rd layer of producer consumer framework, data resolution module 4 is re-used as the data that the producer obtains parsing and sends in parse for frame queue, data disaply moudle 5 receives the data in parse for frame queue and shows as the producer, this is the 4th layer of producer consumer framework.
UI event generation module 1 skin is the operation that while circulates to maintain event generation module, in while circulation, adopt event structure function, on time structure block diagram, right button selects interpolation event branch that corresponding front panel control is joined to corresponding event branch, produce after the binding of corresponding event message and variant constant by the element array function of joining the team and send in event message queue, now UI event generation module 1 is as the producer.
As shown in Figure 2, the serial communication framework of LabVIEW has multithreading, so the mode of stopping adopts the mode of circulation expiry notification device, use " obtaining notifying device quotes " function outward in each circulation, use " sending notice " function to send notice that stop button is pressed to expiry notification device in " change of ' stopping ' value " branch of UI event generation module, the outermost layer while that this notice is delivered to each thread by expiry notification device circulates, " cycling condition " button notice assignment being circulated to while by " waiting wait order " function, finish the operation of whole program with this.
UI event processing module 2 outermost layers are operations that while circulates to ensure this module, data in reception event message queue are series-connected to command character the branching selection device of construction of condition after removing binding, now UI event processing module 2, as consumer, carries out framing according to protocol frame standard in corresponding conditional branching.Utilize array function by a frame byte arrays of composition to be sent and add CRC check, present case is used CRC16 verification, and core concept is the check bit that the .dll file that utilizes " call library function node " to call the CRC16 verification having generated generates 16bit.The Frame array that obtains after framing completes enters on the one hand and cycles through " numerical value to hexadecimal string is changed " function and enters next for circulation again, obtain for the hexadecimal transmission frame character string showing by " connection string " function, by showing that control shows at front panel; After changed string, send into instruction queue with command string binding on the other hand, now UI event processing module 2 is as the producer.
As shown in Figure 3, serial ports sending module and serial ports receiver module are in a while circulation, and while circulation ensures the continuity of transmitting-receiving.
Data resolution module 4 outermost layers circulate to maintain the operation of parse state machine with while, outside while circulation, state and data used are carried out to initialization, in while circulation, be successively respectively from outside to inside construction of condition and judge that whether element dequeue is overtime, for circulation makes the data that receive process one by one with byte form, the processing of data and the selection to NextState under construction of condition selection mode and each state, state and data stream are flowing into and outflow while circulation and for circulation time use shift register, after having ensured like this to handle data under each state, indicate next step to enter next designated state.In outer while circulation, data resolution module is reading out data character string from data receiver queue, after converting byte arrays to, send into one by one for circulation, now data resolution module 4 is as consumer, byte enters the branches of states that enters first acquiescence after for circulates, judge according to parse for frame agreement, first determine whether frame head, below determining in innermost layer construction of condition according to result, enter which state and select whether add this secondary data to parse for frame array, this state imports into by shift register in the state judgement of recurrent state alternative condition structure next time, state machine can freely be changed between each state like this, after finally obtaining being converted to character string and command string binding according to the resolution data frame number group of protocol frame requirement and by array, send into parse for frame queue, now data resolution module 4 is as the producer.
Data disaply moudle 5 is made up of the construction of condition of outer field while circulation and internal layer, plays respectively the effect that maintains display module operation and select displaying contents.Data disaply moudle 5 is separated bundling operation to data after obtaining the data in parse for frame queue, command string is sent into condition selector switch, data character string converts to and enters on the one hand after byte arrays and cycle through " numerical value to hexadecimal string is changed " function and enter next for again and cycle through " connection string " function and obtain for the hexadecimal parse for frame character string showing, and by showing that control shows at front panel, according to conditional branching content to display and parsing Frame Protocol, resolution data array is operated on the other hand, mainly utilize character string function " intercepting character string ", the LabVIEW such as dialog box function " button dialog box " carry out difference to require from tape function the integration of displaying contents, now data disaply moudle 5 is as consumer.
Embodiment six: below in conjunction with Fig. 1 and Fig. 2, present embodiment is described, the serial port communication method based on LabVIEW described in present embodiment, described communication means is for realizing communicating by letter of host computer and slave computer, and it comprises:
For the action of perception human-computer interaction interface control, generation event the UI event of the event of generation being sent into event message queue with character string forms as the producer produce step;
For receive the character string of event message queue as consumer, and the corresponding event of character string representative is carried out to framing produce Frame, be re-used as the producer Frame of generation is sent into the UI event handling step of instruction queue;
For receive the Frame of instruction queue as consumer, this Frame serial ports is sent to slave computer; Receive the serial data that slave computer transmits simultaneously, and as the producer, the serial data of reception is sent into the data send and receive step of data receiver queue;
For receiving the data of data receiver queue and utilize parse state machine to resolve the data in data receiving queue as consumer, and the data that parsing obtained as the producer are sent into the Data Analysis step of parse for frame queue;
For receiving the data of parse for frame queue the data displaying showing as the producer.
Embodiment seven: below in conjunction with Fig. 1 and Fig. 2, present embodiment is described, present embodiment is described further embodiment six, described UI event produces step and specifically comprises:
For passing through the action of application affairs structure function perception human-computer interaction interface control, generation event, and this event is changed to the step of identifying by value;
For joining the team array function using the action of each control as an event branch by element, event command corresponding to each event branch deposited in to the step of event message queue with character string forms.
Embodiment eight: below in conjunction with Fig. 1 and Fig. 2, present embodiment is described, present embodiment is described further embodiment six or seven, described UI event handling step specifically comprises:
For obtain the step of event message queue by element dequeue function;
For the array function of joining the team by element, event branch is corresponding with conditional branching, and require to carry out framing according to protocol frame, by becoming Frame to be sent after CRC16 verification, the step of instruction queue will be sent into after Frame to be sent and command string binding.
Embodiment nine: below in conjunction with Fig. 1 to Fig. 3, present embodiment is described, present embodiment is described further embodiment eight, described data send and receive step specifically comprises:
For carrying out the initial configuration of VISA string slogan parameter, baud rate parameter, data bit parameter, position of rest parameter, check bit parameter and stream range control parameter by serial ports configuration module and forbidding respective attributes node to prevent the step of described configuration change when the serial ports transceiving data;
For obtaining the Frame of instruction queue and the command string of binding by serial ports sending module by element dequeue function, command string is used for to construction of condition and judges branch, Frame is write to serial ports and is sent to the step of slave computer by VISA;
For reading the serial data of slave computer by the VISA of serial ports receiver module, and the slave computer data that read are sent into the step of data receiver queue;
Close serial ports for closing function by the VISA of serial ports closing module, the step of disabled attribute node when recovering initial configuration.
Embodiment ten: below in conjunction with Fig. 1, present embodiment is described, present embodiment is described further embodiment nine, described Data Analysis step specifically comprises:
For obtain the step of the data of data receiver queue by element dequeue function;
For the step of the data of data receiving queue being resolved by parse state machine;
Be converted to for parse state machine being resolved to the data that obtain by function the step of sending into parse for frame queue after character string with command string binding cluster;
Described data displaying specifically comprises:
For obtain the step of the data of parse for frame queue by element dequeue function;
For the data of parse for frame queue being removed to binding by function, command character is series-connected to the branching selection device of construction of condition function, data character string is converted after byte arrays to the step showing.
Serial port communication method based on LabVIEW is applied in Practical Project, realizes communicating by letter of slave computer and host computer, and then it is identical with the process in embodiment five to control the concrete grammar of motor operation by the operation of front panel in host computer.

Claims (10)

1. the serial communication device based on LabVIEW, described communicator is realized and the communicating by letter of slave computer as host computer, it is characterized in that, and it comprises:
For the action of perception human-computer interaction interface control, generation event is also sent into the event of generation the UI event generation module (1) of event message queue with character string forms as the producer;
For receive the character string of event message queue as consumer, and the corresponding event of character string representative is carried out to framing produce Frame, be re-used as the producer Frame of generation is sent into the UI event processing module (2) of instruction queue;
For receive the Frame of instruction queue as consumer, this Frame serial ports is sent to slave computer; Receive the serial data that slave computer transmits simultaneously, and as the producer, the serial data of reception is sent into the data send and receive module (3) of data receiver queue;
For receiving the data of data receiver queue and utilize parse state machine to resolve the data in data receiving queue as consumer, and the data that parsing obtained as the producer are sent into the data resolution module (4) of parse for frame queue;
For receiving the data of parse for frame queue the data disaply moudle showing (5) as the producer.
2. the serial communication device based on LabVIEW according to claim 1, is characterized in that, described UI event generation module (1) specifically comprises:
For the action of perception human-computer interaction interface control, generation event, and this event is changed to the application affairs structure function of identifying by value;
For using the action of each control as an event branch, the element that deposits event command corresponding each event branch in event message queue with the character string forms array function of joining the team.
3. the serial communication device based on LabVIEW according to claim 1 and 2, is characterized in that, described UI event processing module (2) specifically comprises:
For obtaining the element dequeue function of event message queue;
For event branch is corresponding with conditional branching, and require to carry out framing according to protocol frame, by becoming Frame to be sent after CRC16 verification, the element of sending into instruction queue after Frame to be sent and command string the are bundled array function of joining the team.
4. the serial communication device based on LabVIEW according to claim 3, is characterized in that, described data send and receive module (3) specifically comprises:
For carrying out the initial configuration of VISA string slogan parameter, baud rate parameter, data bit parameter, position of rest parameter, check bit parameter and stream range control parameter and forbidding respective attributes node to prevent the serial ports configuration module of described configuration change in the time of serial ports transceiving data;
For obtaining the Frame of instruction queue and the command string of binding by element dequeue function, command string is used for to construction of condition and judges branch, Frame is write to serial ports and is sent to the serial ports sending module of slave computer by VISA;
For reading the serial data of slave computer by VISA, and the slave computer data that read are sent into the serial ports receiver module of data receiver queue;
Close serial ports for closing function by VISA, the serial ports closing module of disabled attribute node when recovering initial configuration.
5. the serial communication device based on LabVIEW according to claim 4, is characterized in that, described data resolution module (4) specifically comprises:
Be used for the element dequeue function of the data of obtaining data receiver queue;
For the parse state machine that the data of data receiving queue are resolved;
Be converted to for parse state machine being resolved to the data that obtain the function of sending into parse for frame queue after character string with command string binding cluster;
Described data disaply moudle (5) specifically comprises:
Be used for the element dequeue function of the data of obtaining parse for frame queue;
For the data of parse for frame queue are removed to binding, command character is series-connected to the branching selection device of construction of condition function, data character string is converted after byte arrays to the function showing.
6. the serial port communication method based on LabVIEW, described communication means, for realizing communicating by letter of host computer and slave computer, is characterized in that, it comprises:
For the action of perception human-computer interaction interface control, generation event the UI event of the event of generation being sent into event message queue with character string forms as the producer produce step;
For receive the character string of event message queue as consumer, and the corresponding event of character string representative is carried out to framing produce Frame, be re-used as the producer Frame of generation is sent into the UI event handling step of instruction queue;
For receive the Frame of instruction queue as consumer, this Frame serial ports is sent to slave computer; Receive the serial data that slave computer transmits simultaneously, and as the producer, the serial data of reception is sent into the data send and receive step of data receiver queue;
For receiving the data of data receiver queue and utilize parse state machine to resolve the data in data receiving queue as consumer, and the data that parsing obtained as the producer are sent into the Data Analysis step of parse for frame queue;
For receiving the data of parse for frame queue the data displaying showing as the producer.
7. the serial port communication method based on LabVIEW according to claim 6, is characterized in that, described UI event produces step and specifically comprises:
For passing through the action of application affairs structure function perception human-computer interaction interface control, generation event, and this event is changed to the step of identifying by value;
For joining the team array function using the action of each control as an event branch by element, event command corresponding to each event branch deposited in to the step of event message queue with character string forms.
8. according to the serial port communication method based on LabVIEW described in claim 6 or 7, it is characterized in that, described UI event handling step specifically comprises:
For obtain the step of event message queue by element dequeue function;
For the array function of joining the team by element, event branch is corresponding with conditional branching, and require to carry out framing according to protocol frame, by becoming Frame to be sent after CRC16 verification, the step of instruction queue will be sent into after Frame to be sent and command string binding.
9. the serial port communication method based on LabVIEW according to claim 8, is characterized in that, described data send and receive step specifically comprises:
For carrying out the initial configuration of VISA string slogan parameter, baud rate parameter, data bit parameter, position of rest parameter, check bit parameter and stream range control parameter by serial ports configuration module and forbidding respective attributes node to prevent the step of described configuration change when the serial ports transceiving data;
For obtaining the Frame of instruction queue and the command string of binding by serial ports sending module by element dequeue function, command string is used for to construction of condition and judges branch, Frame is write to serial ports and is sent to the step of slave computer by VISA;
For reading the serial data of slave computer by the VISA of serial ports receiver module, and the slave computer data that read are sent into the step of data receiver queue;
Close serial ports for closing function by the VISA of serial ports closing module, the step of disabled attribute node when recovering initial configuration.
10. the serial port communication method based on LabVIEW according to claim 9, is characterized in that, described Data Analysis step specifically comprises:
For obtain the step of the data of data receiver queue by element dequeue function;
For the step of the data of data receiving queue being resolved by parse state machine;
Be converted to for parse state machine being resolved to the data that obtain by function the step of sending into parse for frame queue after character string with command string binding cluster;
Described data displaying specifically comprises:
For obtain the step of the data of parse for frame queue by element dequeue function;
For the data of parse for frame queue being removed to binding by function, command character is series-connected to the branching selection device of construction of condition function, data character string is converted after byte arrays to the step showing.
CN201410246988.XA 2014-06-05 2014-06-05 Serial communication device and method based on LabVIEW Active CN103984665B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410246988.XA CN103984665B (en) 2014-06-05 2014-06-05 Serial communication device and method based on LabVIEW

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410246988.XA CN103984665B (en) 2014-06-05 2014-06-05 Serial communication device and method based on LabVIEW

Publications (2)

Publication Number Publication Date
CN103984665A true CN103984665A (en) 2014-08-13
CN103984665B CN103984665B (en) 2017-06-20

Family

ID=51276648

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410246988.XA Active CN103984665B (en) 2014-06-05 2014-06-05 Serial communication device and method based on LabVIEW

Country Status (1)

Country Link
CN (1) CN103984665B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107229591A (en) * 2017-06-22 2017-10-03 湖南省力宇燃气动力有限公司 Multi-serial communication method and device
CN107302531A (en) * 2017-06-19 2017-10-27 青岛华潞佳电子科技有限公司 A kind of serial port command analytic method based on state machine and circle queue
CN104461879B (en) * 2014-11-28 2018-02-16 北京经纬恒润科技有限公司 A kind of automatic test approach and device
CN108989351A (en) * 2018-09-01 2018-12-11 西安科技大学 A kind of data communications method and its method and system for double redundancy motor observing and controlling
CN111078420A (en) * 2019-10-14 2020-04-28 惠州市德赛西威汽车电子股份有限公司 LabVIEW-based method for calling structure function in dynamic link library
CN112433714A (en) * 2020-12-03 2021-03-02 宁波拓普集团股份有限公司 Software system architecture based on LabVIEW real-time system
CN113407214A (en) * 2021-06-24 2021-09-17 广东泰坦智能动力有限公司 Reconfigurable multithreading parallel upper computer system based on can communication
CN114994529A (en) * 2022-05-23 2022-09-02 淮阴工学院 LabVIEW-based motor measurement and control system and monitoring interface design method
CN115344396A (en) * 2022-10-19 2022-11-15 势加透博(成都)科技有限公司 Synchronous control method and device between panels based on LabVIEW
CN116165352A (en) * 2023-04-23 2023-05-26 河北华清环境科技集团股份有限公司 Quality control system of flue gas on-line monitor

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1688970A (en) * 2003-05-16 2005-10-26 微软公司 User interface automation framework classes and interfaces
WO2005124316A2 (en) * 2004-06-09 2005-12-29 Cognex Technology And Investment Corporation Method and apparatus for configuring and testing a machine vision detector
CN101646083A (en) * 2009-06-18 2010-02-10 杭州高特信息技术有限公司 High-efficiency AVS video code stream analyzing system and method thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1688970A (en) * 2003-05-16 2005-10-26 微软公司 User interface automation framework classes and interfaces
WO2005124316A2 (en) * 2004-06-09 2005-12-29 Cognex Technology And Investment Corporation Method and apparatus for configuring and testing a machine vision detector
CN101646083A (en) * 2009-06-18 2010-02-10 杭州高特信息技术有限公司 High-efficiency AVS video code stream analyzing system and method thereof

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461879B (en) * 2014-11-28 2018-02-16 北京经纬恒润科技有限公司 A kind of automatic test approach and device
CN107302531A (en) * 2017-06-19 2017-10-27 青岛华潞佳电子科技有限公司 A kind of serial port command analytic method based on state machine and circle queue
CN107229591B (en) * 2017-06-22 2020-08-18 湖南省力宇燃气动力有限公司 Multi-serial port communication method and device
CN107229591A (en) * 2017-06-22 2017-10-03 湖南省力宇燃气动力有限公司 Multi-serial communication method and device
CN108989351B (en) * 2018-09-01 2021-04-16 西安科技大学 Data communication method and system for dual-redundancy motor measurement and control
CN108989351A (en) * 2018-09-01 2018-12-11 西安科技大学 A kind of data communications method and its method and system for double redundancy motor observing and controlling
CN111078420A (en) * 2019-10-14 2020-04-28 惠州市德赛西威汽车电子股份有限公司 LabVIEW-based method for calling structure function in dynamic link library
CN112433714A (en) * 2020-12-03 2021-03-02 宁波拓普集团股份有限公司 Software system architecture based on LabVIEW real-time system
CN113407214A (en) * 2021-06-24 2021-09-17 广东泰坦智能动力有限公司 Reconfigurable multithreading parallel upper computer system based on can communication
CN113407214B (en) * 2021-06-24 2023-04-07 广东泰坦智能动力有限公司 Reconfigurable multithreading parallel upper computer system based on can communication
CN114994529A (en) * 2022-05-23 2022-09-02 淮阴工学院 LabVIEW-based motor measurement and control system and monitoring interface design method
CN115344396A (en) * 2022-10-19 2022-11-15 势加透博(成都)科技有限公司 Synchronous control method and device between panels based on LabVIEW
CN115344396B (en) * 2022-10-19 2023-02-28 势加透博(成都)科技有限公司 Synchronous control method and device between panels based on LabVIEW
CN116165352A (en) * 2023-04-23 2023-05-26 河北华清环境科技集团股份有限公司 Quality control system of flue gas on-line monitor

Also Published As

Publication number Publication date
CN103984665B (en) 2017-06-20

Similar Documents

Publication Publication Date Title
CN103984665A (en) Serial port communication device and method based on LabVIEW
CN104899150B (en) Automated testing method and system and automation platform based on object-oriented
CN102967815B (en) Chip testing method, automated testing equipment and system
CN107203473A (en) The automatization test system and method for automatic expansion interface test case
CN102665094A (en) Test method of set-top box and test system thereof
CN102622234A (en) Development system and method for automatic test case
CN109697266A (en) Page rendering system, page rendering method and page rendering device
CN103957198B (en) A kind of sensing data receives conversion method and system
CN104408002B (en) Serial ports master-slave communication control system and method
CN103955419A (en) Logic analyzer with serial bus protocol on-line real-time detection analysis function
CN110190887A (en) Earth station, Unmanned Aerial Vehicle Data Transmission system and method and storage medium
CN105450475A (en) FC switch test device
CN109639737A (en) Agreement generating device, the method for converting protocol of data collection station and configuration method
CN103378994A (en) Method and terminal for testing communication equipment
CN102799510B (en) PLC simulator based on reconfigurable components
CN106293757A (en) Robotic system software's framework and its implementation and device
CN102291274A (en) System and method for realizing automatic adaptation of network testing instrument
WO2015022413A1 (en) Improved state space analysis using partial descriptions
CN106896956B (en) The implementation method of multi-point touch under one kind " road " system
CN104063216A (en) High-speed data processing display method based on Labview
CN103544108A (en) System and method for testing embedded software integration strength
CN103684691B (en) Communication method capable of simultaneously supporting 8G speed and 16G speed of FC protocol
CN109614094A (en) A kind of GPU glCallList view model based on UML
CN113341215B (en) Double-core intelligent ammeter
CN109800368A (en) H5 navigation bar push button configuration method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB03 Change of inventor or designer information

Inventor after: Wang Qiang

Inventor after: The king is to give Han

Inventor after: Xue Honglin

Inventor after: Wu Zhaojun

Inventor before: Xue Honglin

Inventor before: Wang Qiang

Inventor before: Wu Zhaojun

Inventor before: Luo Jing

COR Change of bibliographic data
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20210407

Address after: Room 206-10, building 16, 1616 Chuangxin Road, Songbei District, Harbin City, Heilongjiang Province

Patentee after: Harbin jizuo technology partnership (L.P.)

Patentee after: Harbin Institute of Technology Asset Management Co.,Ltd.

Address before: 150001 No. 92 West straight street, Nangang District, Heilongjiang, Harbin

Patentee before: HARBIN INSTITUTE OF TECHNOLOGY

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210618

Address after: Room 206-12, building 16, 1616 Chuangxin Road, Songbei District, Harbin City, Heilongjiang Province

Patentee after: Harbin Institute of Technology Institute of artificial intelligence Co.,Ltd.

Address before: Room 206-10, building 16, 1616 Chuangxin Road, Songbei District, Harbin City, Heilongjiang Province

Patentee before: Harbin jizuo technology partnership (L.P.)

Patentee before: Harbin Institute of Technology Asset Management Co.,Ltd.

TR01 Transfer of patent right