ENC28J60 vs WIZnet w5100 simple server code difference ?

Hello
what changes I have to make for this WIZnet w5100 chip code in order to do the exact same work but with ENC28J60 chip ?
by exact same I mean every small detail and the most important thing that I want it to be a server using mac only to start (without any ip or gateway) can ENC28J60 do this ? see the code below

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
EthernetServer server(80); //server port
 
int readString;
 
//////////////////////
 
void setup(){
 
  pinMode(4, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac);
  server.begin();
    Serial.begin(9600);
  Serial.println("server LED test 1.0"); // so I can keep track of what is loaded
}
 
void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        readString = client.read();
           //Serial.print(c);
        }
 
        //if HTTP request has ended
         Serial.println(readString); //print to serial monitor for debuging
 
          //stopping client
          client.stop();
          ///////////////////// control arduino pin
          if(readString ==something)//checks for on
          {
            digitalWrite(4, HIGH);    // set pin 4 high
                    }
          else{
            (readString ==something else)//checks for off
            ;digitalWrite(4, LOW);    // set pin 4 high
                      }
                    //clearing string for next read
          readString=0;
 
        }
      }
    }

up

I want it to be a server using mac only to start

That's not what your current wiznet code does. Behind your "server.begin" is ARP, IP, TCP, and other stuff that is hidden from you, but nevertheless THERE. To get similar code to work on the ENC28J60-based network, you have to have a library that implements all of those protocols (they are implemented in hardware on the WizNet chip.)

(actually, I don't think the Wiznet code will work as shown, because it doesn't specify or acquire an IP address. In that sense (ie "it doesn't do anything"), it should be easy to duplicate with the Microchip ethernet controller. :slight_smile: )

westfw:

I want it to be a server using mac only to start

That's not what your current wiznet code does. Behind your "server.begin" is ARP, IP, TCP, and other stuff that is hidden from you, but nevertheless THERE. To get similar code to work on the ENC28J60-based network, you have to have a library that implements all of those protocols (they are implemented in hardware on the WizNet chip.)

(actually, I don't think the Wiznet code will work as shown, because it doesn't specify or acquire an IP address. In that sense (ie "it doesn't do anything"), it should be easy to duplicate with the Microchip ethernet controller. :slight_smile: )

Thanks for reply, yeah of course there is ip, gateway and subnet mask but I don't want to put them in the code specially the gateway because it's dynamic and I don't want to update the code from time to time and the code is working properly without putting them... just by using this Ethernet.begin(mac) it did the same work when using this Ethernet.begin(mac, ip, gateway, subnet); ... so my question is this possible with microchip ENC28J60 chip and its library to work by putting the mac in the code only ? make it to work as a server waiting for clients to control the arduino over internet (the same code above exactly) I don't have this chip so I can't test it ...

what changes I have to make for this WIZnet w5100 chip code in order to do the exact same work but with ENC28J60 chip ?

If you ask that question, then it may not be the project for you.

zoomkat:

what changes I have to make for this WIZnet w5100 chip code in order to do the exact same work but with ENC28J60 chip ?

If you ask that question, then it may not be the project for you.

Ok, thanks for reply