I decided to try it with PIC18F4550 to PIC18F4550 and I went in troubles.
I have tested your Proteus project with PIC16F877A and works fine.
Then I decided to replace PIC16F877A with PIC18F4550.
I have an error and maybe you can take a look and give some hints. The error comes from Slave code.
I made the changing from PIC16F877A to PIC18F4550 in 2 steps.
In the first step I have changed only the Master with PIC18F4550 and the Slave was still PIC16F877A.
Everything worked fine here. In my case the Master only reads from Salve and display the switches result on LEDs.
Here is the screenshots and XC8 code, the Master C code and “pro2.zip” with Proteus + MPLABX full XC8 code for Master and Slave: https://goo.gl/uTijwg
This project works fine.
In the second step I have changed also the Slave with PIC18F4550.
Here is the screenshots and XC8 code, the Master and the Slave C code and “pro3.zip” with Proteus + MPLABX full XC8 code for Master and Slave: https://goo.gl/dnGDMQ
Here I have a problem and for sure comes from Slave XC8 code.
When I compile it says “variable “_z” is not used” and “portion of expression has no effect” where z is used.
Could you please help to debug the problem?