Welcome! Log In Create A New Profile

Advanced

Delay Property Issue in TimeCounter and TTLOutput

Posted by younesvalibeigi 
Delay Property Issue in TimeCounter and TTLOutput
February 21, 2025 03:47PM
Hi,
I am trying to add a delay period in the ttl signal as below:

ttl2 = TTLOutput(wth2);
ttl2.Port = 1;  % TTL #1 must be assigned in the I/O menu Now they are all the same port
tc2 = TimeCounter(ttl2);
tc2.Duration =  50; % I changed this from 100 to 50 to make it equal to microstim time
disp(tc2.Duration)
tc2.Delay = delay_microstim2;
sceneStim2 = create_scene(ttl2, [fixation_point sample]);

However, I keep receiving this error:
Unrecognized property 'Delay' for class 'TimeCounter'.

I am using this version: NIMH_MonkeyLogic_2.2.mlappinstall which is the latest version on the site right now.
It seems that TTLOutput has a Delay property, but there is no delay for TimeCounter.

I also tried it this way:
ttl2 = TTLOutput(wth2);
ttl2.Port = 1;  % Assign the TTL port in the I/O menu
ttl2.Delay = delay_microstim2;  % Apply delay here

But got this error instead:
Unrecognized function or variable 'ttl'.

Error in dms_runtime (line 1305)
sceneStim1=create_scene(ttl,[fixation_point,sample]);

Error in run_trial (line 129)
        runtime(MLConfig,TrialRecord,TaskObject,TrialData);

Error in monkeylogic/UIcallback (line 919)
                    result = run_trial(MLConfig,datafile);
 
Error while evaluating UIControl Callback.


Is it possible that you fix this issue or let me know if I am missing someting? I attached my dms.m file in case it migth help you.

Thank you.
Attachments:
open | download - dms.m (14 KB)
Re: Delay Property Issue in TimeCounter and TTLOutput
February 21, 2025 04:04PM
Hi,
Nevermind, I figured it out. It has to be written this way:
ttl1 = TTLOutput(wth2);
ttl1.Port = 1;  % TTL #1 must be assigned in the I/O menu
ttl1.Delay = delay_microstim1;
tc1 = TimeCounter(ttl1);
tc1.Duration = 50; % I changed this from 100 to 50 to make it equal to microstim time
%tc1.Delay = delay_microstim1;
sceneStim1 = create_scene(ttl1, [fixation_point sample]);

and I forgot to put ttl1 in create_scene()
Re: Delay Property Issue in TimeCounter and TTLOutput
February 24, 2025 07:14PM
Both errors are your programming mistakes and have nothing to do with NIMH ML.

You know that your TimeCounter (tc1) is not included in the adapter chain and therefore does not do anything, don't you?
Re: Delay Property Issue in TimeCounter and TTLOutput
February 24, 2025 09:02PM
Hi Jaewon,

Yeah, it seems the code never actually used TimeCounter, but there are still issues with TTLOutput's Duration and Delay. I’ve pointed them out in another thread.

Thanks for your help!

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.