User manual

36/48 myEthernet Technische Beschreibung / technical description
www.myAVR.de © Laser & Co. Solutions GmbH – 06/2009 www.myAVR.com
5.4 Externe Schnittstelle - TWI
Die Aktivierung dieser TWI Funktionalität erfolgt über die
config.cfg. Die TWI-Adresse des myEthernets ist frei
wählbar (beachte bit0=0), Standard ist 0xB0.
Einträge in der config.cfg:
twiMode=m24c
Dieser Eintrag aktiviert den TWI-Bus an Pin16
und Pin17. Diese Pins stehen damit nicht mehr
für andere Funktionen zur Verfügung, ausge-
nommen TWI-Geräte wie LM75.
twiAdr=<twiSlaveAdresse>
Mit diesem optionalen Eintrag wird die TWI-
Adresse festgelegt, auf die das myEthernet rea-
gieren soll. Die Standard-Adresse ist 0xB0.
Wählen Sie eine eindeutige Adresse, die nicht
0x00 ist und die geradzahlig ist (Bit0=0). Adres-
sen im Format 0b1111xxx0 sollten für spätere
Entwicklungen Reserviert bleiben.
Beispiel:
twiMode=m24c
twiAddr=0xB0
Das Protokoll im Mode "m24c" ist ähnlich dem der
M24Cxx - EEPROMs. Der interne Adresszeiger wird im-
mer automatisch erhöht. Das erste Byte nach dem Ver-
bindungsaufbau mit "Schreiben" ist der neue Adresszei-
ger.
Ist im Adresszeiger das Bit7 = 1 wird auf den EEPROM
zugegriffen, ist Bit7 = 0 wird auf den RAM zugegriffen.
Daraus folgt, dass maximal 128 Byte RAM und 128 Byte
EEPROM auf diese Weise angesprochen werden kön-
nen.
Lesen von Daten:
ima, sta, sla <twiAdr> w, wr <adr>,
sta, sla <twiAdr> r, rda <count>, sto,
end
Schreiben von Daten
ima, sta, sla <twiAdr> w, wr <adr>,
wr <data>, sto, end
Abkürzungen:
o ima = InitMaster
o sta = TwiStart
o sla = Schreibe TwiSlave Adresse + Read /
Write
o wr = Schreiben
o rda = Lesen mit AutoAcknowledge
o sto = TwiStop
o end = TwiDeinit
o <twiAdr> = TWI-Adresse des myEthernet
z. B. 0xB0
o <adr> = Adresse im RAM / EEPROM
o <count> = Anzahl der zu lesenden Bytes
o <data> = zu schreibende Bytes
5.4 External interfaces - TWI
The activation of this TWI functionality happens via the
config.cfg. The TWI address of the myEthernet is freely
selectable (pay attention bit0=0), standard is 0xB0.
Entry in the config.cfg:
twiMode=m24c
This entry activates the TWI bus on pin 16
and 17. This pins are not available for other
functions, except TWI units like LM75.
twiAdr=<twiSlaveAdresse>
With this optional entry the TWI address will
be configured to which the myEthernet react.
The standard address is 0xB0.
Choose a clear address which is not 0x00
and which is even-numbered (bit0=0). All
addresses of the format 1111 xxx should be
reserved for future purposes.
Example:
twiMode=m24c
twiAddr=0xB0
The protocol in the mode „m24c“ is analogue to the
M24Cxx of the EEPROMs. The internal address pointer
is automatically increased. The first byte after the link
connection with “writing” is the new address pointer.
Is in the address pointer the bit7=1 then the eeprom is
accessed, is bit7=0 then the RAM is accessed. From
this it follows that you can respond 128 byte RAM
maximum and 128 byte eeprom maximum in this way.
Reading of data:
ima, sta, sla <twiAdr> w, wr <adr>,
sta, sla <twiAdr> r, rda <count>,
sto, end
Writing of data:
ima, sta, sla <twiAdr> w, wr <adr>,
wr <data>, sto, end
Abbreviations:
o ima = InitMaster
o sta = TwiStart
o sla = write TwiSlave address + read / write
o wr = writing
o rda = reading with AutoAcknowledge
o sto = TwiStop
o end = TwiDeinit
o <twiAdr> = TWI-address of the myEthernet
e.g. 0xB0
o <adr> = address in the RAM / EEPROM
o <count> = number of reading bytes
o <data> = writing bytes