1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Disconected Switch and a Counter

Discussion in 'Building With Reaktor' started by CC4, Oct 3, 2013.

  1. CC4

    CC4 NI Product Owner

    Messages:
    167
    Huh.JPG

    I'm hoping someone can help me out with this one. Essentially this tiny structure is causing me some problems in a current project; I've also attached a .zip file if you want to try it out.

    The reset and count buttons are setup in Gate mode. The reset button has an On value of 0 and an Off Value of 1. The count button sends an On value of 1 and an Off Value of 0. A value is added to the counter each time the Count button is released.

    I also have a switch; In this example it's not even connected to anything. When I press a button on the switch a value is also added to the counter. Why are all the switches in my project adding values to this counter? How else could I count when this button is released and keep the switches in my project?
     

    Attached Files:

    • Huh.zip
      File size:
      3.3 KB
      Views:
      65
  2. salamanderanagram

    salamanderanagram NI Product Owner

    Messages:
    3,454
  3. Tun

    Tun NI Product Owner

    Messages:
    224
    this problem sounds familiar :)


    i made some quick changes that seem to work ok. (in the attached image).
    this is assuming you want the counter to be reset to 1. if you want it to be reset to 0 then you can remove the value module. all the functions of the buttons are the same as they were.

    im not sure if the order of events in this structure will change the fact that it works though. im sure salamanderanagram can tell us this.
     

    Attached Files:

    • huh.JPG
      huh.JPG
      File size:
      15.6 KB
      Views:
      200
  4. CC4

    CC4 NI Product Owner

    Messages:
    167
    Hmm. I read that a long long time ago. Perhaps this was why I tended to avoid the usage of switches for many things, since they re-fire values for whatever reason. Conundrum.
     
  5. CC4

    CC4 NI Product Owner

    Messages:
    167
    Unfortunately, the problem with your example is that it adds a value when the Count button is pressed, but I need it to add a value when the Count button is released.
     
  6. Tun

    Tun NI Product Owner

    Messages:
    224
    ok. fixed. i have added a breaker that i used recently in a similar problem (big thanks to salamanderanagram and herw).

    i attached the image of where to put it and the core cell itself.

    this breaks the connection between the count buttons seperator and the counter up input when a global reset event is received.
     

    Attached Files:

  7. Tun

    Tun NI Product Owner

    Messages:
    224
    i just realised i accidentally kept some of the changes i made to your setup. you can use your original setup and the breaker should work the same if placed just before the up input.
     
  8. CC4

    CC4 NI Product Owner

    Messages:
    167
    It was closer though,Tun. This variation appears to be working:

    ThisWorks.JPG
     
  9. CC4

    CC4 NI Product Owner

    Messages:
    167
    Ha. You responded at the same time. ...But yeah, thanks for your help.
     
  10. Tun

    Tun NI Product Owner

    Messages:
    224
    thats odd. that shouldnt work :/ the event will still be sent on a global reset. i just tested it and it didnt work here. maybe ive got something set up differently.
     
  11. herw

    herw NI Product Owner

    Messages:
    6,421
    no global reset.jpg

    ciao herw

    PS: if you want to learn core then use this ;)
    learning core.jpg
     
  12. CC4

    CC4 NI Product Owner

    Messages:
    167
    Yeah; I discovered that after I implemented it. My first example increased the counter with the press of every switch which was a major problem. When the switch is pressed in this version it resets the counter to 2.
     
  13. CC4

    CC4 NI Product Owner

    Messages:
    167
    Let me try that out. I've done some work in core, but there are certain elements that hurt my brain. That was of course several years ago so maybe I should flip through the core manual again and see if I comprehend more of it now.
     
  14. Tun

    Tun NI Product Owner

    Messages:
    224
    you mean in the version i replied with? it works fine here. i just rebuilt it to make sure.
    it shouldnt because it is reading the value of the reset button in its current state, which is off (1), which is routed straight to the seperators hi output and ends there.

    however, i would recommend herws version. its very simple, tidy and efficient.
     
  15. CC4

    CC4 NI Product Owner

    Messages:
    167
    Oh, no. I originally didn't see your other response. This structure resulted in the 2 in the reset column:
    ThisWorks.JPG

    I tried your last recommendation as well as herw's and both are working fine in that simple structure. When I place it in this larger project I'm working on, switches are still causing the counter to add another value so I am assuming I have another problem to track down somewhere.
     
  16. Tun

    Tun NI Product Owner

    Messages:
    224
    i dont mind having a look at the whole thing if you want. maybe i can help find a solution.
     
  17. CC4

    CC4 NI Product Owner

    Messages:
    167
    Thanks, but believe it or not... I think I found it. It was an "unnecessary" Order module. It's placement seemed to make sense when I was in the building process, but deleting it and reconnecting the wires solved all my problems.
     
  18. Tun

    Tun NI Product Owner

    Messages:
    224
    glad you fixed it