ENC28J60 Arduino Mega

Hello everyone
I’m using ENC28J60 to dump data to local server on my computer.
When plug internet cable from my router to ENC28J60 and connect my computer to WIFI it works fine.Then when i use crossover cable to connect directly ENC28J60 to my computer it won’t work.
I’m using XAMPP server.I’m dumping data using dbconnect.php and add_data.php which is included in attachment and also i attached ino file.
Any suggestions? Thank you.

  • .php files prohibited in forum so uploaded them in .txt file.

php files.txt (632 Bytes)

sketch_nov14b.ino (5.91 KB)

What IP address is the PC using on the Ethernet connection? Typically a PC will use DHCP to request an IP address for the interface. I think you will have to manually assign an IP address on that interface since I suspect your Arduino is not providing a DHCP server.

The same is true for the Arduino: the posted code expects a DHCP to be running. Your router obviously provides one but it seems your PC doesn't. So probably both parties don't have an IP set up so no communication is possible.

So how to do i set up DHCP on my PC? Can you tell me about this.By the way thanks for suggestions.

So how to do i set up DHCP on my PC? Can you tell me about this.By the way thanks for suggestions.

By installing a DHCP server on your PC and configuring it correctly. This is an easy task on a Linux machine but rather complicated on a Windows machine, which I guess you're using. On Windows this is usually beyond the capabilities of the average user, so I don't recommend you to actually do this.

What are you trying to achieve? Why is the solution with the router involved not viable for you?

Perhaps it would work if you turn on Internet Sharing on the Ethernet interface. Might be as simple as a checkbox in your internet settings.