07-06-2017 09:34 AM
Hello,
I have a force gauge (MARK-10) which I want to read the force and display it in LabVIEW.
I found a code which I added some extra code in it, and it works perfectly. But when I wanted write my own code, because I wanted to include motion control as well then it didn't work. So I tried to read only from the force gauge once again but I wrote another code from scratch exactly the same as the first one, but it still doesn't work. And I really can't see what the difference is, do you know what the problem could be?
file, forceGauge (the one that is working): reads very smoothly. the indicator shows the value all the time.
file, test stepper and force gauge (not working): displays *51 in the read buffer, and it flashes in the indicator.
Grateful if you could help me.
Solved! Go to Solution.
07-06-2017 09:39 AM
I cannot download and view VIs. Any chance you could also take screenshots and post those?
07-06-2017 09:43 AM - edited 07-06-2017 09:55 AM
In your force\stepper VI, you are sending ?\r, as in a literal question, backslash, r because your constant is in normal display mode. In your force gauge VI, your control is in \code mode so you are sending ? carriage return. I'm sure that is error #1 in the force/stepper VI.
In both VI's, I see a problem, You are writing a command, then immediately doing a "bytes at port". Since you haven't given any time for the device to respond, you probably have 0 bytes at port and read nothing that iteration. Bytes at port is the wrong thing to use about 95% of the time. If the response has a termination character (you set up the serial port with a line feed as the termination character), then use it. Read a large number of bytes and the response will come back and terminate with the linefeed character. You won't need the bytes at port and you'll have a complete response.
07-06-2017 09:47 AM
Here are some screenshots.
07-06-2017 09:47 AM
07-06-2017 09:53 AM
Of course, I totally missed that. Thank you so much.
And thank you for the feedback, I'll try it out.
07-06-2017 11:02 AM
@GerdW wrote:
Hi pamy,
when you use string constants with \-codes you should ALWAYS make the display style item visible!
Set your string constant to \-code displaymode, then correct your string content…
This practice should be a subset of "if you are displaying any control, indicator or constant in a non-default fashion, always indicate it in the appropriate manner". e.g., display style for a string, radix for a number, etc... imagine mistaking 100 decimal for 100 hex.
07-06-2017 11:44 AM
billko wrote: imagine mistaking 100 decimal for 100 hex.
I inherited a project where that happened at least 10 times a day (hardware guy was in hex while the test guy was in decimal). No wonder the project took WAAAAAAAAAAAAY longer to do than it should have...