I am trying to indicate the radar range based on a certain payload value. I filter out the CAN frames (Starting with ID 513) which give me the status. In the payload, the fourth byte value indicates the range ie 32, 3C, 46, 50, 5A, 64, C8 indicating ranges 50, 60, 70, 80, 90, 100 and 200.
1) How do I use equal function to select the frame with ID 513 and then isolate the fourth byte number(Byte number is a unsigned long 32 int) to choose the relevant range?
I am attaching the code and picture.
2) I am also tryin to optimize the code by creating subvi's for these operations. What is the best documentation technique in labview?
3) How to incorporate write CAN frame.vi into the mainradar.vi code as well? (This is CAN/NI-XNET related question)
Any help is much appreciated.
To answer your first question, I created som example code that:
a) checks if the identifier of the CAN frame equals 513.
b) if that's true, search the Payload byte array for the entries you listed. This is done in a for-loop, since you need to search for all the 7 possibilities. If the entry is found, it's location in the byte array is checked and should be 3 (array elemetns are zero indexed). If it is false, zero is set as the range, but you don't have to use that value of course.
c) select the corresponding range from an array.
d) I see you are using "Get Queue Status" to get all the elements in the queue. Please keep in mind that those elements are not removed from the queue by that function. I used the Dequeue Element function to get a singel element from the queue, but if you want to take all CAN frames from the queue at once you can use "Flush Queue." You would of curse have to loop the code I wrote over all those elements.
e) I did not test this, please do so. Please find snippet and Vi attached.
Your second question:
a) The text written in the "VI Description" section of the Document catergory of the VI properties (File> VI properties or ctrl+I), will show up in the context help (ctrl+h and then hoover over the VI) when using that VI as a SubVI. You van also link to help files if you want to create those.
b) The label names of the controls that are linked to he connector pane of a VI will show up as the terminal names in the context help.
c) And of course the free text labels and owned labels are very usefull, but I can see you are already using those.
The third question: what do you want to do?