04-26-2010 08:33 AM
Hi Jick,
here's a snippet with code that should work on any computer.
Ton
04-27-2010 12:47 AM
I am sure it works but the conversion should be vice versa (from string to number).
Jick
04-27-2010 02:48 AM
Ton & Gerd,
I think you might be wasting your time. Jick is a little too lazy to do this properly. When I pointed out:
James W wrote:Word of warning:
Changing the regional settings works.... until you port the code onto another machine and forget why you have the failure. I suspect many people would agree with me when I suggest you fix the problem properly in the LabVIEW code so you don't see it again rather than risk a headache in 6 months time when you've forgotten why this is happening and your PC has just been replaced!
You will probably pay later for your "laziness" now.
James
His response was:
Jick
Good point. I added a note into the LV code. Thanks!
- Adding a note will note solve the problem, It'll just make it slighty easier to debug when it breaks again - if the note is in the correct place. We've all told Jick what to do, I've even spelled out how to deal with all of the strings so it can be done in a simple VI just before the Text output, but that's too much work.
Lets leave this code to break later.
2 solutions have been offered, a correct 1 and a temporary bodge, Jick has chosen the bodge. It's always sad to see only half a job done.
James
04-27-2010 03:49 AM
"a temporary bodge" is enough for me at this point. I wouldn't call it laziness. The LV code will be deleted after some units are tested correctly. Sometimes (deadlines) you don't have enough time to spend with the code if there is faster solution available. This time faster solution was OS's settings change. Next time maybe something else.
I hope someone gets tips from this discussion.
Next time better luck.
Jick
04-27-2010 08:43 AM
Hi Jick,
what do you need else?
Yu have to convert a string into a number in LB, then give it to TS --> See my post no.3 in this thread.
In TS, you have to convert the DBL into a string for giving it to the uC --> see post 21
Regards.
Stefan
04-28-2010 12:18 AM
Hi SK@NIG,
"In TS, you have to convert the DBL into a string for giving it to the uC". In this case, I have a DBL with comma "," in TS (?) and if I send it to the uC it gives me error back.
The procedure one more time:
LV: "something...23.11..."-->convert to number--> 23,11-->Send to TS-->23,11 (there might be also some calculations)-->Send to uC-->Error because of comma ","
I kind of temporarily solved this problem and it is fine now. But I am curious to test some code in LV (if there really is) which gives me a dot "." to the indicator without changing any settings. Earlier, I was busy to solve this by coding because of deadlines.
Thanks for your help anyway!
Jick
04-28-2010 02:23 AM - edited 04-28-2010 02:23 AM
Jick wrote:LV: "something...23.11..."-->convert to number--> 23,11-->Send to TS-->23,11 (there might be also some calculations)-->Send to uC-->Error because of comma ","
Which software package sends the string to the uC? LabVIEW or Teststand (I assume LabVIEW)
But I am curious to test some code in LV (if there really is) which gives me a dot "." to the indicator without changing any settings.
See my reply here with this snippet:
Note, this code was run on an OS with a ',' (comma) as decimal sign.
The function I use is 'Format into string' with the following format specifier, '%.;%.2f',this specifier consits of two formatting codes:
You can do really awesome things with the format into string function. You can use the same format strings as display formatters for numeric indicators.
Ton
04-28-2010 02:36 AM
But your VI converts from number to string and I am interested in conversion from string (which includes ",") to number (which includes ".")...
Jick
04-28-2010 02:41 AM
Hi Jick,
did you read this:
"You can use the same format strings as display formatters for numeric indicators."
Just open the properties, select "Advanced" for formatting... That's the way in LabVIEW.
When TestStand behaves different, you should ask this in a TestStand forum as well...
04-28-2010 02:47 AM
Hi GerdW,
Yes, I red it and it is good. But it is not possible to programmatically temporarily "force" LV to change the decimal separator from , to . ?