169 of 208
ZBasic Language Reference 161 ZX Microcontroller Family Pins 7-10, Port C Bits 5-2 (ATmega) These pins may be used as general inputs or outputs. Pin 11, Port C Bit 1 and Port D bit 3 (ATmega) In addition to being a general input or output pin, on an ATmega a signal may be applied to this pin to serve as external Interrupt 1. Port C Bit 1 must be an input for this to work properly. Alternately, if no external signal is connected, Port C Bit 1 may be an output and serve as the source for the interrupt. Additionally, this pin serves as the SDA line when using I2C channel 0. Pin 12, Port C Bit 0 and Port D bit 6 (ATmega) In addition to being a general input or output pin, a signal may be applied to this pin to serve as the input for the InputCapture() routine. Port C Bit 0 must be an input for this to work properly. Additionally, this pin serves as the SCL line when using I2C channel 0. Pins 13-17, Port A Bits 7-3 In addition to being general digital input or output pins, these pins may be used for analog input to the analog-to-digital converter. The analog voltage may be read using the GetADC() routine. Pin 18, Port A Bit 2 and Port B Bit 2 (ATmega) 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. Alternately, on an ATmega a signal may be applied to this pin to serve as external Interrupt 2. Port A Bit 2 must be an input for this to work properly. Moreover, if no external signal is connected, Port A Bit 2 may be an output and serve as the source for the interrupt. A second alternate use for this pin is as the analog comparator input. See the Atmel documentation for the AIN0 input for more details. Pin 19, Port A Bit 1 and Port B Bit 3 (ATmega) 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. On an ATmega 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 (ATmega) or +3.3V (ATxmega). 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 3.6 to 5.5 volts (ATmega) or 2.6 to 3.6V (ATxmega) to pin 21. In this case, no connection should be made to pin 24.