|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
logic gates question
Could this be implemented in LabVIEW? And if so, what would it do? note: the intent of the small circle on the bottom input of each AND gate is that the bottom input is inverted Last edited by Ether : 16-02-2013 at 17:15. Reason: added note |
|
#2
|
||||
|
||||
|
It can be, I coded it up quickly while I was waiting for something, but I'm not sure what it is trying to do.
The second set of ANDs require the last output to be True, so unless you initialized the output to be true, the Ands would never let the code output True. |
|
#3
|
||||
|
||||
|
Re: logic gates question
note: the intent of the small circle on the bottom input of each AND gate is that the bottom input is inverted |
|
#4
|
|||
|
|||
|
Re: logic gates question
I wasn't sure who the question was for. Here is what it looks like in LV if you use the growable logic nodes.
I'll let others do the implementation to see the end result. There are many many ways to write this by the way. Greg McKaskle |
|
#5
|
||||
|
||||
|
Re: logic gates question
Greg beat me with the exact implimentation for a toggle
Here is a simple one that has been posted before |
|
#6
|
||||
|
||||
|
Ah, missed that first time I looked at it.
|
|
#7
|
||||
|
||||
|
Re: logic gates question
Quote:
@ Greg: how much different is the code that LabVIEW generates for the following two different approaches? http://www.chiefdelphi.com/forums/at...3&d=1361055503 http://www.chiefdelphi.com/forums/at...8&d=1360772515 |
|
#8
|
||||
|
||||
|
Re: logic gates question
Whoah, there are growable logic nodes? Time to go get rid of the 3 and statements I have hooked together...
|
|
#9
|
|||
|
|||
|
Re: logic gates question
The LV compiler supports optimization transforms, but I don't expect there to be one that will turn the select and negate into the XOR. So I expect the XOR to be just a bit more efficient. I put the code into timing sequences and ran it 100,000,000 times and indeed, at least for intel code gen, the XOR is just a bit faster.
Greg McKaskle |
|
#10
|
||||
|
||||
|
Re: logic gates question
Quote:
Last edited by Ether : 17-02-2013 at 18:28. Reason: forgot to add the sketch |
|
#11
|
|||
|
|||
|
Re: logic gates question
My testing showed that at least on Intel, the top one that used XOR was more efficient.
I rewrote the other to use a case statement instead of a select and it was then the fastest. Selects tend to execute both the true and false and then select the appropriate one whereas case statements will only execute one or the other. But at this level for toggle on a button on a joystick, we are in the weeds. Write what is readable. Greg McKaskle |
|
#12
|
||||
|
||||
|
Re: logic gates question
Quote:
http://www.chiefdelphi.com/forums/sh...5&postcount=10 Quote:
Quote:
|
|
#13
|
|||
|
|||
|
Re: logic gates question
The > was a bit faster than the logic. This is again only on testing on intel and it was about 20% different.
Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|