LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RLS encoder slow down while loop execution

Hi Ryan,

 


@Ryan777 wrote:

I was wondering how do I connect it up to LabView to read the data that is produced?


Use the USB cable coming with your sensor and plug it into a free USB port of your computer…

(A virtual COM port (VCP) should appear.)

 


@Ryan777 wrote:

As for sending the commands to the encoder, how do I go about doing it? 


Use VISA functions to send commands (VISAWrite) and read responses (VISARead) with that VCP…

 

What have you tried and where are you stuck?

Best regards,
GerdW


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

Hi GerdW,

 

I am relatively new to Labview but this was what I came up with but there is no output data from my end. Am I missing something? Your help would be greatly appreciated!

Thanks!

 

Regards,

Ryan

0 Kudos
Message 12 of 33
(2,064 Views)

Hi Ryan,

 

why do you wire "i" to the "number of bytes" input of VISARead? Use a numeric constant set to the expected number of bytes in the response of your device!

 

Where do you send the command (as described in your PDF) to your device?

Do you get any error message when stopping the VI?

Do you get any received string (before you convert the string to number)?

 


@Ryan777 wrote:

I am relatively new to Labview


Did you take the Training resources as offered in the header of the LabVIEW board?

Best regards,
GerdW


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

Hi GerdW,

 

I have made adjustments based on your advice and these are the following results. I changed the block diagram and added in a VISAWrite.

I finally got some output data but the data looks like its the data for version request as shown below. (Data shown below is string data)

When I keyed in commands to view the data, nothing changes. Is my VISAWrite placed incorrectly?  Thanks in advance!

 

Regards,

Ryan

Ryan777_2-1615777249046.png

 

Ryan777_1-1615777132039.png

 

 

0 Kudos
Message 14 of 33
(2,010 Views)

Hi Ryan,

 


@Ryan777 wrote:

I finally got some output data but the data looks like its the data for version request as shown below. (Data shown below is string data) … Is my VISAWrite placed incorrectly?


The VISAWrite seems to be placed correctly.

The data shown in the image indeed looks like the respoonse to an identification command. Did you read the manual to learn how to parse that answer?

 


@Ryan777 wrote:

When I keyed in commands to view the data, nothing changes.


Did you type the commands exactly as is described in the manual?

Did you type the correct TermChars? Most devices don't answer until they receive the needed TermChar…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 33
(1,991 Views)

Hi GerdW,

 

I managed to get data readings by sending commands to the encoder. However, the data I am getting is in Hexadecimal as shown below. For the string conversion, I can't seem to find one that can output can data in decimal format. The following FAFB C000 corresponds to the the angle 352 and yes when I rotate the encoder, different Hexadecimals will be shown. Do you know how I can get my data in degree based on my given output?

Thank you.

 

Regards,

Ryan

 

Ryan777_4-1615795296655.png

 

Ryan777_0-1615795119421.png

 

I used a Hexadecimal string to Number function but no data is shown on the indicator.

Ryan777_5-1615795561093.png

 

 
 

 

0 Kudos
Message 16 of 33
(2,004 Views)

Hi Ryan,

 

did you read the manual?

 

Command "3" gives you the "absolute encoder position", described as

 

3 bytes binary absolute position, big-endian, left aligned
1 byte detailed encoder status

 

So you need to read 4 bytes and convert the first 3 bytes into an integer number:

"FAFBC0" results in a position of 16448448…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 33
(1,992 Views)

Hi wiebe,

 

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

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 19 of 33
(1,974 Views)

Hi GerdW,

 

Thanks for the help so far! Lets say if my Hexadecimal is "FAFBC000", how do I edit your block diagram so that the conversion involves the first 5 characters "FAFBC" instead of "FAFBC0" 

So the final decimal output will be "1028028" instead of "16448448".

Thank you.

 

Regards,

Ryan

 

Ryan777_0-1615861933635.png

 

0 Kudos
Message 20 of 33
(1,945 Views)