LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using Shimmer library without COM port

Hi all,

I am working on a project were I have an RN-42 module connected to myRIO from one side, and the Shimmer sensing device from the other side.

I have successfully connected my RN-42 module to the myRIO and to the Shimmer sensing device. I also managed to start streaming data all using NI VISA and following Shimmer framework code. Now when I try to read data from the sensor I recieve awkward hexadecimal stack of data as attached files show.

I tried using Shimmer library example in LabVIEW "Shimmer Plot and Write" but instead of inserting the COM port, establishing the connection using NI VISA as attached but it did not work. 

How can I extract acceptable data from it?

Download All
0 Kudos
Message 1 of 4
(3,379 Views)

I have a reputation on this Forum for getting all Hot and Bothered when posters (such as yourself) attach a picture of part of a Block Diagram.  This is frustratingly useless -- if you knew where the problem was located, you might be able to show us only the relevant code, but since you have a problem, you should provide us with all of the code, in runnable, modifiable form (i.e. as a VI) so that we can play with it ourselves, maybe alter it, test it, and fix it.

 

Whew.  Glad I got that out of the way.

 

So I refuse to look at the Shimmer picture.  However, the Main VI has some curious bits.  I don't know how your Shimmer device works, but most devices that use VISA as a communication medium use termination characters.  The reason that they do this is because the receiver of the message doesn't really want to read it until all of the message has been delivered.  For example, say the message was 300 characters, and you did a VISA Read at the point the device had sent 30 characters.  Great, you ask how many characters are at the port, read 30, get those 30 characters, and they don't make sense (because the remaining 270 characters haven't yet been received nor read).

 

If you set up VISA to use a Termination Character (you need to see what your sending device uses), then your VISA Read will "block" until it sees the Termination Character (or until the Timeout occurs, which is why there is a Timeout parameter).  You then ask how many bytes, see 300, and read them all, knowing you have the entire message.

 

Another thing I noticed is that you branch the VISA wire inside your For loop and take it to two VISA Write statements (one writes 20(hex), the other writes 00(hex)07(hex).  Which writes first?  It is indeterminate -- this is LabVIEW, which uses Data Flow, but otherwise is a parallel language, so either could "win the race".  Incidentally, I'd advise against using Hex in the String control -- I thought you were writing the string "20" and "0007".  If you use the "\" format, instead, the String Constants would be \s (space) and \00\07 (hex 00 and 07).  Remember, you want the code to be understandable by any LabVIEW user (including yourself, two months from now, when you've forgotten you used hex here).

 

Bob Schor 

0 Kudos
Message 2 of 4
(3,358 Views)

@Bob_Schor wrote:

but most devices that use VISA as a communication medium use termination characters.  The reason that they do this is because the receiver of the message doesn't really want to read it until all of the message has been delivered.  For example, say the message was 300 characters, and you did a VISA Read at the point the device had sent 30 characters.  Great, you ask how many characters are at the port, read 30, get those 30 characters, and they don't make sense (because the remaining 270 characters haven't yet been received nor read).


The problem here is that it looks like the Shimmer instrument uses Hex data.  So the termination character won't work.  You have to know what the message protocol is in order to know how many bytes to read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 4
(3,344 Views)

The Shimmer website provides documentation for the packets recieved in the framwork ReadMe.txt files as follows, but I did not know how to use these information.

 

https://github.com/ShimmerResearch/shimmer3/tree/master/apps/LogAndStream

https://github.com/ShimmerResearch/shimmer3/tree/master/apps/BtStream

 

0 Kudos
Message 4 of 4
(3,267 Views)