LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring RPM for encoder 11 bits

Here is the result if im using baudrate up to 115200,  You may see the substring format are not according to the format that i set in "scan for string". This error will always pop-out everytime i try to run VI.

 

Capture4.PNG

 

Thanks

0 Kudos
Message 11 of 17
(1,199 Views)

You clearly have a meaningful string at 115000 Baud, you just are having problems with Scan from String.  The silly \s "spaces" are the problem.  Try this --

Scan from String.png

Bob Schor

0 Kudos
Message 12 of 17
(1,163 Views)

@Bob_Schor wrote:

You clearly have a meaningful string at 115000 Baud, you just are having problems with Scan from String.  The silly \s "spaces" are the problem.


The indicator was already using the \ Codes.  So you don't need to convert the spaces into "\s".  You just need to use actual spaces in 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 13 of 17
(1,150 Views)

fendy90 wrote:

 

Capture4.PNG

 


Argument 3 is throwing the error.  The last VI you posted had 5 items in your Scan From String.  Your read data only has 3.  So you should change your format string to be "%f %f %f".  No need to mention the end of line characters since that is what is causing your error (the function is looking for a space to end the third item and found a carriage return).


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 14 of 17
(1,141 Views)

Hi,

 

it is like my data input in substring is intermittent as it read data from the sensor. That's why it throws error in "scan from string". If i used a slower baudrate up to 14400. It seems like the data input stabile and no error for formating 

0 Kudos
Message 15 of 17
(1,135 Views)

When i force to continue the error, this is what i get from all the input data in substring. It seems like the input data is not stabile.

Capture5.PNG

0 Kudos
Message 16 of 17
(1,128 Views)

From your posted example, your encoder values are counting down at a 125ms sample rate. Using my previous posted VI, “Encoder_Accelerometer_Final_Sync_V2_A.vi”, change the logic to check for counting down encoder values and the RPM calculations will work.

 

If Previous Encoder rolled over or hasn’t changed

Then Delta Enc =(2048-Encoder1)+Previous Encoder

Else Delta Enc = (Previous Encoder – Encoder1)

 

0 Kudos
Message 17 of 17
(1,113 Views)