Halo guys and gals(if there is some)
I am having a little bit of a problem with my Ethernet connectivity and i hope there is somebody here that can help me.
this is the story…
My company has recently gone into contract with some Japanese fellows and i was requested to build a Protocol converter for a Battery Management System(BMS).
now i have made use of an Arduino Mega, first i used an Uno but it turned out it didnt have enough memory to control 65 li-ion batteries over the canbus network.
ON the Mega i have a Canbus shield that reads and monitors all canbus information from the BMS that is given in an 29 bit extended frame.
The Canbus sytem works just fine. for the first prototype i used a wiznet w5100 shield with the mega and canbus shield to establish an ethernet connection so that the BMS unit can be added onto a network and monitored ofer GPRS. so for my code i wrote the IP address and gateway and all connection information into the code. This system works perfectly, i currently have two prototype units over in Japan that is being tested. For the second prototype i decided to change the Ethernet shield to a much smaller version wiz810mj in order to reduce overall size and i also went ahead and wrote the code to be able to connect to the IP address from your browser so that you can change the ip settings when needed. The arduino mega with the New Ethernet shield(the smaller one) can connect and it is accessible over a browser to change settings but now that i have added this new code into the overall setup with the canbus i cant get connectivity when i change the ip address to the client in japans settings.
When i was testing the prototype in my office i was using the ip address 192.168.0.12, but to connect to the Japanese system i had to make the ip address 192.168.1.12. by doing this i can no longer connect to the ip address over a browser and i also can not ping that ip address from my PC.
The Japanese system uses a Netbiter EC350 gprs modem and thus requiers the ip address to be 192.168.1.12 and this did work on the first prototype with the ip settings hardcoded into the mega code.
What is the significance with that 1 and 0 in the ip code and why would changing it from 0 to a 1 cause my system not to ping. My PC network runs with that specific number being 0 but obviously this wount work with the Netbiter EC350 system. Is there anybody here with alot of ethernet experience that can help me understand why my pc can conect to the prototype using 192.168.0.12 but the netbiter ec350 system can not connect to 192.168.1.12 , i have tried changing the DNS server and gateway addresses but nothing is making a change, The hardware is working perfectly this i know and the original coded software is working perfectly as well. It is just this simple change of IP address that is causing it not to work that i do not understand why.
Here is the new ethernet connection code that gives you the access over a web browser to be able to change ip settings. You will see on this code the ip is set to 192.168.0.117 and this also works fine, but when i change that ‘0’ to a ‘1’ then the system no longer works.
#include <SPI.h>
#include <Ethernet.h>
#include <TextFinder.h>
#include <EEPROM.h>
#include <avr/pgmspace.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte ip[] = {192,168,0,117};
byte subnet[] = {255,255,255,0};
byte gateway[] = {192,168,0,100};
byte dnsserver[] = {192,168,0,100};
EthernetServer server(80);
char buffer[100];
const char htmlx0[] PROGMEM = "<html><title>Arduino Ethernet Setup Page</title><body marginwidth=\"0\" marginheight=\"0\" ";
const char htmlx1[] PROGMEM = "leftmargin=\"0\" style=\"margin: 0; padding: 0;\"><table bgcolor=\"#999999\" border";
const char htmlx2[] PROGMEM = "=\"0\" width=\"100%\" cellpadding=\"1\" style=\"font-family:Verdana;color:#fff";
const char htmlx3[] PROGMEM = "fff;font-size:12px;\"><tr><td>  Arduino Ethernet Setup Page</td></tr></table>
";
const char * const string_table0[] PROGMEM = {htmlx0, htmlx1, htmlx2, htmlx3};
const char htmla0[] PROGMEM = "<script>function hex2num (s_hex) {eval(\"var n_num=0X\" + s_hex);return n_num;}";
const char htmla1[] PROGMEM = "</script><table><form><input type=\"hidden\" name=\"SBM\" value=\"1\"><tr><td>MAC:";
const char htmla2[] PROGMEM = "<input id=\"T1\" type=\"text\" size=\"2\" maxlength=\"2\" name=\"DT1\" value=\"";
const char htmla3[] PROGMEM = "\">.<input id=\"T3\" type=\"text\" size=\"2\" maxlength=\"2\" name=\"DT2\" value=\"";
const char htmla4[] PROGMEM = "\">.<input id=\"T5\" type=\"text\" size=\"2\" maxlength=\"2\" name=\"DT3\" value=\"";
const char htmla5[] PROGMEM = "\">.<input id=\"T7\" type=\"text\" size=\"2\" maxlength=\"2\" name=\"DT4\" value=\"";
const char htmla6[] PROGMEM = "\">.<input id=\"T9\" type=\"text\" size=\"2\" maxlength=\"2\" name=\"DT5\" value=\"";
const char htmla7[] PROGMEM = "\">.<input id=\"T11\" type=\"text\" size=\"2\" maxlength=\"2\" name=\"DT6\" value=\"";
const char * const string_table1[] PROGMEM = {htmla0, htmla1, htmla2, htmla3, htmla4, htmla5, htmla6, htmla7};
const char htmlb0[] PROGMEM = "\"><input id=\"T2\" type=\"hidden\" name=\"DT1\"><input id=\"T4\" type=\"hidden\" name=\"DT2";
const char htmlb1[] PROGMEM = "\"><input id=\"T6\" type=\"hidden\" name=\"DT3\"><input id=\"T8\" type=\"hidden\" name=\"DT4";
const char htmlb2[] PROGMEM = "\"><input id=\"T10\" type=\"hidden\" name=\"DT5\"><input id=\"T12\" type=\"hidden\" name=\"D";
const char htmlb3[] PROGMEM = "T6\"></td></tr><tr><td>IP: <input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT7\" value=\"";
const char htmlb4[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT8\" value=\"";
const char htmlb5[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT9\" value=\"";
const char htmlb6[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT10\" value=\"";
const char * const string_table2[] PROGMEM = {htmlb0, htmlb1, htmlb2, htmlb3, htmlb4, htmlb5, htmlb6};
const char htmlc0[] PROGMEM = "\"></td></tr><tr><td>MASK: <input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT11\" value=\"";
const char htmlc1[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT12\" value=\"";
const char htmlc2[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT13\" value=\"";
const char htmlc3[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT14\" value=\"";
const char * const string_table3[] PROGMEM = {htmlc0, htmlc1, htmlc2, htmlc3};
const char htmld0[] PROGMEM = "\"></td></tr><tr><td>GW: <input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT15\" value=\"";
const char htmld1[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT16\" value=\"";
const char htmld2[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT17\" value=\"";
const char htmld3[] PROGMEM = "\">.<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"DT18\" value=\"";
const char htmld4[] PROGMEM = "\"></td></tr><tr><td>
</td></tr><tr><td><input id=\"button1\"type=\"submit\" value=\"SUBMIT\" ";
const char htmld5[] PROGMEM = "></td></tr></form></table></body></html>";
const char * const string_table4[] PROGMEM = {htmld0, htmld1, htmld2, htmld3, htmld4, htmld5};
const char htmle0[] PROGMEM = "Onclick=\"document.getElementById('T2').value ";
const char htmle1[] PROGMEM = "= hex2num(document.getElementById('T1').value);";
const char htmle2[] PROGMEM = "document.getElementById('T4').value = hex2num(document.getElementById('T3').value);";
const char htmle3[] PROGMEM = "document.getElementById('T6').value = hex2num(document.getElementById('T5').value);";
const char htmle4[] PROGMEM = "document.getElementById('T8').value = hex2num(document.getElementById('T7').value);";
const char htmle5[] PROGMEM = "document.getElementById('T10').value = hex2num(document.getElementById('T9').value);";
const char htmle6[] PROGMEM = "document.getElementById('T12').value = hex2num(document.getElementById('T11').value);\"";
const char * const string_table5[] PROGMEM = {htmle0, htmle1, htmle2, htmle3, htmle4, htmle5, htmle6};
const byte ID = 0x92;