sector9
Junior Member level 1
i am new to the enc28j60 i am i got my module and a pic 18f4550 i use mikroC , this is my configuration , i am using a 20MHz 5v oscillator
i connected all wires except for INT , WOL , SCK on the module are not connected
MCU pin26 to SI of module
MCU pin33 to SO of module
MCU pin40 to rst of module
MCU pin39 to CS of module
nothing is working at allllllllllll !! where did i go wrong please please please help !
here is my code
i connected all wires except for INT , WOL , SCK on the module are not connected
MCU pin26 to SI of module
MCU pin33 to SO of module
MCU pin40 to rst of module
MCU pin39 to CS of module
nothing is working at allllllllllll !! where did i go wrong please please please help !
here is my code
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 #include "__EthEnc28j60.h" // duplex config flags #define Spi_Ethernet_HALFDUPLEX 0x00 // half duplex #define Spi_Ethernet_FULLDUPLEX 0x01 // full duplex // mE ehternet NIC pinout sfr sbit SPI_Ethernet_Rst at RB7_bit; sfr sbit SPI_Ethernet_CS at RB6_bit; sfr sbit SPI_Ethernet_Rst_Direction at TRISB7_bit; sfr sbit SPI_Ethernet_CS_Direction at TRISB6_bit; // end ethernet NIC definitions /************************************************************ * ROM constant strings */ const unsigned char httpHeader[] = "HTTP/1.1 200 OKnContent-type: " ; // HTTP header const unsigned char httpMimeTypeHTML[] = "text/htmlnn" ; // HTML MIME type const unsigned char httpMimeTypeScript[] = "text/plainnn" ; // TEXT MIME type unsigned char httpMethod[] = "GET /"; const char *indexPage ="<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"; const char *indexPage2 = "<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"; /*********************************** * RAM variables */ unsigned char myMacAddr[6] = {0x00, 0x14, 0xA5, 0x76, 0x19, 0x3f} ; // my MAC address unsigned char myIpAddr[4] = {192, 168, 2, 10} ; // my IP address unsigned char getRequest[15] ; // HTTP request buffer unsigned char dyna[30] ; // buffer for dynamic response unsigned long httpCounter = 0 ; // counter of HTTP requests unsigned int SPI_Ethernet_UserTCP(unsigned char *remoteHost, unsigned int remotePort, unsigned int localPort, unsigned int reqLength, TEthPktFlags *flags) { const char *buffer = "<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"; unsigned int len = 0 ; // my reply length unsigned int i ; // general purpose integer httpCounter++ ; // one more request done SPI_Ethernet_putConstString(buffer); return(len) ; // return to the library with the number of bytes to transmit } unsigned int SPI_Ethernet_UserUDP(unsigned char *remoteHost, unsigned int remotePort, unsigned int destPort, unsigned int reqLength, TEthPktFlags *flags) { const char *buffer = "<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"; unsigned int len = 0 ; // my reply length unsigned int i ; // general purpose integer httpCounter++ ; // one more request done SPI_Ethernet_putConstString(buffer); return(len) ; return(len) ; // back to the library with the length of the UDP reply } /* * main entry */ void main() { SPI1_Init(); SPI_Ethernet_Init(myMacAddr, myIpAddr, Spi_Ethernet_FULLDUPLEX) ; while(1) // do forever { SPI_Ethernet_doPacket() ; // process incoming Ethernet packets } }
Last edited: