GET / HTTP/1.1
Host: opticaldt.us
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,ru;q=0.6
HTTP/1.1 200 OK
Date: Sun, 13 Jul 2014 21:32:49 GMT
Server: Apache
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Length: 185
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
<html> <head> <meta http-equiv = "Content-Type" content = "text / html; charset = Windows-1251"> <title> W5100 WebServer </ title> </ head> <body> <center> Well, sho, <br> <b> hello World?! </ b> </ center> </ html>
// ===== - W5100 Wiznet ====== // * Ethernet Shield // W5100 //=========================================================== #include <16F77.H> #fuses HS // , #use delay(clock=16M) ) // 16 // – #use rs232(baud=19200, xmit=PIN_A2, rcv=PIN_A3) // RS232 // * CCS « printf» - , // - // ** // PICa Ethernet Shield #define RESET pin_B2 // *active LOW #define MISO pin_B3 // input #define MOSI pin_B5 // output #define SS pin_B0 // output. SlaveSelect, Active LOW #define SCK pin_B1 // output. //********** W5100 ********************* //************************************************************** #define MR 0x0000 // MODE register #define GAR0 0x0001 // GATEWAY Addr register0 (MSB) #define GAR1 0x0002 // GATEWAY Addr register1 #define GAR2 0x0003 // GATEWAY Addr register2 #define GAR3 0x0004 // GATEWAY Addr register3 (LSB) #define SUBR0 0x0005 // SUBNET MASK Addr register0 (MSB) #define SUBR1 0x0006 // SUBNET MASK Addr register1 #define SUBR2 0x0007 // SUBNET MASK Addr register2 #define SUBR3 0x0008 // SUBNET MASK Addr register3 (LSB) // MAC #define SHAR0 0x0009 // SOURCE HARDWARE Addr register0 (MSB) #define SHAR1 0x000A // SOURCE HARDWARE Addr register1 #define SHAR2 0x000B // SOURCE HARDWARE Addr register2 #define SHAR3 0x000C // SOURCE HARDWARE Addr register3 #define SHAR4 0x000D // SOURCE HARDWARE Addr register4 #define SHAR5 0x000E // SOURCE HARDWARE Addr register5 (LSB) #define SIPR0 0x000F // Source IP Addr register0 (MSB) #define SIPR1 0x0010 // Source IP Addr register1 #define SIPR2 0x0011 // Source IP Addr register2 #define SIPR3 0x0012 // Source IP Addr register3 (LSB) #define RMSR 0x001A // RX memory size (1K,2K,4K or 8K per socket, from total 8K) #define TMSR 0x001B // TX memory size (1K,2K,4K or 8K per socket, from total 8K) //-- Socket0 (* ) #define S0_MR 0x0400 // Socket0 MODE register #define S0_CR 0x0401 // Socket0 COMMAND register #define S0_SR 0x0403 // Socket0 STATUS register #define S0_PORT0 0x0404 // Socket0 SOURCE Port register0 (H byte) #define S0_PORT1 0x0405 // Socket0 SOURCE Port register1 (L byte) #define S0_TX_FSR0 0x0420 // Socket0 TX Free SIZE register0 #define S0_TX_FSR1 0x0421 // Socket0 TX Free SIZE register1 #define S0_TX_RD0 0x0422 // Socket0 TX Read POINTER register0 #define S0_TX_RD1 0x0423 // Socket0 TX Read POINTER register1 #define S0_TX_WR0 0x0424 // Socket0 TX Write POINTER register0 #define S0_TX_WR1 0x0425 // Socket0 TX Write POINTER register1 #define S0_RX_RSR0 0x0426 // Socket0 RX Received SIZE register0 (H byte) #define S0_RX_RSR1 0x0427 // Socket0 RX Received SIZE register1 ( L byte) #define S0_RX_RD0 0x0428 // Socket0 RX Read POINTER0 (H byte) #define S0_RX_RD1 0x0429 // Socket0 RX Read POINTER1 (L byte) // ----- ( 0 ) ----- #define OPEN 0x01 #define LISTEN 0x02 #define CONNECT 0x04 #define DISCON 0x08 #define CLOSE 0x10 #define SEND 0x20 #define SEND_MAC 0x21 #define SEND_KEEP 0x02 #define RECV 0x40 // ----- ( STATUS 0 ) --- #define SOCK_CLOSED 0x00 #define SOCK_INIT 0x13 #define SOCK_LISTEN 0x14 #define SOCK_ESTABLISHED 0x17 #define SOCK_CLOSE_WAIT 0x1C // ---------- «» ----------- #define SERVER_IP0 192 // 192.168.0.155 #define SERVER_IP1 168 #define SERVER_IP2 0 #define SERVER_IP3 155 #define SERVER_PORT0 0 // :80 #define SERVER_PORT1 80 #define GATEWAY_IP0 192 // . - #define GATEWAY_IP1 168 #define GATEWAY_IP2 0 #define GATEWAY_IP3 254 #define SUBNET_MASK0 255 // ( ) #define SUBNET_MASK1 255 #define SUBNET_MASK2 255 #define SUBNET_MASK3 0 #define MAC0 0x00 // , , #define MAC1 0x1A // #define MAC2 0x2B #define MAC3 0x3C #define MAC4 0x4D #define MAC5 0x5E //----------- --------------- void SSPI_write(int Data); // 1 W5100 SPI int SSPI_read ( void); // 1 W5100 SPI void SetW5100register (int16 regaddr, int data); // () W5100 SPI int GetW5100register (int16 regaddr); // W5100 SPI void Init (void); // W5100 int Open_Socket0(void); // (/) int Listen_Socket0(void); // (/) int Socket0_Connection_Established (void); // (/) int Socket0_Received_Data_Size (void); // , ( 0 ) void Socket0_Received_Data_Reading (void); // // - int Socket0_FIN_Received(void); // FIN / void Socket0_Disconnect(void); // W5100 int Socket0_Closed(void); // / int Socket0_Connection_Timeout(void); // - / void Socket0_Closing(void); // int Socket0_Received_Request_is_index_html(void); // Index.html // / void Socket0_Send_index_html (void); // «» index.html void Socket0_Send_404_error (void); // «» « 404» //------------ ----------------------------------- int16 S0_RX_BASE; // , RX 0 int16 S0_RX_MASK; // RX 0 int16 S0_RX_OFFSET; // RX int16 S0_RX_Start_Addr; // RX int16 S0_RX_RSR ; // int16 S0_TX_BASE; // , X 0 int16 S0_TX_MASK; // X 0 int16 S0_TX_OFFSET ; // , // int16 S0_TX_Start_Addr; // , // int16 S0_TX_End_Addr; // , W5100 // // --- HTTP «-» // * [222] . // ** CONST – ( ) CONST char INDEX[222] = { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Lenght: 43\r\n\r\n<HTML><CENTER>HELLO WORLD !</CENTER></HTML>"}; // «index.html” CONST char ERROR404[222] = { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Lenght: 39\r\n\r\n<HTML><CENTER>ERROR 404</CENTER></HTML>"}; // « 404” // , // « 404», , ... //CONST char ERROR404[222] = { "HTTP/1.1 404 Page not found\r\nContent-Type: text/html\r\nContent-Lenght: 39\r\n\r\n<HTML><CENTER>ERROR 404</CENTER></HTML>"}; // .. IExplorer HTTP "HTTP/1.1 404 Page not found" // , , int try=0; // , . – //===================== MAIN ============================================ //======================================================================= void main() { Init(); // W5100 ( ) OpenSocket0: //ooooooooooooooooooo 0 oooooooooooooooooooooooo if ( ! Open_Socket0() ) goto OpenSocket0; // //ooooooooooooooooo ooooooooooooooooooooooooo if ( Listen_Socket0() == FALSE ) goto OpenSocket0; // «» - //oooooooooooooo ? oooooooooooooo CheckConnection: // if (Socket0_Connection_Established() == FALSE ) goto CheckConnection; // ( ) printf("> Connection Established... \r\n"); // ( ) //ooooooo( ) - ? oooooo if ( Socket0_Received_Data_Size() == 0 ) { printf("\r\n> (Zero) Received Data size is: %Lu (bytes) \r\n", S0_RX_RSR); // ( ) goto CheckFIN; // // FIN } // ( =0) else { printf("\r\n> (NonZero) Received Data size is: %Lu (bytes) \r\n", S0_RX_RSR); // ( ) } // oooooooooo ( ) * ooooooooooooooo // // Socket0_Received_Data_Reading(); // ( ) // oooooooooooooo ooooooooooooooooooooooooooooooo // HTTP HTML if ( Socket0_Received_Request_is_index_html() == TRUE) Socket0_Send_index_html (); // "index.html" index.html else Socket0_Send_404_error (); // «» « 404» //ooooooooooo FIN ? ooooooooooooooooooooooooooo // CheckFIN: if ( Socket0_FIN_Received() == TRUE) goto CloseConnection; // FIN - 0 //ooooooooooo ooooooooooooooooooooooo Socket0_Disconnect(); // 0 //ooooooooooo ? ooooooooooooooooooooooooooooooo if (Socket0_Closed() == TRUE ) goto CloseConnection; // – //ooooooooooo - ? ooooooooooooooooooo if ( Socket0_Connection_Timeout() == TRUE) goto CloseConnection; // , -, – CloseConnection: //ooooooooooo ooooooooooooooooooooooooooooooooooo Socket0_Closing(); //oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo goto OpenSocket0; // , . // ( «-» ) } //=================== END of MAIN =========================== //============================================================ //--------------------------------------------------------------- //--------------------------INIT ------------------------------- void Init (void) { output_low(RESET); // «» Ethernet delay_ms(1); output_high(RESET); output_low(SCK); // () SPI output_high(SS) ; // W5100. SetW5100register(MR, 0x80); // RST W5100 Mode Register //------------ (W5100) 0 ------------- SetW5100register(RMSR, 0x55); // RX : 2 S0_RX_BASE = 0x6000; // RX 0 S0_RX_MASK = 0x07FF ; // (2048 -1 )= 0x07FF, RX ( = _ – 1 ) SetW5100register(TMSR, 0x55); // X : 2 S0_TX_BASE = 0x4000; // TX 0 S0_TX_MASK = 0x07FF; // (2048 -1 )= 0x07FF, ( = _ – 1 ) //------------ -------------- // .. W5100 // – SetW5100register(SHAR0, MAC0); SetW5100register(SHAR1, MAC1); SetW5100register(SHAR2, MAC2); SetW5100register(SHAR3, MAC3); SetW5100register(SHAR4, MAC4); SetW5100register(SHAR5, MAC5); //------------ IP -------------- // - W5100 – SetW5100register(SIPR0, SERVER_IP0); SetW5100register(SIPR1, SERVER_IP1); SetW5100register(SIPR2, SERVER_IP2); SetW5100register(SIPR3, SERVER_IP3); //------------ PORT -------------- // – – SetW5100register(S0_PORT0, SERVER_PORT0); SetW5100register(S0_PORT1, SERVER_PORT1); //------------ Gateway addr -------------- // – – SetW5100register(GAR0, GATEWAY_IP0); SetW5100register(GAR1, GATEWAY_IP1); SetW5100register(GAR2, GATEWAY_IP2); SetW5100register(GAR3, GATEWAY_IP3); //------------ set Subnet Mask -------------- SetW5100register(SUBR0, SUBNET_MASK0); SetW5100register(SUBR1, SUBNET_MASK1); SetW5100register(SUBR2, SUBNET_MASK2); SetW5100register(SUBR3, SUBNET_MASK3); printf(" \r\n\r\n > =============== W5100 - ==========\r\n\r\n"); // ( ) } //-------------------------------------------------------------- //------------- 0 ---------------------------- int Open_Socket0(void) { // ( ) printf(" \r\n =========== TRY # %u ====================\r\n", try); if (try ==255) try =0; else try++; printf("\r\n> Start Open Socket... \r\n"); // – , SetW5100register(S0_MR, 0x01); // – ( ) SetW5100register(S0_CR, OPEN); // // * , «SOCK_INIT» if (GetW5100register(S0_SR) != SOCK_INIT) // STATUS { SetW5100register(S0_CR, CLOSE); // return FALSE ; // 0 } return TRUE; // . 1 } //-------------------------------------------------------------- //------------- 0 ------------ int Listen_Socket0 (void) { printf("> Sock opened. Go Listen... \r\n"); // ( ) // // * – .. – , SetW5100register(S0_CR, LISTEN); if ( GetW5100register(S0_SR) != SOCK_LISTEN) // { SetW5100register(S0_CR, CLOSE); // return FALSE; // 0 } return TRUE; // , 1 } //-------------------------------------------------------------------------- //------------- 0 ? -------- // * ( ) int Socket0_Connection_Established(void) { // W5100 , // ACK SOCK_ESTABLISHED // (« ) // , // - if ( GetW5100register(S0_SR) == SOCK_ESTABLISHED) return TRUE ; // . // () = «SOCK_ESTABLISHED» 1 else return FALSE; // – 0 printf("> Connection Established... \r\n"); // ( ) // * , / } //---- ------------- //----------------------------------------------------- // * «» // // (, / -) int Socket0_Received_Data_Size (void) // = { S0_RX_RSR = make16 (GetW5100register(S0_RX_RSR0), GetW5100register(S0_RX_RSR1) ); // 8- // RSR0 – , RSR1 – // «» 16- - printf("> Received Data size is: %Lu (bytes) \r\n", S0_RX_RSR); // ( ) if (S0_RX_RSR == 0 ) return FALSE; // ( .. =0 ) // 0 else return TRUE; // ( .. -) // 1 } //---------- --------------- //------------------------------------------------------------ // * . void Socket0_Received_Data_Reading (void) { int16 n; int RXbyte; S0_RX_OFFSET = make16 ( GetW5100register(S0_RX_RD0), GetW5100register(S0_RX_RD1) ); // 8- 16 - // RX 0 printf("> S0_RX_RD (RX mem read pointer) = %LX \r\n", make16 ( GetW5100register(S0_RX_RD0), GetW5100register(S0_RX_RD1) ) ); S0_RX_OFFSET = (S0_RX_OFFSET & S0_RX_MASK ) ; // 0 printf("> S0_RX_Offset = S0_RX_RD & S0_RX_MASK = %LX \r\n\r\n",S0_RX_OFFSET ); S0_RX_Start_Addr = S0_RX_OFFSET + S0_RX_BASE ; // printf("> S0_RX_Start_Addr = S0_RX_OFFSET + S0_RX_BASE = %LX (physical)\r\n\r\n", S0_RX_Start_Addr ); printf("> Going to print-out Received Data... \r\n\r\n"); printf("ooooooooooooooooooooooooooooooooooooooooooo\r\n"); for (n=0; n < S0_RX_RSR ; n++) { if ( S0_RX_Start_Addr > (S0_RX_BASE + S0_RX_MASK) ) S0_RX_Start_Addr = S0_RX_BASE; RXbyte = GetW5100register(S0_RX_Start_Addr); printf("%c", RXbyte); S0_RX_Start_Addr++; } printf("\r\noooooooooooooooo END of received data oooooooooooooo\r\n\r\n"); } // --- INDEX.HTML ------ //---------------------------------------------------------------------- int Socket0_Received_Request_is_index_html(void) { int RXbyte=0; S0_RX_OFFSET = make16 ( GetW5100register(S0_RX_RD0), GetW5100register(S0_RX_RD1) ); // 8- 16 - // RX 0 S0_RX_OFFSET = (S0_RX_OFFSET & S0_RX_MASK ) ; // 0 S0_RX_Start_Addr = S0_RX_OFFSET + S0_RX_BASE ; // printf("\r\n>----------- parsing HTTP header-------------\r\n"); // ( ) while (RXbyte != 0x2F) // "/" HTTP { if ( S0_RX_Start_Addr > (S0_RX_BASE + S0_RX_MASK) ) S0_RX_Start_Addr = S0_RX_BASE; // // , // – – RXbyte = GetW5100register(S0_RX_Start_Addr); // RX , printf("%c", RXbyte); // ( ) S0_RX_Start_Addr++; // – } // («») HTTP “/” // "/" . // - RXbyte = GetW5100register(S0_RX_Start_Addr); // printf("\r\n> -------- END of parsing HTTP header -------\r\n"); // ( ) if (RXbyte == 0x20) return TRUE; // «» - , index.html // 1 else return FALSE; // , index.html // - 0 } //------ « 404» ------------ //------------------------------------------------------------- // 0 HTTP HTML // « 404», W5100 // , void Socket0_Send_404_error (void) { int16 n; char TXbyte; int16 datalength; S0_TX_OFFSET = make16 ( GetW5100register(S0_TX_RD0), GetW5100register(S0_TX_RD1) ); // 8- 16 - // , X 0 S0_TX_OFFSET = (S0_TX_OFFSET & S0_TX_MASK ) ; // 0 S0_TX_Start_Addr = S0_TX_OFFSET + S0_TX_BASE ; // // HTTP HTML datalength=0; while ( ERROR404[datalength] !=0) datalength++; // «datalength» 000 // (000 - ) // , W5100 , // , , . // , W5100 . // W5100: // - // 2- // *( // «» ) S0_TX_End_Addr = make16 ( GetW5100register(S0_TX_WR0), GetW5100register(S0_TX_WR1) ); // - S0_TX_End_Addr += datalength ; // increment to fatalength // ( ) «» // 2 SetW5100register(S0_TX_WR0, make8( S0_TX_End_Addr ,1) ); // SetW5100register(S0_TX_WR1, make8( S0_TX_End_Addr,0) ); // printf("\r\n>Data length is: %Lu \r\n", datalength); printf("\r\n>--- Filling TX buffer w data: -----------\r\n"); // ( ) // – For (n=0; n < datalength; n++) // { TXbyte = ERROR404[n]; // , « » // ( HTTP HTML ) // «» W5100 // , , 10 // , // , if (S0_TX_Start_Addr > (S0_TX_BASE + S0_TX_MASK)) S0_TX_Start_Addr = S0_TX_BASE; // .. – // * W5100 ( )) // - , , //( , ) – // // // – SetW5100register( S0_TX_Start_Addr, TXbyte ) ; putc(TXbyte); // ( ) S0_TX_Start_Addr++ ; // ( ) } printf("\r\n>--- end of Filling -----------\r\n"); // ( ) // , , // , , // - SEND SetW5100register(S0_CR, SEND); printf("> Data was sent \r\n\r\n"); // ( ) } //----------------------------------------------------------- //-- «index.html» --------------- //------------------------------------------------------------------- void Socket0_Send_index_html (void) // send index.html "page" index.html { // – « 404» // «» HTTP HTML – int16 n; char TXbyte; int16 datalength; printf("\r\n>...... going to send INDEX.HTML.....\r\n"); // ( ) S0_TX_OFFSET = make16 ( GetW5100register(S0_TX_RD0), GetW5100register(S0_TX_RD1) ); // 2- S0_TX_OFFSET = (S0_TX_OFFSET & S0_TX_MASK ) ; S0_TX_Start_Addr = S0_TX_OFFSET + S0_TX_BASE ; // printf("\r\n INDEX[i], datalegth -------------\r\n"); // ( ) // datalength=0; while ( INDEX[datalength] !=0) datalength++; // – 000 – printf("%c %Lu ",INDEX[datalength], datalength ); // ( ) // W5100 S0_TX_End_Addr = make16 ( GetW5100register(S0_TX_WR0), GetW5100register(S0_TX_WR1) ); // «» 2 S0_TX_End_Addr += datalength ; // increment to fatalength // // 1- SetW5100register(S0_TX_WR0, make8( S0_TX_End_Addr ,1) ); // SetW5100register(S0_TX_WR1, make8( S0_TX_End_Addr,0) ); // printf("\r\n>Data length is: %Lu \r\n", datalength); printf("\r\n>--- Filling TX buffer w data: -----------\r\n"); // ( ) // – For (n=0; n < datalength; n++) { TXbyte= INDEX[n]; // « » index.html // (.. HTTP Header + HTML code) if (S0_TX_Start_Addr > (S0_TX_BASE + S0_TX_MASK)) S0_TX_Start_Addr = S0_TX_BASE; // , – SetW5100register( S0_TX_Start_Addr, TXbyte ) ; // ( « ») – putc(TXbyte); // printout to Terminal ( for testing purpose) // ( ) S0_TX_Start_Addr++ ; // } printf("\r\n>--- end of Filling -----------\r\n"); // ( ) // , // - SEND SetW5100register(S0_CR, SEND); printf("> Data was sent \r\n\r\n"); // ( ) } //-------------------------------------------------------- //--- , , FIN ? ------ //----------------------------------------------------------------------------- int Socket0_FIN_Received(void) { // ( ) // FIN - // // – 0 // 1 FIN 0 FIN if ( GetW5100register(S0_SR) == SOCK_CLOSE_WAIT) return TRUE; else return FALSE; } //--------------------------------------------------------- // ------ Socket0 ----------------- //------------------------------------------------------------- void Socket0_Disconnect(void) { // // 0 SetW5100register(S0_CR, DISCON); } // ------ 0 -------------------- //-------------------------------------------------------- int Socket0_Closed(void) { // // (CLOSE), -, // 0 // * , // - If ( GetW5100register(S0_SR) == SOCK_CLOSED) return TRUE; else return FALSE; // 1 ( 0) // 0 } // ----- - 0 ? ------------ //------------------------------------------------------------- int Socket0_Connection_Timeout(void) { // , , // – - // , // ( TCP ) , // // - // – 0 // : , «SOCK_CLOSED» // - -?? // -, // W5100 «SOCK_CLOSED» - // – If ( GetW5100register(S0_SR) == SOCK_CLOSED) return TRUE; else return FALSE; // 1 - , 0 - } // ------------ 0 ---------------------------- //---------------------------------------------------------------- void Socket0_Closing(void) { // should be performed in case that connection is closed after data exchange, // socket should be closed with Timeout occurrence, // or forcible disconnection is necessary due to abnormal operation etc. printf(">going to Close Socket0 ..... \r\n"); // ( ) // 0 SetW5100register(S0_CR, CLOSE); printf("> ------ Socket CLOSED ----- \r\n\r\n"); // ( ) } // ---- () SPI ------------- //-------------------------------------------------------- //* «SSPI» , // (SPI… ) . // () – // – SPI // «» ( ) // - //* - W5100 0 1 void SSPI_write( int Data) { int i; int mask=0x80; // ( ) // SPI W5100 // - ( MSB first) output_low(SCK); // – «» for (i=0; i<8;i++) // 8 { output_low(MOSI); // «» - 0 if ( (mask & Data) != 0) output_high(MOSI); // ( & ) =1 1 // – 0, output_high(SCK); // ( 0 1) - // SPI – W5100 mask = mask>>1; ; // 1 // * // // ( ) output_low(SCK); // , «» ( 0 ) } // «.. » () } //---------------------------------------------------------- //----------- SPI ------------------ //----------------------------------------------------------- //* «SSPI» , // (SPI… ) . // – // – // «» // // * W5100 - 1 0 //* // 0 1 // 1, // «» 1 0 int SSPI_read ( void) { int Data=0; int i; int mask=0x80; // ( ) // SPI W5100 // - ( MSB first) output_low(SCK); // – «» for (i=0; i<8;i++) // 8 { output_high(SCK); // ( 0 1) if ( input(MISO)!= 0) Data = Data | mask ; // 1, – «» mask = mask>>1; ; // 1 // * // // ( ) output_low(SCK); // , «» ( 0 ) } return Data; } //--------------------------------------------------------------- //------- ( ) W5100 ------------- //-------------------------------------------------------------- void SetW5100register (int16 regaddr, int8 data) // 2 : 16 8 { output_low(SS); // ( 0) SSPI_write (0xF0); // //* make8 – 16 - 8 SSPI_write ( make8(regaddr,1) ); // (MSB) // SPI SSPI_write ( make8(regaddr,0) ); // (LSB) // SPI SSPI_write (data); // SPI output_high(SS); // ( 1) } //--------------------------------------------------------- //----- W5100 ---------- //---------------------------------------------------- int GetW5100register (int16 regaddr) // – 2- // : 1 { int RegData; output_low(SS); // ( 0) SSPI_write (0x0F); // //* make8 – 16 8 SSPI_write ( make8(regaddr,1) ); // (MSB) // SPI SSPI_write ( make8(regaddr,0) ); // (LSB) // SPI RegData = SSPI_read (); // W5100 (8 ) // output_high(SS); // ( 1) return RegData; // } //************* END of PROGRAM **************
Source: https://habr.com/ru/post/230661/
All Articles