From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-04-2008 12:40 AM
05-04-2008 12:59 AM
Problem solved
Attaching the VI that just does not care what your reflex speeds are and for every click reliably changes the state of the lamp.
05-04-2008 01:36 AM - edited 05-04-2008 01:36 AM
I don't think you need so many stacked case structures. Here's a quick alternative that looks a bit simpler. 😄
05-04-2008 02:17 AM
05-04-2008 03:11 AM
05-04-2008 12:38 PM - edited 05-04-2008 12:39 PM
Raghunathan wrote:
Agreed. But only when you can figure out boolean logic like the back of your hand.
Still, I recommend my code. It does the same thing wilth much less code. 🙂
03-31-2010 06:32 AM
Can we do the same thing using hex values. I mean
when 00011110 received I should get 11111110 ( if 7 Led are present in the front panel)
when I send 00011110 again I should get 11111111 (Last bit toggled)
similarly , when i send 00011101 ----------> 11111101
when I send 00011101 again -----> 11111101
when i send 00011011 ----------> 11111011
when I send 00011011 again -----> 11111011
when i send 0001011 ----------> 11110111
when I send 0001011 again -----> 11110111
when i send 00001111 ----------> 11101111
when I send 00001111 again -----> 11101111
And any of the bits should not change until I receive the same value again. And I can send Randamly any of the bit low and corresponding to that my led in front panel should vary.
Plz help me in this.
03-31-2010 11:59 AM
Sippy wrote:Can we do the same thing using hex values. I mean
when 00011110 received I should get 11111110 ( if 7 Led are present in the front panel)
when I send 00011110 again I should get 11111111 (Last bit toggled)
similarly , when i send 00011101 ----------> 11111101
when I send 00011101 again -----> 11111101
when i send 00011011 ----------> 11111011
when I send 00011011 again -----> 11111011
when i send 0001011 ----------> 11110111
when I send 0001011 again -----> 11110111
when i send 00001111 ----------> 11101111
when I send 00001111 again -----> 11101111
And any of the bits should not change until I receive the same value again. And I can send Randamly any of the bit low and corresponding to that my led in front panel should vary.
Plz help me in this.
Your description is ambiguous. After thte word "similarly", The binary values on the right side do not change. But in your first statement, the value changes. It looks like you are wanting a 0 in any bit position meaning to toggle a certain LED. Yet, your first three binary digits are always 0's and the right side shows no toggling. You stated you had seven LEDs, but you are showing eight bits. This is very confusing. Assuming you had seven LEDs, is this what you want:
Normal output 1111111
Send 1111110 Output 1111110 (toggles bit 0)
Send 1111111 Output 1111110 (stays the same)
Send 1111110 Output 1111111 (toggles bit 0)
Send 1111101 Output 1111101 (toggles bit 1)
Send 1111101 Output 1111111 (toggles bit 1)
Send 1111010 Outptut 1111010 (toggles bits 0 and 2)
Send 1111101 Outptut 1111000 (toggles bit 1 but leaves 0 and 2 alone)
Send 1111000 Output 1111111 (toggles bits 0,1,2)
In other words, a 0 in any position will toggle the corresponding LED. Is this what you want?
03-31-2010 02:18 PM
Kind off,
I have 5 different input values. for example A1,A2,A3,A4,A5.
and 7 leds at the output (Default all are forced to be high)
When input is A1 (00011110) ----> Out put is 11111110 (last bit goes off) and when input is A1 again the 0th bit toggles.
When input is A2 (00011101) -----> 11111101 and when input is A2 the 0th bit toggles.
When input is A3 (00011011) --> 111111011 and when input is A3 the 0th bit toggles.
When input is A4 (00011011) ---> 11110111 and when input is A4 the 0th bit toggles.
when input is A5 (00010111) ---> output is 11101111 and when input is A5 any point of time the 0th bit toggles.
And when A1,A2 sent together Logically i ll get 00011100 (A1&A2) so the output is 11111100
similarly with other combinations like A1A3, A2A3 ..... A1A2A3A4A5 you get 32 such combinations but i want a generic design. It can be done using 32 case structures but I don't want to do so.
Basically I am receiving the A1,A2,A3,A4,A5 from Status port of parallel port (which is a push button) and I am using input.vi and using address 379 and doing some combinations so that in my outport.vi which has address 378 and D0 to D7 lines (LEDS) I get the output as mentioned above.
In my understanding I should play only with single bit. I am able to turn off the leds when A1,A2,A3,A4,A5 are sent and with the combinations. but not able to turn them ON when sending A1,A2,A3,A4,A5 again.
what i am doing is when I send 00011110 ---> I check if the last bit is 0 or not if it is 0 then enter the loop and perform this opeeration 11111111 & FE and send to Data port using outort.vi when A2 (00011101) checks if the bit is 0 or not in the input side if 0, now the output is *******0... so
what ever output I am getting I am again ANDing with FD to get ******0* this way my previous status of LED will not get affected.
for A3 (00011011) what ever output i get ANDed with FB... and so on.
When A1 (00011110) is received again in the input side it checks if the bit is 0 or not and it should check if D7 bit (*******0) is 0 or not if 0 the it should toggle.
when A2 (00011101) is received again in the input side it checks if the bit is 0 or not and also it should check if D6 bit (******0*) is 0 or 1 if 0 then toggle that bit to 1 and if its 1 toggle that bit to 0...
03-31-2010 02:54 PM
I'm sorry. I'm even more confused that ever. Judging from lack of response to your question, I would say that others are confused too. Perhaps if you stated these properties:
1. What generates the A1 through A5 numbers?
2. How do you process them exactly (AND with FE and such - use bit notation D7 for MSB and D0 for LSB)?
3. After processing, where does the output go?
4. How are the LEDs controlled?
Here are some ambiguities in your statements:
"When input is A2 (00011101) -----> 11111101 and when input is A2 the 0th bit toggles" - its not the 0th bit that toggled, it is bit 1 that toggled. Use notation like D0 and D1, the bit pattern would be D7 D6 D5 D4 D3 D2 D1 D0.
"In my understanding I should play only with single bit" - yet you show manipulations of several bit, not a single one.
"perform this opeeration 11111111 & FE " - why perform the operation? 11111111 & anything will always produce the anything number. Just send out FE.
"when A2 (00011101) checks if the bit is 0 or not in the input side if 0, now the output is *******0" - which bit are you checking for 0, D1 I guess. But your output shows D0 bit being 0, not D1 bit. Are you wanting to always toggle D0 for the output whenever any input pattern has a 0 in it?
It seems like this is what you want to do:
input = 00011110 - toggle output bit D0
input = 00011111 - no change
input = 00011110 - toggle output bit D0
input = 00011101 - toggle output bit D1
input = 00011010 - toggle output bits D2 and D0 but leave D1 alone
input = 00011000 - toggle output bits D2 D1 D0
Is this correct?
I'm not trying to pick your explanation apart, I'm just trying to help you. But I cannot help if I don't understand your criteria.