Can I add a force stop condition in a loop

  • #1
i have keithley currnet source that i control with matlab, inside a loop, if i force stop the loop the device continue to output the last current.
my question is can i add if condition that turn of the curent source?
for example
if force stop
fprintf(device, ':OUTP OFF')
end
 

Answers and Replies

  • #2
Drakkith
Staff Emeritus
Science Advisor
21,102
4,933
my question is can i add if condition that turn of the curent source?
I'm not a matlab expert, but one thing you could try is to place a statement at the very end of the loop that sets a variable to true if the loop completes. Then you could check right after the loop to see if the variable was set to true. If not, then the loop was stopped early.
 
  • #3
that not what i meant.
i asked if there is some way to add a condition to my code that identify a force stop (ctr +c) so when i force stop my current supply output is truned off. in a way some
if (force stop\ctr +c)
turn off device
end

my main loop is endless i built some homemaide temperature controler, i am always measuring tne temperature:
while (1)
...
end
 
  • #4
Drakkith
Staff Emeritus
Science Advisor
21,102
4,933
i asked if there is some way to add a condition to my code that identify a force stop (ctr +c)
My mistake. I'm afraid I don't know if that's possible or not, but perhaps someone else here can help you. Good luck!
 

Related Threads on Can I add a force stop condition in a loop

Replies
2
Views
892
Replies
1
Views
979
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
2
Views
4K
Replies
5
Views
13K
  • Last Post
Replies
5
Views
2K
Top