LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on some kind of relay function

Hello, I really need help on the relay like function...

 

I need to make basically make the stepped input for the 1st motor and relay like input for the another motor. I was trying to increment input for 1st motor with 1 second or 2 second interval but decided not to because the way I approached was adjusting the timing of the loop but the loop has to be nested loop so It did not really worked out together. Therefore I choose to manually giving the stepped input. But still, like shown in the figure, the 2nd motor needs to get square input like red line in the figure. I kind of worked out for rising when the 1st motor input gets 0 -> 2 but I really have no idea how to drop square input to zero when the stepped input dropped 8 -> 6. I was working on the sample vi but eventually this will be implemented on the cRio FPGA. Trying not to use any case structure since simpler is better for loop iteration. 

 

Could anyone give me some solution or better suggestion please? 

 

 

 

Download All
0 Kudos
Message 1 of 6
(2,800 Views)

Hi hchun,

 


@hchun wrote:

I kind of worked out for rising when the 1st motor input gets 0 -> 2 but I really have no idea how to drop square input to zero when the stepped input dropped 8 -> 6. I was working on the sample vi but eventually this will be implemented on the cRio FPGA.


So you already know how to detect edges in signals…

What about this pseudocode?

 

 

IF ( signal_1 == 2 AND previous_signal_1 == 0 ) THEN signal2 = 8
IF ( signal_1 == 6 AND previous_signal_1 == 8 ) THEN signal2 = 0

 

 

You just need a shift register for each signal…

Best regards,
GerdW


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

@GerdW wrote:

Hi hchun,

 


@hchun wrote:

I kind of worked out for rising when the 1st motor input gets 0 -> 2 but I really have no idea how to drop square input to zero when the stepped input dropped 8 -> 6. I was working on the sample vi but eventually this will be implemented on the cRio FPGA.


So you already know how to detect edges in signals…

What about this pseudocode?

 

 

IF ( signal_1 == 2 AND previous_signal_1 == 0 ) THEN signal2 = 8
IF ( signal_1 == 6 AND previous_signal_1 == 8 ) THEN signal2 = 0

 

 

You just need a shift register for each signal…


Hi! 

That is what exactly i want to do but shift register won’t work since the rate of loop iteration is more than 50kHz. For example, if I do not increase signal 1, 2 to 4 quickly.. signal 2 will stays zero. Also i cant do wait or wait until because this loop is nested loop which will affect the outer loop’s rate. 

0 Kudos
Message 3 of 6
(2,749 Views)

A test, please ignore.

 

😎

8 )

0 Kudos
Message 4 of 6
(2,730 Views)

Hi hchun,

 


@hchun wrote:

That is what exactly i want to do but shift register won’t work since the rate of loop iteration is more than 50kHz. For example, if I do not increase signal 1, 2 to 4 quickly.. signal 2 will stays zero. Also i cant do wait or wait until because this loop is nested loop which will affect the outer loop’s rate. 

There are no shift registers in your "sample.vi". There are no nested loops in your sample.vi.

So what are you talking about?

 

The iteration rate is irrelevant for the suggested solution…

 

Just testing the editor, so ignore for discussion:

😎

 

signal1 == ‌‌8)

 

While editing:

In the first iteration of writing/editing this message the "8)" was deleted from the code section. Then I edited the message and included "8)" again into the code section, now it seems to stay…

Best regards,
GerdW


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

Sorry. One more test.

0 Kudos
Message 6 of 6
(2,697 Views)