Welcome! Log In Create A New Profile

Advanced

TTL polarity settings?

Posted by molamola 
TTL polarity settings?
January 25, 2022 05:23AM
Hi,

I'm currently trying to turn on buzzers in a trial using TTL outputs.
I've assigned TTL 1 and 2 to the corresponding digital lines.
The problem is that we are using a relay system connected to the NI board, and the relay is triggered by the voltage sink from the NI output.
So when I run the I/O test and click and release on the TTL buttons, the buzzers are turned on, but it only will turn off when I hold the TTL button down (because 5V -> 0V on the assigned digital line).
Our reward system uses the same relay, and since MonkeyLogic lets us set the reward device to be triggered on a TTL low, it works fine. When we want to deliver the reward, the digital line assigned to Reward will be turned from 5V to 0V, and the reward device is successfully turned on by the relay system.
However, I couldn't find a similar process of setting the trigger polarity for TTL outputs. I've tried to turn off the TTL outputs using toggleobject when I want to turn on the buzzer, but it doesn't seem to do anything. The voltage at the digital line doesn’t change from 5V to 0V.
When I put in "toggleobject(2,'status','on');" instead, MATLAB displays an error message, saying that “Array indices must be positive integers or logical values.”, as "ml_new_on_TTL" is NaN, at “ml_device=[DAQ.TTL{ml_new_on_TTL}];”

So I was wondering if there would be any way to set the trigger polarity for TTL outputs, or if there would be anyway to circumvent this issue using my setup. Any suggestions would be of great help.

Thank you.
Re: TTL polarity settings?
January 26, 2022 06:18PM
The error message is due to a mistake that I made two versions ago. Since it disables all TTL outputs, those who downloaded 2.2.22 or 2.2.23 (also 2.2.24 before seeing this message) must update again. Sorry for the inconvenience.

The TTL output going only HI was just the way that it worked since the original ML, although I always wanted to change it. Now you can send out inverted TTLs. To do it, double-click the TTL that you want to invert on the I/O menu. The name of an assigned TTL is curly braced. If you double-click it, they will toggle between a tilded state and a just curly braced state. When it is tilded, the output will be HI initially and go LO when turned on.

Attachments:
open | download - inverted_TTL.png (1.6 KB)
Re: TTL polarity settings?
January 27, 2022 03:53AM
Hi Jaewon,

I just tested the new version, and the inverted TTL outputs work fine during the task!
I've also tried the I/O test with the new setting, and it works fine except for one thing. The buzzers are turned on when I press on the TTL buttons on the I/O test window and turn off when I release them. But when I quit the test (either by closing the window or pressing esc), the buzzers are turned on again. Since this is not a problem for running tasks, it's a minor detail, but I wanted to let you know just in case.

Thanks for everything!
Re: TTL polarity settings?
January 27, 2022 10:14AM
Thanks for the feedback. It is fixed. Please download the package again.
Re: TTL polarity settings?
March 25, 2022 06:06AM
Hi Jaewon,

It seems like there's an issue with the reversed TTL polarity setting when I use them during the task.
Turning on the buzzers works fine, but they won't turn off. I am using toggleobject for turning on and off the buzzers, with idle between them.
The buzzers just remain turned on until ITI.
I didn't notice this before because I used to turn on the buzzers right before ITI, but recently I've been trying the use the buzzers during the task.
I've tested my code on another setting where I don't have to reverse the TTL polarity and it works fine, so I don't think the issue is in my task code.
I was wondering if you could address this issue.

Thank you!
Re: TTL polarity settings?
March 25, 2022 12:31PM
Please download the package again. It seems that I did not patch all affected codes previously.
Re: TTL polarity settings?
March 29, 2022 03:59AM
Hi Jaewon,

Thanks for your fast update.
I just tried out the new version and it works smoothly!
I will let you know if anything else comes up.

Thank you again!

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.