Summary of the invention
The objective of the invention is to propose a kind of method of the monitoring CAN communication based on LabView,, increase the reliability of CAN communication system effectively need not to add under the situation of ancillary equipment.
The method of the monitoring CAN communication based on LabView of the present invention is following: LabView software reads the CAN communication data; And the timestamp of the frame data that read is stored in the register; The timestamp of the more double frame data that read then; When the difference DELTA t of the timestamp of two frame data exceeds preset range, represent that then the CAN communication breaks down; When the difference DELTA t of the timestamp of two frame data is in preset range, represent that then the CAN communication is normal.
Observe and verification for convenient, LabView software is stored in the CAN communication data that is read in the array that is provided with in advance, and shows in real time.
Specifically, read and judge that the method for CAN communication data has following two kinds:
1, the said double frame data that read are continuous frame data, when the difference DELTA t of the timestamp of said two frame data is zero, represent that then the CAN communication breaks down; When the difference DELTA t of the timestamp of said two frame data greater than zero the time, represent that then the CAN communication is normal.
This kind reads and judges that the method for CAN communication data specifically comprises the steps:
A:LabView software reads the CAN communication data by frame, and the timestamp of two continuous frames data is stored in respectively in first register and second register;
B: the timestamp of relatively being stored in first register and second register, when the difference DELTA t of the timestamp in two registers is zero, represent that then the CAN communication breaks down, LabView software is reported to the police; When Δ t greater than zero the time, represent that then the CAN communication is normal;
C:, the timestamp in second register is shifted store in first register then with the first register zero clearing;
D: read the next frame data, and the timestamp of these frame data is stored in second register;
E: repeated execution of steps B, C, D are up to stopping monitoring.
In the said A step, LabView software is stored in the CAN communication data that is read in the array that is provided with in advance, and shows in real time.
2, the said double frame data that read are to be blanking time two frame data of scheduled time T, as the difference DELTA t of the timestamp of said two frame data during less than T1 or greater than T2, represent that then the CAN communication breaks down; When the difference DELTA t of the timestamp of said two frame data more than or equal to T1 and when being less than or equal to T2, represent that then the CAN communication is normal; Said T1=T-T0, T2=T+T0, said T0 are predefined redundancy time value.
This kind reads and judges that the method for CAN communication data specifically comprises the steps:
A:LabView software is every to read the CAN communication data one time at a distance from scheduled time T, and the timestamp of the double frame data that read is stored in respectively in first register and second register;
B: the timestamp of relatively being stored in first register and second register, as the difference DELTA t of the timestamp in two registers during, represent that then the CAN communication breaks down less than T1 or greater than T2, LabView software is reported to the police; When Δ t more than or equal to T1 and when being less than or equal to T2, represent that then the CAN communication is normal;
C:, then the timestamp in second register is stored in first register with the first register zero clearing;
D: read the CAN communication data once more, and the timestamp of these frame data is stored in second register;
E: repeated execution of steps B, C, D are up to stopping monitoring.
In the said A step, LabView software is stored in the CAN communication data that is read in the array that is provided with in advance, and shows in real time.
Above-mentioned second method can realize the monitoring to the stability in CAN cycle.
The method of the monitoring CAN communication based on LabView of the present invention need not to add ancillary equipment, under the prerequisite that does not increase cost, can monitor effectively the CAN communication, thereby increase the reliability of CAN communication system.
Embodiment
Below through to the description of embodiment, the effect of mutual alignment between the shape of specific embodiments of the invention such as related each member, structure, the each several part and annexation, each several part and operation principle etc. are done further to specify.
Embodiment 1:
The method based on the monitoring CAN communication of LabView of present embodiment comprises the steps:
A:LabView software reads the CAN communication data by frame, the CAN communication data that is read is stored in the array that is provided with in advance, and shows that in real time the timestamp with the two continuous frames data is stored in respectively in first register and second register simultaneously;
B: the timestamp of relatively being stored in first register and second register, when the difference DELTA t of the timestamp in two registers is zero, represent that then the CAN communication breaks down, LabView software is reported to the police; When Δ t greater than zero the time, represent that then the CAN communication is normal;
C:, the timestamp in second register is shifted store in first register then with the first register zero clearing;
D: read the next frame data, and the timestamp of these frame data is stored in second register;
E: repeated execution of steps B, C, D are up to stopping monitoring.
Embodiment 2:
The method based on the monitoring CAN communication of LabView of present embodiment comprises the steps:
A:LabView software whenever reads the CAN communication data one time at a distance from 10 milliseconds; The CAN communication data that is read is stored in the array that is provided with in advance; And show that in real time the timestamp with the double frame data that read is stored in respectively in first register and second register simultaneously;
B: the timestamp of relatively being stored in first register and second register; When the difference DELTA t of the timestamp in two registers less than 9 milliseconds or during greater than 11 milliseconds; Represent that then the CAN communication breaks down, i.e. the less stable in CAN cycle, LabView software is reported to the police; When Δ t more than or equal to 9 milliseconds and when being less than or equal to 11 milliseconds, represent that then the CAN communication is normal;
C:, then the timestamp in second register is stored in first register with the first register zero clearing;
D: read the CAN communication data once more, and the timestamp of these frame data is stored in second register;
E: repeated execution of steps B, C, D are up to stopping monitoring.