Telegesis (UK) Limited
TG-ETRXn-UG-01-103
24
User Guide
1.04
ETRX1 and ETRX2
©2008 Telegesis (UK) Ltd
ETRXn User Guide (Rev 1.04)
measurement. Setting this bit disables the port functionality of I/O0. Bit 7 connects A/D3 output to
pin I/O8.
On the ETRX1 setting bit E changes the format in which the A/D readings are represented in the
corresponding registers, from millivolts to the 10 bit reading of the actual A/D registers.
S2F to S32
These registers define the operation of the special function pin as described in section 6 of this
document.
S33
This register provides the supply voltage in millivolts. This can be used to remotely monitor the
battery voltage of a module.
6 Specialised I/O
6.1 Tone Generation at Pin I/O3
Instead of acting like a normal I/O, I/O3 can drive a PWM signal or a variable-frequency signal, for
example t
o play a tune on a beeper (as with the devboard using “AT+IDENT”) or to control a
dimmer. To set up the signal use the following registers:
S0F: bit 3 = 1 to set I/O direction to output (default)
S2E: set bit F to enable special function pin
S2F: controls variable-frequency signal (volatile)
S30: Initial Value of S2F (non-volatile)
S31:
also controls variable-frequency signal (volatile / ETRX2 only)
S32:
Initial Value of S31 (non-volatile / ETRX2 only)
6.1.1 ETRX1 Settings
Full details of the variable-frequency signal generator can be found in the Atmega128L datasheet
on the Atmel
®
website. At the instant the special function pin is enabled (S2E bit F is set), or after
reset (if the special function pin is enabled), the first byte of S30 is written to the OCR2 register of
the Atmega128L and the second byte of S30 to its TCCR2 register.
Register S2F allows direct access to the OCR2 and TCCR2 registers if the special function pin is
enabled.
The Output Compare Register OCR2 contains a constant 8-bit number against which a counter
value is compared. When the values match,
the module‟s output pin can be made to toggle. The
toggling rate is set by the value of OCR2 and the clock rate of the counter, which can be reduced
from the system‟s 8MHz by a prescaler. Several counting modes are available including PWM
output; here we describe all that is necessary for a simple tone generator.
The contents of Timer/Counter Control Register TCCR2 are shown in Table 4, the last row giving
suggested values for a simple tone.