09-02-2008 01:01 PM
Hey,
I am trying to write a 4, 2, 1 stepping algorithm. Its for a temperature sensation test. The way the algorithm works is that there is an initial temp, 30C, which will be increased by increments of 4 degrees until the user cannot feel the sensation anymore. They indicate sensation by hitting the OK button, which has a latch when pressed mechanical action. Then, when they indicate that they can't, an alternate OK button, the increments move in the opposite direction and shorten by 2, and then again by 1. I was wondering how I could make an array which remembers the past inputs and switches increments when there is a change in boolean inputs. I was considering shift registers and when the past iteration no longer matches the current input, to make send a signal to change increments, but I cannot seem to get it to work.
Another question I have is how to write to an array/matrix/spreadsheet, which updates the reponse while keeping the past inputs. For example, the previous string was 0 0 0 0 and current input is true=1, so array now is 0 0 0 0 1 instead of just displaying 1 or having to wait till the end of the loop to see all of the answers.
Thanks,
remotecntrl
09-02-2008 01:28 PM
Hi remotecntrl,
can you show what you have done so far? To use shiftregisters is a good solution. You can also store the last shown string "0 0 0 0" there and add "1" in the next iteration. But with a better overview there is maybe another solution for you.
Mike
09-02-2008 02:15 PM
I haven't gotten anything up and running quite yet. But I will describe what I have done and what my problem is.
What I have:
A shift register which has a true constant on the outside of the loop and a toggle inside which is connected to a T/F case structure which feeds to a numeric indicator. Inside the case structure, true = 1, false = 0.
What I want:
I want to compare the past iteration with the current one. I am thinking something along the lines of comparing i to i -1. If they are equal than nothing changes, if they are not, then they change the step amount by half.
Any subVIs you can point me to? I am not familiar with all of them yet.
Thanks,
Katie
09-02-2008 02:23 PM
Hi Katie,
you can use the example finder. Search for "loops", there you can find some examples about how to use shiftregisters. You write the current value to the right part of the shiftregister and you can read the last value on the left part of the shiftregister. Try it.
See also the free online courses at ni.com.
Hope it helps.
Mike