[summary of the invention]
Based on this, be necessary to provide a kind of control method that can avoid the Biochemical Analyzer that frame segmentation errors occurs.
In addition, be also necessary to provide a kind of control system that can avoid the Biochemical Analyzer that frame segmentation errors occurs.
A control method for Biochemical Analyzer, comprises the steps:
The steering order data of Biochemical Analyzer are encoded and obtained valid data;
Add frame head character and postamble character forms communications data frame to described valid data, and send, described frame head character and postamble character all with valid data in the not repetition mutually of arbitrary character;
Receive described communications data frame, and described communications data frame is carried out to the controlled director data of decoding;
In described Biochemical Analyzer, carry out the steering order data that described decoding obtains.
Preferably, the described steering order data to the Biochemical Analyzer step that obtains valid data of encoding is:
Described steering order data are carried out to sequential encoding, are the character string of default byte length by each steering order data transformation;
The character of changing one by one in the character string that described conversion obtains according to the scale of setting obtains valid data.
Preferably, described carry is made as sexadecimal.
Preferably, described frame head character and postamble character are alphabetical corresponding scale numerical value in ASCII coding.
Preferably, described steering order data comprise speed parameter, and the described step of carrying out the steering order data that described decoding obtains in described Biochemical Analyzer comprises:
According to the motor of Biochemical Analyzer described in described speed parameter control.
A control system for Biochemical Analyzer, comprising:
Coding module, encodes and obtains valid data for the steering order data to Biochemical Analyzer;
Frame processing module, for adding frame head character to described valid data and postamble character forms communications data frame, and sends, described frame head character and postamble character all with valid data in the not repetition mutually of arbitrary character;
Decoding module, for receiving described communications data frame, and carries out the controlled director data of decoding to described communications data frame;
Execution module, for carrying out the steering order data that described decoding obtains at described Biochemical Analyzer.
Preferably, described coding module comprises:
Converter unit, for described steering order data are carried out to sequential encoding, is the character string of default byte length by each steering order data transformation;
Converting unit, obtains valid data for the character of changing one by one the character string that described conversion obtains according to the scale of setting.
Preferably, described carry is made as sexadecimal.
Preferably, described frame head character and postamble character are alphabetical corresponding scale numerical value in ASCII coding.
Preferably, described steering order data comprise speed parameter, and described execution module is also for according to the motor of Biochemical Analyzer described in described speed parameter control.
In the control method and system of above-mentioned Biochemical Analyzer, the steering order data of Biochemical Analyzer are encoded and obtained valid data, and all the frame head character of repetition and postamble character are not combined and are formed communications data frame with valid data mutually by arbitrary character in valid data, avoid the generation of frame segmentation errors, improved the accuracy that valid data extract.
[embodiment]
Fig. 1 shows the method flow of the control of an embodiment mesophytization analyser, comprises the steps:
Step S110, encodes and obtains valid data the steering order data of Biochemical Analyzer.
In the present embodiment, the steering order data of Biochemical Analyzer have comprised Electric Machine Control instruction, data acquisition instruction, thermostatic control instruction, liquid road steering order, light source control instruction etc., carry out corresponding action by steering order data Biochemical Analyzer.According to the coded system of setting, the steering order of Biochemical Analyzer is encoded to obtain valid data, these valid data are for the instruction transmission of Biochemical Analyzer.
In one embodiment, as shown in Figure 2, the detailed process of above-mentioned steps S110 is:
Step S111, carries out sequential encoding to steering order data, is the character string of default byte length by each steering order data transformation.
In the present embodiment, in steering order data, carry out sequential encoding according to certain coded system, each steering order data is converted, make each obtained character string meet the byte length of setting, and corresponding steering order data.In a preferred embodiment, steering order data are decimal system numerical value, default byte length is 3 bytes, according to ASCII (American Standard Code for Information Interchange, ASCII(American Standard Code for information interchange)) numeral in code table converts each steering order data, for example,, if a certain steering order data are " 1 ", according to the character string " 001 " of 3 bytes of the numeral in ASCII character table " 1 " conversion; If a certain steering order data are " 156 ", the character string that conversion obtains is " 156 ", and now, the character string that conversion obtains is numeral.
Step S113, the character of changing one by one in the character string that this conversion obtains according to the scale of setting obtains valid data.
In the present embodiment, convert the character string obtaining for the coded system by certain, according to the scale of setting, character string is changed one by one, this scale can be septenary, scale-of-eight, the duodecimal number system and sexadecimal etc., in a preferred embodiment, system position is sexadecimal, according to sexadecimal, the character conversion in character string is become to sexadecimal numerical value.For example, if character string is " 001 ", corresponding three character conversion are " 0x30,0x30,0x31 "; If character string be " 156 " corresponding three character conversion be " 0x31,0x35,0x36 ", the character string obtaining due to conversion is numeral, and the numerical value being converted to according to sexadecimal is all with 0x3 beginning, becomes 0x30,0x31,0x32, the form of 0x33....
Because data in actual transmitting procedure are transmitted with binary form, and conversion between sexadecimal and scale-of-two is comparatively easy, and the conversion that adopts sexadecimal to carry out character string can improve transfer efficiency.
Step S130, adds frame head character and postamble character to valid data and forms communications data frame, and send, this frame head character and postamble character all with valid data in the not repetition mutually of arbitrary character.
In the present embodiment, in transmitting procedure, be to carry out with the form of Frame, therefore, in valid data, add frame head character and postamble character, the frame head character adding and postamble character have adopted identical scale with valid data, and be alphabetical corresponding scale numerical value in ASCII coding, to avoid following valid data to obscure.For example, if valid data are sexadecimal numerical value, frame head character and postamble character are sexadecimal numerical value corresponding to certain letter in ASCII character table, wherein, frame head character can be 0xfa, postamble character can be 0xfb, distinguishes with the valid data of 0x3 beginning, has avoided the generation of segmentation errors in communications data frame.
Step S150, received communication Frame, and communications data frame is carried out to the controlled director data of decoding.
In the present embodiment, the communications data frame receiving is carried out to decoding and reduce controlled director data, according to the cataloged procedure of steering order data, first communications data frame is cut apart and removed frame head character and postamble character, and the communications data frame after cutting apart is converted to character string, and then convert character string to steering order data corresponding scale numerical value.For example, if the communications data frame receiving is sexadecimal numerical value, steering order data are decimal system numerical value, in ASCII character table, arbitrary sexadecimal numerical value is corresponding with character, the process of communications data frame being carried out to decoding is: the sexadecimal numerical value in communications data frame, according to the form of ASCII character table changed string, and then is transformed to steering order data by character string, and decode procedure is the inverse process of cataloged procedure.
Forming after communications data frame, sending it to the command reception thread of Biochemical Analyzer.Command reception thread enters the controlled director data of decoding to communications data frame after receiving communications data frame, and communicates with the instruction execution thread of mail box fashion and Biochemical Analyzer, and the steering order that decoding is obtained sends instruction execution thread to.
Step S170 carries out the steering order data that decoding obtains in Biochemical Analyzer.
In the present embodiment, in Biochemical Analyzer, each steering order data is all corresponding one perform an action, the instruction execution thread of Biochemical Analyzer moves according to steering order after receiving steering order data.Particularly, these steering order data comprise speed parameter, and the above-mentioned step of carrying out the steering order data that decoding obtains in Biochemical Analyzer comprises: according to the motor of speed parameter control Biochemical Analyzer.This speed parameter obtains in actual debug process, for controlling acceleration and the moderating process of motor, make to rotate starting in electric machine rotation process and accelerate and stop linear the rising and linear decline of process implementation of slowing down, and then reduce and process expending in a large number of resource.
The control system that Fig. 3 shows an embodiment mesophytization analyser comprises coding module 10, Frame processing module 30, decoding module 50 and execution module 70.
Coding module 10, encodes and obtains valid data for the steering order data to Biochemical Analyzer.
In the present embodiment, the steering order data of Biochemical Analyzer have comprised Electric Machine Control instruction, data acquisition instruction, thermostatic control instruction, liquid road steering order, light source control instruction etc., carry out corresponding action by steering order data Biochemical Analyzer.Coding module 10 encodes to obtain valid data according to the coded system of setting to the steering order of Biochemical Analyzer, and these valid data are for the instruction transmission of Biochemical Analyzer.
In one embodiment, as shown in Figure 4, above-mentioned coding module 10 comprises converter unit 110 and converting unit 130.
Converter unit 110, for steering order data are carried out to sequential encoding, is the character string of default byte length by each steering order data transformation.
In the present embodiment, converter unit 110, to carrying out sequential encoding according to certain coded system in steering order data, converts each steering order, makes each obtained character string meet the byte length of setting, and corresponding steering order data.In a preferred embodiment, steering order data are decimal system numerical value, default byte length is 3 bytes, converter unit 110 converts each steering order data according to the numeral in ASCII character table, for example, if a certain steering order data are " 1 ", converter unit 110 is according to the character string " 001 " of 3 bytes of the numeral in ASCII character table " 1 " conversion; If a certain steering order data are " 156 ", converter unit 110 converts the character string that obtains for " 156 ", and now, the character string that conversion obtains is numeral.
Converting unit 130, obtains valid data for the character of changing one by one the character string that this conversion obtains according to the scale of setting.
In the present embodiment, convert the character string obtaining for the coded system by certain, converting unit 130 is changed character string one by one according to the scale of setting, this scale can be septenary, scale-of-eight, the duodecimal number system and sexadecimal etc., in a preferred embodiment, system position is sexadecimal, according to sexadecimal, the character conversion in character string is become to sexadecimal numerical value.For example, if character string is " 001 ", corresponding three character conversion are " 0x30,0x30,0x31 "; If character string be " 156 " corresponding three character conversion be " 0x31,0x35,0x36 ", the character string obtaining due to conversion is numeral, and the numerical value being converted to according to sexadecimal is all with 0x3 beginning, becomes 0x30,0x31,0x32, the form of 0x33....
Because data in actual transmitting procedure are transmitted with binary form, and conversion between sexadecimal and scale-of-two is comparatively easy, and the conversion that adopts sexadecimal to carry out character string can improve transfer efficiency.
Frame processing module 30, forms communications data frame for adding frame head character and postamble character to valid data, and sends, this frame head character and postamble character all with valid data in the not repetition mutually of arbitrary character.
In the present embodiment, in transmitting procedure, be to carry out with the form of Frame, therefore, Frame processing module 30 is added frame head character and postamble character in valid data, the frame head character adding and postamble character have adopted identical scale with valid data, and be alphabetical corresponding scale numerical value in ASCII coding, to avoid following valid data to obscure.For example, if valid data are sexadecimal numerical value, frame head character and postamble character are sexadecimal numerical value corresponding to certain letter in ASCII character table, wherein, frame head character can be 0xfa, postamble character can be 0xfb, distinguishes with the valid data of 0x3 beginning, has avoided the generation of segmentation errors in communications data frame.
Decoding module 50, for received communication Frame, and carries out the controlled director data of decoding to communications data frame.
In the present embodiment, decoding module 50 carries out decoding to the communications data frame receiving and reduces controlled director data, according to the cataloged procedure of steering order data, first decoding module 50 is cut apart and is removed frame head character and postamble character communications data frame, and the communications data frame after cutting apart is converted to character string, and then convert character string to steering order data corresponding scale numerical value.For example, if the communications data frame receiving is sexadecimal numerical value, steering order data are decimal system numerical value, in ASCII character table, arbitrary sexadecimal numerical value is corresponding with character, decoding module 50, by the sexadecimal numeral system numerical value in communications data frame according to the form of ASCII character table changed string, and then is transformed to steering order data by character string, and decode procedure is the inverse process of cataloged procedure.
Forming after communications data frame, decoding module 50 sends it to the command reception thread of Biochemical Analyzer.Command reception thread enters the controlled director data of decoding to communications data frame after receiving communications data frame, and communicates with the instruction execution thread of mail box fashion and Biochemical Analyzer, and the steering order that decoding is obtained sends instruction execution thread to.
Execution module 70, for carrying out the controlled director data of decoding at Biochemical Analyzer.
In the present embodiment, in Biochemical Analyzer, each steering order data is all corresponding one perform an action, the instruction execution thread in execution module 70 moves according to steering order after receiving steering order data.Particularly, these steering order data comprise speed parameter, and execution module 70 is according to the motor of speed parameter control Biochemical Analyzer.This speed parameter obtains in actual debug process, for controlling acceleration and the moderating process of motor, make to rotate starting in electric machine rotation process and accelerate and stop linear the rising and linear decline of process implementation of slowing down, and then reduce and process expending in a large number of resource.
In the control method and system of above-mentioned Biochemical Analyzer, multiple Arm chips can be set and carry out work as processor simultaneously, between these multiple processors, connect each other, and by relatively independent the program separately of carrying out.In a preferred embodiment, the quantity of processor is 6, is divided into two classes, and a class is used for receiving steering order data, and gives another kind of processor by the steering order Data dissemination receiving, and is one for receiving the processor quantity of steering order data.
In each processor, be also multithreading operation, specifically can be divided into command reception decoding thread, instruction operation thread, instruction operation monitoring thread and data transmission line journey.Command reception decoding thread is receiving after correct instruction, send to instruction operation thread with mail box fashion, instruction operation thread performs an action according to instruction control Biochemical Analyzer, the thread of instruction operation monitoring is simultaneously also in the running status that detects Biochemical Analyzer, and after Biochemical Analyzer is finished, transmit running status, run succeeded or failure with user's Biochemical Analyzer of accusing.
In the control method and system of above-mentioned Biochemical Analyzer, the steering order data of Biochemical Analyzer are encoded and obtained valid data, and all the frame head character of repetition and postamble character are not combined and are formed communications data frame with valid data mutually by arbitrary character in valid data, avoid the generation of frame segmentation errors, improved the accuracy that valid data extract.
The above embodiment has only expressed several embodiment of the present invention, and it describes comparatively concrete and detailed, but can not therefore be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.