|
ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Inputs and outputs > On/off outputs > Setting up an on/off output > Specifying the effect of activating an on/off output Specifying the effect of activating an on/off output
In briefYou should use buttons on the on/off output's settings page to specify the effect of activating an output. For example, this might be to turn the output ON, it might be to turn it OFF, or it might be to just turn it ON for a short period. DetailsIn general, the effect of activating an on/off output will be to turn it ON. However, there might be situations when you would like the activation to turn the output OFF, or turn it ON but only for a short period. Of course, there's a question here of what turning an on/off output ON actually does - in ANY-maze, this depends on the output device you're using; for example:
Having said all that, many I/O devices include configuration options which can be used to alter the 'active' state of their outputs. Turning an output on or off for a specific durationAs well as being able to turn an output ON or OFF, activating an on/off output can also be set to turn the output ON (or OFF) for just a specified period of time. Effectively, this allows you to pulse an output, and this can be useful if you want to apply a short duration shock, flash a light, make a speaker beep, etc. For example, imagine you want to administer a half-second shock to an animal when a certain situation occurs. In this case, you would simply create an on/off output whose action is to activate your shocker for 0.5s. The value you enter can use any of the units h (hours), min (minutes), s (seconds) or ms (milliseconds). You can mix units, and also specify decimal values. So, for example, the period of one and a half minutes could be entered as '1.5min' or as '1min 30s'. If you don't specify any units, then seconds will be assumed. You can enter any value from 10 milliseconds to 1 hour. Generating a pulse trainAs the name implies, a pulse train is a series of pulses at an output. In this case, the pulses continue while the output is active, as shown in figure 1.
Figure 1. While the on/off output is active, it outputs a series of pulses.
There are two settings you must make if you want to set an on/off output to create a pulse train when active: the frequency and the duty cycle of the pulses. The frequency is simply the frequency of the pulses - for example, if you specify 50Hz then there will be 50 pulses per second, so each one will last 20ms. The duty cycle specifies how long within each pulse's period the output will be high and (by implication) how long it will be low. For example, if you specify a duty cycle of 25% then, in the case where the pulse lasts 20ms, the pulse will be high for 25% of the time and low for 75%, so it will be high for 5ms and low for 15ms - see figure 2.
Figure 2. The frequency you specify defines the period of each pulse (Period = 1/Frequency). The duty cycle defines the proportion of the period that the output is high (H) and the proportion for which it is low (L). In the above figure the duty cycle is 25%, so H is 25% of period and L is 75%.
There are some limitations regarding frequency and duty cycle:
Note that these two limitations mean that a 100Hz pulse train will always have a duty cycle of 50%, no matter what you specify, because the high and low periods will be fixed at the minimum 5ms duration. You can optionally specify that the pulse train should last a certain duration; for example, entering 5s will cause the output to create a pulse train of the specified frequency and duty cycle for 5 seconds, after which the output will automatically become inactive. If you don't specify a duration, then the pulse train will continue until such time as it is explicitly switched off - usually by an action. Accuracy of pulse trainsThe accuracy of the frequency and duty cycle of a pulse train will depend to some extent on the physical device that is being switched. For example, if you are trying to switch mechanical relays, then they will probably not support a frequency of more than a few Hertz (indeed, it would be best not to try to switch a mechanical relay at a high frequency). Solid state relays will switch more quickly and logic outputs, such as the TTL outputs on an ANY-maze interface, will switch very quickly. However, accuracy is not only defined by the speed with which the hardware reacts but also by how the software works. Trying to generate millisecond accurate timing under the Windows operating system is not easy, as Windows does not guarantee that an application will always be running; Windows switches between the applications very quickly, so it may be that at the exact time when a pulse should be switched on or off, ANY-maze might not actually be running. Using an ANY-maze interface, the accuracy of a 50Hz pulse train with a 25% duty cycle was measured as:
To create extremely accurate pulse trains, you should use the ANY-maze Optogenetics interface.
© Copyright 2003-2026 Stoelting Co. All rights reserved ANY-maze help topic T0194 |