12-21-2010 09:04 AM
@Gh Kh wrote:
I use array,do you think it is correct or not?
Is it working for you?
I doubt it will. You have a U8 array wired into the unflatten from string rather than a U16.
(you also created that U8 array very awkardly by using the U8 typecast function, actin on the VISA reference which is just meaningless).
Why do you try using the code I gave you? It is a snippet, so you can drag and drop it into your block diagram.
You also have a bunch of unwired tunnels in your block diagram which gives you the broken run arrow.
12-21-2010 05:29 PM
Hello,
My problem is that I am a new user of labview and this is a real project. 🙂
I know the type of data that comes from bluetooth( A/D convertor) are 16- bit binary string.
These 4 different signals pack in 4 different address in 16bits with big endian priority.
my problems:
1.should I use visa?
2.big endian?
3.how should i recognize each signal?if some bits miss between the data transferring how can I recognize in labview.
4.how should i seprate each 16 bits from visa.
5.is there any function for seperating the string?
Kind Regards
12-21-2010 09:19 PM
@Gh Kh wrote:
Hello,
My problem is that I am a new user of labview and this is a real project. 🙂
I know the type of data that comes from bluetooth( A/D convertor) are 16- bit binary string.
These 4 different signals pack in 4 different address in 16bits with big endian priority.
my problems:
1.should I use visa? I don't know. I am not an expert on Bluetooth, There are other message threads that discuss how to use bluetooth commands.
2.big endian? You said your data was little endian, so I think you should be using that.
3.how should i recognize each signal?if some bits miss between the data transferring how can I recognize in labview. I don't know. That depends on the protocol of the device you are communicating with. Does it provide any starting byte, ending byte to know when each packet of data starts and ends? Does is provide any checksum that you can compare your received data against to make sure you didn't get any byte errors?
4.how should i seprate each 16 bits from visa. Use a U16 array in the unflatten from string that automatically converts each pair of characters (U8 bytes) to a U16 array element.
5.is there any function for seperating the string? You now have an array of U16 elements, use index array to separate them.
Kind Regards
12-27-2010 09:44 AM
Hello,
This is a new way that they send me a data from bluetooth to the com port,can you give me a hint how should I seprate different four signals and use them?
Should I use VISA module or normal labview is enough?
12-27-2010 10:26 AM
I don't know what you mean by "normal LabVIEW".
It looks like your data is sent as
FF FF B1 B2 00 00 B3 B4 00 01 B5 B6 00 02 B7 B8 (where B# represents your real data).
If you read 16 bytes and look for the FF FF xx xx 00 00 xx xx .... patterns, you'll know which are the marker bytes beginning the real data and which are the real data bytes that pertain to each of the pieces of data. If you find that your reading of 16 bytes is not properly synchronized with the sending, you can use the information you got from looking for the pattern to determine how many more bytes to read to get it back in synch.
Now once you have the bytes, you strip out the marker bytes and typecast the remaining bytes to U16 or I16 to get an array of the 4 real data bytes.
(Actually, you could typecast all of the bytes to get and array of U16 or I16, then decimate that array since only every other element is a real data byte, and the elements in between are FFFF, 0000, 0001, 0002)
12-27-2010 04:57 PM
if I only have the real value(real data) and the first byte is the value of signal and the second byte is the identifier of each signal,how can i distinguish the string of data from visa in labview and use them seprately.
12-27-2010 09:04 PM
I don't understand what you are saying now.
If the first byte you get is data (because you missed the first two identifier bytes of FF FF and the first byte of the real data), then the next two bytes you get are identifier bytes 00 01, you need to inspect the data you are getting in and search for that in the string. There are string functions such as String Subset that let you look at the string byte by byte.
There is probably a more efficient way to do this using Match Regular Expression, but I'm not familiar with the crazy syntax you would need to accomplish is that way.
12-28-2010 05:33 AM
Hello,
No,I mean if we dont have FFFF and 0000,0001,0002.Because the first byte is value from AD convertor and the second byte that sent is empty.So I think if we define identifier of each signal in the second byte then it is more reasonable than sending empty byte.Then,can you give me some hints that how should I seprate the string and recognize each signal from visa?
should i mask or the other way?
Regards
12-28-2010 12:29 PM
@Gh Kh wrote:
Hello,
No,I mean if we dont have FFFF and 0000,0001,0002.Because the first byte is value from AD convertor and the second byte that sent is empty.
Well that's not what you showed in the .txt file you attached to an earlier reply. Now I'm assuming that the command UARTSendbyteUB was a command programmed in your device to send a particular hex value through its serial port.
So I think if we define identifier of each signal in the second byte then it is more reasonable than sending empty byte.Then,can you give me some hints that how should I seprate the string and recognize each signal from visa?
should i mask or the other way?
I already gave you hints. Use the String Subset Function to pick out parts of the string.
Regards
12-30-2010 08:29 PM
Hello,
Happy new year 🙂
I really need help 🙂
This attachment has not completed yet.I only wanna know the idea is correct or not.
1.I wanna recognize each signal separately(after FFFF one signal,After 00 00 the next ,till end)
2.I wanna use case structure that we use in c language but I cant finf so i use onlt case structure in labview the false parts (0 or default) will complete to search for another signals but it will become so complicated.
Is there another way?
3.I have problem for reading another data from visa,foe example after FFFF,how should i connect the net read to serial?
Kind Regards