LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

This code measures the angle of the rotary encoder. Please interpret the code

랩뷰 숙제.png랩뷰 숙제 2.png

0 Kudos
Message 1 of 5
(406 Views)

Hi leeyeonwoo,

 

please tell us how you understand the code!

 

I can say there are bugs (or missing items) in this code and there are some very bad constructs (like wrong datatypes)…

 

Btw. did you know we cannot edit/debug/run images in LabVIEW? So please don't call those pictures "code", there are just "images of code"!

Best regards,
GerdW


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

I didn't understand the case condition, and I also didn't understand the NXOR side.

0 Kudos
Message 3 of 5
(326 Views)

Hi lee,

 


@leeyeonwoo wrote:

I didn't understand the case condition, and I also didn't understand the NXOR side.


Me neither.

A boolean function of two inputs and one of them a constant is mostly Rube-Goldberg: draw the truth table on a sheet of paper and simplify this part of the code...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(319 Views)

As you probably know, LabVIEW is a programming language developed for doing Engineering (that's what the "E" in LabVIEW stands for).  If you are using LabVIEW to "do Engineering", then it is probably interfaced with some mechanical or electrical measuring devices.  It is helpful to tell us about the hardware connected to the LabVIEW code.

 

In your case, I'm guessing that you have a resolver or something that outputs pulses as something rotates, and your LabVIEW program is reading digital pulses.  It is important to tell us about the Inputs and Outputs, and about what hardware you are using to do this.  It is also important to tell us about your LabVIEW system, including the Version of LabVIEW and whether you are running 32-bit or 64-bit LabVIEW).  As mentioned, we also need to see the LabVIEW program itself (not pictures!) -- since those of us who have been using LabVIEW for a decade or more are probably not using the latest version of LabVIEW, you need to "Save for Previous Version" and specify LabVIEW 2019 or 2021.

 

Assuming my assumptions about your hardware are correct, and you have a resolver, it is going to produce a pulse when the shaft turns a certain amount.  Pulses are typically read with a Digital Input line which returns a value of 0 when the voltage is < 2 V and a value of 1 when > 3 V.  What you are interested in is when it goes from 0 to 1.  That means you need to know the current value (you are looking for 1) and the previous value (you are looking for 0), and you want the output to be "True" with both conditions are met.

 

There are many (equivalent) logical expressions that will give you this value.  Use Pencil and Paper and a little thought to come up with one, yourself.  You should be able to do this without needing a NXOR function ...

 

Bob Schor

 

P.S. -- I agree that the code show in the pictures is awful!

0 Kudos
Message 5 of 5
(305 Views)