LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial read multiple sensors (Encoder+Accelerometer)

Solved!
Go to solution

Hi,

 

Im working on this project where require interface encoder and accelerometer at one-time. I tried to read the serial data and use it to plot a graph( real-time).

Capture.PNG

 

 

Problem;

1. Everytime i run it will always pop-out error

2. There are delay in signal in labview when i try to read through real-time graph.

Capture3.PNG

 

Thank you,

Effendywoo

0 Kudos
Message 1 of 15
(3,902 Views)

Your pictures are tiny.  I can barely make out what the error code was.

 

Your format string for hte Scan From String is not matching the data coming in.  Do you have an example of the data string going into the Scan From String?


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 2 of 15
(3,865 Views)

Here is my example data, 
Note: "the value zero is for the encoders value (2 dc). 

Capture.PNG

 

The error pop-out,

Capture3.PNG

 

Thanks, 

Effendywoo

0 Kudos
Message 3 of 15
(3,848 Views)

What is the character seperating those numbers?  Tab?  Space?  Some other non-visible character?


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 4 of 15
(3,837 Views)

Only space that seprate the data,

 

Example;

 

Row1     Row 2      Row3   Row4     Row5

Time   Encoder1   Enc2    X-axis    Y-axis

0.5           100.2      120.8       67           87

1.2           200.4      300.4       20           21

 

Regards,

Effendywoo

0 Kudos
Message 5 of 15
(3,816 Views)

I suspect (arg 1) is empty!

 

What is in your "substring"

You have to write code to make sure what you read back from the VISA read is valid before passing it to the "Scan From String"

Did the VISA Read throw an error?

What is the termination char setting for your VISA read?

 

Omar
0 Kudos
Message 6 of 15
(3,814 Views)

 

 

Hi Omar,

Capture4.PNG

Visa read does not throw any error. here is the data i get when i try to probe after "String subset". 

 

Regards,

Effendywoo

0 Kudos
Message 7 of 15
(3,811 Views)

@fendy90 wrote:

Only space that seprate the data,


Then your format string needs to have the spaces.  So your format string should really be "%f %f %f %f %f".


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 8 of 15
(3,807 Views)

@fendy90 wrote:

 

 

Hi Omar,

Capture4.PNG

Visa read does not throw any error. here is the data i get when i try to probe after "String subset". 

 


When dealing with instrument communications, it helps a lot if you change the display style of those indicators to be "\ Codes".  Then it becomes obvious what is seperating your data.


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 9 of 15
(3,804 Views)

What do you mean by changing the data to "codes"? I try to format as "%f %f %f %f %f" and it seems not working out. 

 

Regards,

Effendywoo

0 Kudos
Message 10 of 15
(3,781 Views)