beautypg.com

Digilent ServoMini User Manual

Page 3

background image

Digilent, Inc.

Digilent ServoMini Board Reference Manual

www.digilentinc.com

www.digilentinc.com

3

Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.

Two-Wire Serial Interface

The Atmel TWI interface is a medium speed
(400 Kbps), synchronous, serial,
communications bus. The TWI interface
supports master or slave operation with up to
128 devices on the bus. Each device is given
a unique address, and the protocol has the
ability to address packets to a specific device
or to broadcast packets to all devices on the
bus. For detailed information on configuring
and using the two-wire interface, see the
ATmega168 data sheet at

www.atmel.com

.


The ServoMini connects to a TWI bus through
the 2-pin connector, J9 and J10. Attaching
these pins to a shared communications bus
can create a daisy chain of ServoMinis or other
TWI-capable boards.

The TWI bus is an open-collector bus.
Devices on the bus actively drive the signals
low. When no device is driving the lines low,
pull-up resistors achieve the high state on the
TWI lines. A single device on the TWI bus
must provide the pull-up resistors.

The ServoMini provides pull-up resistors that
are controlled by software. I/O port B, bits 6
and 7 (PB6 and PB7), are connected to the
pull-up resistors. To enable the pull-ups,
configure these pins as outputs and set the I/O
port output bits to “1”. To disable the pull-ups,
configure these pins as inputs with the internal
pull-ups disabled. Both TWI pull-ups should be
enabled or disabled together. Only one device
on the TWI bus should have pull-ups enabled.

A port bit is configured as an input or an output
by setting the corresponding bit in the DDR
register. The pin becomes an output by writing
a “1” and an input by writing a “0”. When a pin
is configured as an input, an internal pull-up
resistor is enabled by writing the corresponding
output port bit to “1” and disabled by writing it
to “0”. See the Atmel ATmega168 data sheet
for more information.

On-Board User I/O

The ServoMini provides three on-board LEDs
for user output. LEDs LD1 through LD3 are
connected to PB0, PB1 and PD3 respectively.
An LED is turned on by writing the pin to logic
1 and turned off by writing the pin to logic 0.