141 of 172
ZBasic Language Reference 134 ZX Microcontroller Family Pin 19, Port A Bit 1 and Port B Bit 3 In addition to being a general digital input or output pin this pin may be used for analog input to the analog-to-digital converter. An alternate use for this pin is as the analog comparator input AIN1. See the Atmel documentation for the AIN1 input for more details. Pins 20, Port A Bit 0 In addition to being general a digital input or output pin, this pin may be used for analog input to the analog-to-digital converter. The analog voltage may be read using the GetADC() routine. Pin 21, Regulated Voltage In or Regulated Voltage Out If the on-board regulator is being used (power being fed to pin 24) this pin will output a regulated voltage of about +5 volts. The capacity of the on-board regulator is approximately 100mA. About 60mA of this capacity is used by the on-board devices with all pins in the input state. If any of the pins are outputs, the source current of each output pin must be added to this usage. The balance of the regulator’s capacity (very little, in most cases) may be used by external circuitry. Except for the simplest configurations, it is advisable not to use the on-board regulator and, instead, supply a regulated voltage of 4.5 to 5.5 volts to pin 21. In this case, no connection should be made to pin 24. Pin 22, Reset You may apply an active low signal to this pin to reset the processor. Note, however, that the on-board reset circuitry will also pull this line low via an open collector output each time the ATN input makes a positive transition (notably during downloading). If you don’t want your external circuitry to receive this reset signal, you must isolate the on-board reset from external devices using a diode, a transistor or an open collector gate. An example circuit is shown in Section B.1. Pin 23, Ground This pin, common with pin 4, serves as the reference for the power supply and all I/O pins. Pin 24, Unregulated Voltage In To use the on-board regulator, you may supply an unregulated (but filtered) voltage source from 7 to 20 volts DC to this pin. The power supply must be capable of supplying at least 150mA. See the description of pin 21 for more information about the on-board regulator and the limitations of using it. It is important to note that the maximum input voltage must be derated above an ambient temperature of 45°C according to the formula V in <= 5 + (125 – T amb ) / 5.2. For example, with an ambient temperature of 75°C the input voltage must be kept below 14.6V. For operating in high ambient temperatures it is recommended to use an external regulator with an appropriate heatsink. Additional Notes: Each of the I/O pins (5-20, 25-27) can source 20mA or sink 40mA (at Vcc=5V). However, the total source current and the total sink current for all pins may not exceed 200mA. This is further limited by the capacity of the on-board regulator if it is being used. At Vcc=3V, the maximum source and sink currents are one-half of the 5V rating. All of the I/O pins (5-20, 25-27) have protection diodes built in. If the signals that you connect to these pins go above V+ or below ground, you must include a current limiting resistor to keep the pin current below 20mA.