Convert serial data to array
-
- beginner
- Сообщения: 14
- Зарегистрирован: 19 мар 2008, 01:57
- Версия LabVIEW: 7.1
- Откуда: United States
- Контактная информация:
Convert serial data to array
I am relatively new to Labview and have a question on reading data from a serial port. I have attached the template of my block diagram. The data I get from the buffer is of the form:
3e40e5
3e60e5
3de0e4
3e80e7
3df0e5
3e20e6
3e40e6
3dd0e5
etc
ie hexadecimal data that I can look at with a string indicator on the front panel. I will be getting thousands of data points per run and so my questions are:
1) How do I put this data into a 1D array such that at
the 1st position I have 3e40e5
the 2nd position I have 3e60e5
the 3rd position I have 3de0e4
etc
I will need to manipulate the array data.
2) How do I save this data together with a time stamp so that I can keep track of the exact time that each data-point was taken.
The end result would be to have a 2D array with the following:
time 1 3e40e5
time 2 3e60e5
time 3 3de0e4
time 4 3e80e7
etc..
I am using Labview 7.1
Thanks in advance.
3e40e5
3e60e5
3de0e4
3e80e7
3df0e5
3e20e6
3e40e6
3dd0e5
etc
ie hexadecimal data that I can look at with a string indicator on the front panel. I will be getting thousands of data points per run and so my questions are:
1) How do I put this data into a 1D array such that at
the 1st position I have 3e40e5
the 2nd position I have 3e60e5
the 3rd position I have 3de0e4
etc
I will need to manipulate the array data.
2) How do I save this data together with a time stamp so that I can keep track of the exact time that each data-point was taken.
The end result would be to have a 2D array with the following:
time 1 3e40e5
time 2 3e60e5
time 3 3de0e4
time 4 3e80e7
etc..
I am using Labview 7.1
Thanks in advance.
- Вложения
-
- Labview Document.pdf
- (29.29 КБ) 752 скачивания
-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
Re: Convert serial data to array
Hello magreent and welcome here!
1) You have to buffer your received data. So use the Read VISA.VI in a while loop with a shift registrer. So you will get for every reading a new entry in your array, if you will use the Build Array.VI for each reding.
2) if you want to use the PC time stamp, use the Get date/time.VI and then convert the output of it using Get Date/Time String.VI and append this string to your array.
But I think you should convert your binary data to a number, don't you? What can you do with a HEX-Number?
Your issue isn't complex, so no problem to solve it. If you have any questions, so post them.
Regards, eg
P.S. please use no PDFs, you can Copy&Paste your block diagram into MS Paint and save as a PNG-FIle. That is the best for publishing a picture into this forum.
1) You have to buffer your received data. So use the Read VISA.VI in a while loop with a shift registrer. So you will get for every reading a new entry in your array, if you will use the Build Array.VI for each reding.
2) if you want to use the PC time stamp, use the Get date/time.VI and then convert the output of it using Get Date/Time String.VI and append this string to your array.
But I think you should convert your binary data to a number, don't you? What can you do with a HEX-Number?
Your issue isn't complex, so no problem to solve it. If you have any questions, so post them.
Regards, eg
P.S. please use no PDFs, you can Copy&Paste your block diagram into MS Paint and save as a PNG-FIle. That is the best for publishing a picture into this forum.
-
- beginner
- Сообщения: 14
- Зарегистрирован: 19 мар 2008, 01:57
- Версия LabVIEW: 7.1
- Откуда: United States
- Контактная информация:
Re: Convert serial data to array
Thanks for the response. I have attached again the file of the code I am using to get this hexadecimal string. The reason I want it in an array is so that I can convert and manipulate the data later.
Thanks-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
-
- beginner
- Сообщения: 14
- Зарегистрирован: 19 мар 2008, 01:57
- Версия LabVIEW: 7.1
- Откуда: United States
- Контактная информация:
Re: Convert serial data to array
Is there any way you can save this vi so I can open it in Labview 7.1?
-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
Re: Convert serial data to array
Here for 7.1
Please complete your forum-profile with your LV version.
Please complete your forum-profile with your LV version.
- Вложения
-
- Array7_1.vi
- (44.52 КБ) 699 скачиваний
-
- beginner
- Сообщения: 14
- Зарегистрирован: 19 мар 2008, 01:57
- Версия LabVIEW: 7.1
- Откуда: United States
- Контактная информация:
Re: Convert serial data to array
Thanks for the vi.
It is indeed working.
The last piece that needs to fall into
place is how I can save the array
to a file for each run.
It is indeed working.
The last piece that needs to fall into
place is how I can save the array
to a file for each run.
-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
Re: Convert serial data to array
Use Write To Text File.VI in each iteration.
- Вложения
-
- Array.vi
- (61.33 КБ) 668 скачиваний
-
- interested
- Сообщения: 1
- Зарегистрирован: 20 май 2014, 14:08
- Версия LabVIEW: 2013
- Контактная информация:
Re: Convert serial data to array
Hi Eugen, can you help me, how to convert serial data to array 2D like, for example if data 5x5 from 255000255000255000255000255000255000255000255000255000255000255000255000255 to
255 000 255 000 255
000 255 000 255 000
255 000 255 000 255
000 255 000 255 000
255 000 255 000 255
I'm using LabVIEW 2012.
Thx before
255 000 255 000 255
000 255 000 255 000
255 000 255 000 255
000 255 000 255 000
255 000 255 000 255
I'm using LabVIEW 2012.
Thx before
-
IvanLis
- guru
- Сообщения: 5463
- Зарегистрирован: 02 дек 2009, 17:44
- Награды: 7
- Версия LabVIEW: 2015, 2016
- Откуда: СССР
- Благодарил (а): 28 раз
- Поблагодарили: 87 раз
Re: Convert serial data to array
mulytiwi писал(а):Hi Eugen, can you help me, how to convert serial data to array 2D like, for example if data 5x5 from
Знание нескольких принципов освобождает от знания многих фактов!
Правила форума
Как добавить в сообщение картинку или файл
Конвертация / версий (форматов) VI
Как правильно задать вопрос...
Правила форума
Как добавить в сообщение картинку или файл
Конвертация / версий (форматов) VI
Как правильно задать вопрос...
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
- 2 Ответы
- 499 Просмотры
-
Последнее сообщение Artem.spb
-
- 5 Ответы
- 268 Просмотры
-
Последнее сообщение AndreyDmitriev