Solved! Go to Solution.
First, and most important, what is the coimmunications protocol used by the pump? RS-232 is not a protocol but merely a (Recommended) Standard for the voltages, currents, and character framing. The communications protocol, which is defined by the pump manufacturer, includes the timing and framing options and also things like termination characters, message length specifications and other things.
From looking at your code, it appears that you misunderstand the protocol. Some messages you send are start and end with hex 02 and 03. Others appear to be single character commands (x06 and x14). Except for expecting a single character (x05) on some reades, there is no clue in the code about what the received messages look like.
The use of line feed (hex A or decimal 10) as a termination character is enabled by default. When using a termination character, you should never use Bytes at Port! They will fight each other and produce difficult to interpret results. When using termination characters you also do not need any Waits.
VISA in LabVIEW does not by default append any termination character on Write. If a termination character is required by the protocol, you must add it explicitly in the code. You cna do this by appending the character to the strings being written or via a property node.
Comments on your coding style:
1. The style guides recommend keeping both the front panel and the block diagram to the size of one screen. Scrolling around to find things is both unproductive for the programmer and makes it much more difficult to tell what is happening in the program.
2. Wires should generally go from left to right and should avoid being hidden behind other objects.
3. Some of your string constants are displayed in normal mode while others are in hex display mode. Right click on the constants and select Visible Items >> Display Style. That will show a small glyph on the left edge of the constant making it apparent which dispaly style is used. This can reduce confusion significantly. Note that in the image below 4 of the 5 constants are ambiguous - they are valid expressions in either normal or hex display styles and have different values. Whay does the empty string do in that code?
4. There is no need to have a Concatenate String node following a single string constant.
5. The counters should use the I32 data type rather than double. Although probably OK in your case, Equals? comparisons on doubles can be a problem due to the finite representation of floating point numbers in binary. Also, use Increment in place of Add 1.
6. Case structures can accept integer and string data types at the selector terminal. The double nested case structure looking at =1? and =4? could be simplified to a single case structure with 3 cases.
7. The sequence structure containing delay before read (ms) 3 runs parallel to the rest of the code inside the while loop and may not do what you expect.
I made programm for contolling the flow rate of two pilot c infusion syringe pump, but this programm some times run and some times gives connection error. But same program when i run in anothe system (Laptop)then it is not running. What is the cause behind this.
It is almost impossible to trouble shoot your program.
- All the subVIs are missing and all the work is done in them.
- The crooked, overlapping, and disappearing wires make if difficult to impossible to follow the data through the program.
- The style guides recommend keeping the front panel and the block diagram each to the size of one screen. While I do not have the largest screen, your panel and diagram are much too large. I suspect that your block diagram could be cleaned up to the point where it could be covered by one hand.
What specific error do you get? Which subVI generates that error? Is it always the same error, or do you get different errors on different runs?
Thanks for your suggestion.
I am not getting any error in this programm when I run programm after restarting my computer which is 32 bit window 7, and both pump running continuously and controlling all parameter succesfully.
But same programm gives connection error in one pump and another run succesfully when i run this programm in my laptop ( vaio 64 bit, window 7) and every time i got same error. Whatever pump i select first that run continuously but 2nd pump gives connection eroor after completing one loop.
In another laptop which is using trial version of labview gives no response in any pump.