Olimex Support Forum

Microcontrollers => PIC => Topic started by: cgcallebs on November 19, 2013, 10:39:05 PM

Title: PIC-WEB default IP address
Post by: cgcallebs on November 19, 2013, 10:39:05 PM
Does anyone know what file can be modified to change the default IP address of a PIC-WEB board?
I would like a static address that comes up during power up to 192.168.1.120.
It keeps coming back to 192.168.0.30 and I do not see that address in any of the build files.

Thanks.

OK, further reading has found if DHCP is commented out (TCPIPConfig.h //#define STACK_USE_DHCP_CLIENT         // Dynamic Host Configuration Protocol client for obtaining IP address and other parameters) all works well with the IP Address I want to use in the TCPIP OLIMEX_PIC-WEB.h file
#define MY_DEFAULT_IP_ADDR_BYTE1        (192ul)
#define MY_DEFAULT_IP_ADDR_BYTE2        (168ul)
#define MY_DEFAULT_IP_ADDR_BYTE3        (1ul)
#define MY_DEFAULT_IP_ADDR_BYTE4        (120ul)

Am I on the right track?
Title: Re: PIC-WEB default IP address
Post by: Stanimir5F on November 20, 2013, 09:00:53 AM
Yes, you are on the right track!

But still you don't have to remove the DHCP application and change the IP address by editing the project. You can just disable it at run-time. So the DHCP option will be available (in case you need it in future) but disabled so it doesn't cause you problems for the moment. You can disable it and change the address either from:
0) webpage --> Network Configuration (user: admin; password: Microchip) --> remove the check "Enable DHCP". Also here you can set your static IP address instead of hard-code it inside the header file.
1) using RS. When you reset the board hold the button and release it (holding for more than 4 seconds will return the settings to their default state defined in the header). When you release the button on the terminal will be shown a menu with different options. Option 8 is for the DHCP enable/disable and option 3 is for the address.

Of course it's OK as you did it, but I think it's better to leave DHCP option available in the project but stopped. So in case you have to change the address or DHCP state again in future you can do it without project rebuild and reprogram the board. It's your choice! :)

Stenli, Olimex