Hi,
I am reading data off a serial port every 5ms and together with this data I want to record the current time with fractional seconds. The code I am using is given below. I get the time in seconds and then format date/time as
%d%m%y%H%M%S%3u
The output string looks like
200308131510.412
I then us Fract/Exp String to number
The result of that is then
200308131510.4
The problem with it is I get the output only to one decimal place. How can I get around this?
Thanks.
Getting current time with fractional seconds
-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
Re: Getting current time with fractional seconds
You want also to see in the numeric indicator the same as in the string indicator. It's only the formatting problem of the numeric indicator. So rightklick on the indicator, and select properties. Than select the Format and Precission tab and there select floating point and 3 digits of precission.
eg
eg
-
- beginner
- Сообщения: 14
- Зарегистрирован: 19 мар 2008, 01:57
- Версия LabVIEW: 7.1
- Откуда: United States
- Контактная информация:
Re: Getting current time with fractional seconds
Hi,
I do not think it's a formatting problem, I have tried the formatting and it does not help. I still get the output of the Fract/Exp to Number to only one decimal point.
I do not think it's a formatting problem, I have tried the formatting and it does not help. I still get the output of the Fract/Exp to Number to only one decimal point.
-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
Re: Getting current time with fractional seconds
Try this VI, it should work without any problems. Or I misunderstand your issue.
- Вложения
-
- FP_Formatting.vi
- (7.77 КБ) 390 скачиваний
-
- beginner
- Сообщения: 14
- Зарегистрирован: 19 мар 2008, 01:57
- Версия LabVIEW: 7.1
- Откуда: United States
- Контактная информация:
Re: Getting current time with fractional seconds
Hi,
The data does display well now, but then I realized a bigger problem.
When I save it to file, it does not give the same formatting and the
measurement file does not give me an option to format the data before
saving it.
If the output on the indicator is: 200308131510.412
I am getting the in the file: 2.003082E+11
I have attached the picture on the vi.
Thanks.
The data does display well now, but then I realized a bigger problem.
When I save it to file, it does not give the same formatting and the
measurement file does not give me an option to format the data before
saving it.
If the output on the indicator is: 200308131510.412
I am getting the in the file: 2.003082E+11
I have attached the picture on the vi.
Thanks.
-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
Re: Getting current time with fractional seconds
You have anyways to differ between the data in RAM and the displaying of them in a indicator or logging of this piece of RAM into a file.
Please try not to use any Express VIs, they are not so flexible as common VIs, but of course you have to decide what you take.
Also, you can take a Format Into File.VI and edit the format string like you done it in the Get Date Time String.VI
Please try not to use any Express VIs, they are not so flexible as common VIs, but of course you have to decide what you take.
Also, you can take a Format Into File.VI and edit the format string like you done it in the Get Date Time String.VI