Ether I/O 24 Users Manual V1.3
Elexol Pty Ltd Version 1.3
Page 35
http://www.elexol.com
E L E
X O L
E L E C T R O N I C
S O L U T I O N S
These commands can be used to configure the module as described in the Advanced Programming section
or to read and write the User data area in the EEPROM memory.
Advanced Programming
This section will cover the several features of the module that require the EEPROM to be programmed for
them to operate.
Programming the module to have a fixed IP address
Having a fixed IP address is ideally suited to industrial control and is essential when using the module with
a router and a routing table.
To calculate the values to write to the Fixed IP words take the IP address you wish to use and split it into 2
halves, the first half contains bytes 1 and 2 and the second half contains 3 and 4.
Lets say we want to use a Fixed IP address for the module of 10.0.0.100, the 10.0 become the word at
address 6 and the value at word address 7. Conveniently the IP address is already split into byte values so
we can use these directly in our programming function to program the EEPROM.
To Program the first Word of our IP address into the EEPROM we simply take our IP address and use the
first byte as the LSB of our programming command and the second byte as the MSB of our programming
command. Thus our commands to program the EEPROM look like this.
Winsock1.SendData “‘W” + Chr$(6) + Chr$(0) + Chr$(10)
EEPROM Write Command
Address
MSB
LSB
Winsock1.SendData “‘W” + Chr$(7) + Chr$(100) + Chr$(0)
EEPROM Write Command
Address
MSB
LSB
Keep in mind that to program this to our EEPROM we must have sent the Write Enable command to the
module first and ensure that the J2 jumper link is not placed.
To then enable the Fixed IP function we have to write to word 5 with bit 0 of the LSB as a zero.
It is recommended to read the EEPROM value at Address 5, ensure that bit-0 is cleared and then write this
value back to the EEPROM.
Please refer to the EEPROM read and write examples in the previous section for example code.
Programming the module’s ports default power up state
At power up or reset the module will read it’s EEPROM memory, if bit 1 in EEPROM address five is
cleared then it will read the EEPROM memory addresses from 8 to 15 and write these values to the Port
Registers. By writing to the appropriate addresses in EEPROM memory it is possible to have any port set to
any state by default. The ports are set up by the EEPROM settings the same as by the commands sent from
the host.
For Example, let’s say we want Port A to power up as all Inputs and Port B to power up as all outputs with
lines 1 to 4 at low and the other lines at high. We would need to ensure that the Port A Direction register
was all high and the Port B direction register was all low bits, then set the Port B value register as
appropriate for the desired output.