LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RLS encoder slow down while loop execution

Shift it 12 bits (-12) rather than 8.

 

But what data are you dealing with that is 2-1/2 bytes.  (5 nibbles or 5 hex digits) ????

0 Kudos
Message 21 of 33
(2,221 Views)

Hi RavensFan,

 


@RavensFan wrote:

But what data are you dealing with that is 2-1/2 bytes.  (5 nibbles or 5 hex digits) ????


The encoder might output 20 bits of useful information.

The manual calls it "left aligned", I didn't understand that term until now…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 22 of 33
(2,211 Views)

Hi GerdW,

 

I have managed to convert the Hexademical values into angle (1-360) in decimal format.

However, when I rotate my encoder, the sum data which leads to angle displayed is incorrect and I have to stop and start to get the correct angle reading. 

Do you know what's the issue? I have attached a screen recording as well.

Thanks.

 

Regards,

Ryan

Ryan777_0-1615880847499.png

 

0 Kudos
Message 23 of 33
(2,205 Views)

@GerdW wrote:

Hi wiebe,

 

why do you use "AND 8" to get the status? I would use "AND 255" instead…


🌴😀 (:palmface:)

 

Yes, 255 is much better.

0 Kudos
Message 24 of 33
(2,201 Views)

Hi Ryan,

 

did you read the manual and do you understand how your encoder is working?

 

As I understood that manual you are reading absolute encoder positions. To get an angle you need to subtract a previous position from the current position to get the angle between both positions…

(I might be wrong, but that's how I understand it.)

 

Btw. why do you read 36 bytes from your encoder when the manual mentions just 4 bytes as response to the "3" command?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 25 of 33
(2,198 Views)

@Ryan777 wrote:

I have managed to convert the Hexademical values into angle (1-360) in decimal format.

However, when I rotate my encoder, the sum data which leads to angle displayed is incorrect and I have to stop and start to get the correct angle reading. 

Do you know what's the issue? I have attached a screen recording as well.

Thanks.


I'd toss in a Quotient & Remainder.

Message 26 of 33
(2,189 Views)

Hi GerdW,

 

I was testing out the V command which requires 36 bytes earlier, hence the 36.

Thank you so much for your help! I will continue to work on it! 

 

Regards,

Ryan

0 Kudos
Message 27 of 33
(2,183 Views)

Hi,

 

I am currently trying to export data from my indicator into an excel file. However my data hangs and repeat at the first reading and any rotation to my encoder does not do anything and the values will remain the same.

Anyone has idea where it might have went wrong? Thanks.

(The repeating and hanging of my encoder only comes in after I try to export the data)

 

Regards,

Ryan

Ryan777_0-1616034072505.png

Ryan777_2-1616034185793.png

 

 

0 Kudos
Message 28 of 33
(2,119 Views)

Hi Ryan,

 

again you forgot to attach real code instead of just images…

 


@Ryan777 wrote:
I am currently trying to export data from my indicator into an excel file. However my data hangs and repeat at the first reading and any rotation to my encoder does not do anything and the values will remain the same.

Anyone has idea where it might have went wrong? Thanks.

(The repeating and hanging of my encoder only comes in after I try to export the data)


You don't create "an Excel file", you create a simple formatted text file, also known as CSV…

How does your data "hang"?

When this "hang" only starts after including the WriteSpreadsheetFile function in the loop then this function probably is too slow and so influences the serial port readings. Have you tried to implement a producer-consumer scheme instead?

Have you tried to use faster file functions like WriteTextFile? Using this (with OpenFile before the loop) you don't need to open/close the file in each iteration!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 29 of 33
(2,091 Views)

Hi GerdW,

 

Thanks for taking the time to reply.

No I have not tried to implement a producer-consumer scheme yet (searched it up but not sure how do you connect it up)

I will try out the WriteTextFile function! Thanks!

 

Regards,

Ryan

 

0 Kudos
Message 30 of 33
(2,085 Views)