how to turn high a slave's port pin RA0 as a result of master's command through ethernet tcp/ip?

Submitted by omer on Sun, 11/08/2020 - 18:37

I'm new to microcontrollers and I am trying to figure out how to send a command from a master uC in order to output a logical '1' at the slave's port pin through ethernet interface.

This kind of MicroController (PIC18F97J60) has an internal ethernet interface and doesn't need an external interface.

I need some guidance as I am new to it.

Is there a simple ethernet tcp/ip code so I can learn from? Or maybe a book that covers that subject?



The following code depicts my general idea , The IF condition should perform only if it gets a data with logical '1' through ethernet TCP IP interface from the master and then it should turn high the RA0 pin.

<pre class="brush: lang">

//The slave MicroController//
#include <xc.h>                        
#include <stdio.h>

//Initialize variables funcion:
void init (){
    TRISA = 0b00000000; //All A pins are outputs
    PORTAbits.RA0 =0; //initializing RA0 to 0
    
}
//main function:   
void main (){
    init ();
    
    while(1){
        if(...){ //If a logcal '1' received from the master through Ethernet TCP/IP then do this:
        
            PORTAbits.RA0 = 1;//Turn the output pin RA0 on
         
        }
        else{ //in any other case , turn the output pin RA0 off
            PORTAbits.RA0 =0;
        
        
        }
    }
    

 

}

</pre>