Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Jack_23

Member
Registered:
Posts: 31
Reply with quote  #1 
Hi. in my experiment, I need to give analog signal as 'stm', and in the end of trial, the monkey will be given reward. However, even 'stimulation' and reward are assigned with two different port, this can't work. And an error will be given:

Error using analogoutput/putsample (line 254)
PUTSAMPLE cannot be called while OBJ is running.
...
...


while, in the latest version of ML1, there is no such error.

Please teach me how to solve this problem. Thank you very much.
0
Jack_23

Member
Registered:
Posts: 31
Reply with quote  #2 
While, if I using two DAQ card, and assign 'stimulation' and 'reward' to the ports of two different DAQ card, then there is no such error.
0
Jaewon

Administrator
Registered:
Posts: 648
Reply with quote  #3 
Hi Jack_23,

Although the channel numbers are different, they are not independent. All analog output jobs should start at the same time, because your board has only one DAC.

However, if you give the stimulation every time before triggering reward, you can use them both one by one, which is the trick ML1 does. In fact, ML2 does that, too, but I keep forgetting it when I modify the reward-related code.

The best option is to use digital output for reward. Otherwise, if you decide to skip the stimulation for any reason, the error will occur again.

If you use two boards, each board can be controlled independently, so it can be another option.

If you are sure that the way ML1 works is fine, open reward_function.m from the ML directory and delete Line 99 and 101.

Line 99:                 reward_off(); %#ok<UNRCH>
Line 100:                reward_off();
0
Jack_23

Member
Registered:
Posts: 31
Reply with quote  #4 
Otherwise, if you decide to skip the stimulation for any reason, the error will occur again.
Indeed, in some trials, I need to skip the stimulation. However, If I set the stimulation is 0V, does this also work?
0
Jaewon

Administrator
Registered:
Posts: 648
Reply with quote  #5 
It is not a matter of the output voltage. If you create an STM object, the DAQ device is reserved for the job and cannot be used for another analog output task until it is relieved from the job initially assigned. So, if you decide not to use the stimulation, you need to stop the device. Since toggleobject() does not turn off a TaskObject that is already off, you need to do it manually, like the following.

stop(DAQ.Stimulation{1});  % Stimulation 1

You still need to delete two lines in reward_function.m first, as I wrote above.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.