02-10-2021 03:28 AM
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?
02-10-2021 03:41 AM - edited 02-10-2021 03:43 AM
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…
02-10-2021 09:52 AM
@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.
02-10-2021 12:10 PM
A test, please ignore.
😎
8 )
02-10-2021 12:46 PM - edited 02-10-2021 12:53 PM
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…
02-10-2021 11:16 PM
8)
8 )
Sorry. One more test.