'nan' value of Max6675 when start W5100 even with Stop W5100 CS(10) Arduino

Hello Dear Users,

I have arduino mega 2560 with Max6675K and W5100 Ethernet shield,
I want to read temperature with max6675 and send to my pc via W5100 and Modbus TCP/IP.
for modbus tcp/ip i use https://forum.arduino.cc/index.php?topic=327333.0
its ok and i can communicate with Modbus Poll and also with Wincc,
For max6675 i use GitHub - adafruit/MAX6675-library: Arduino library for interfacing with MAX6675 thermocouple amplifier
library(I had to change my CS and SO pins because of my max module pins’pictures1&2)
It is ok and i can read ambient temperature
But when i use both Max and W5100 in my program,
i have communication but I read temperature ‘nan’,
I read post http://forum.arduino.cc/index.php?topic=130710.30 and related post several times ,
and i did all proposed tests,I disable W5100 pin(digitalWrite(10, HIGH)) But ist not working
Even I changed SPI clock…not working too
I am working for 3 days with no lucky…
I am sure the problem is ethernet library… “Ethernet.begin(mac, ip)”
It must be disable when i use pin(digitalWrite(10, HIGH)) …
Could somebody check my code?
Please download all needed library,code an pictures in below links:
File upload and sharing. Large file transfers. Free online cloud storage.

My_Code.ino (2.36 KB)

IO_Modbus.ino (1.42 KB)

Don't use the hardware SPI pins with the max6675 library as this library doesn't use the hardware interface but does bitbang using the GPIO functionality. Just use completely different pins for the temperature sensor and it should work.

Dear pylon

Thank you for your answer,
I search for bitbang Library for Max6675,but no properly library founded
Do you know any library?

Do you know any library?

No, but changing that one is not that hard. Just initialize the hardware, set the correct mode and speed and use the hardware library methods instead of the bitbanging emulations they use.

... or change the pins as I already wrote.