Component: TCP/IP (ENC28J60) (Comms: Networking): Difference between revisions
Appearance
No edit summary |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (11 intermediate revisions by 4 users not shown) | |||
| Line 17: | Line 17: | ||
==Component Source Code== | ==Component Source Code== | ||
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/ | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_TCPIP_ENC28J60.fcfx FC_Comp_Source_TCPIP_ENC28J60.fcfx] | ||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/ | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_TCPIP_ENC28J60.fcfx FC_Comp_Source_TCPIP_ENC28J60.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
| Line 43: | Line 43: | ||
| Line 52: | Line 51: | ||
Here is a simple example to help get started with the ENC28J60 module. | |||
The example program creates a web page server on the network and will also respond to ping requests. | |||
The HTML to drive the web pages is included in the flowchart near the bottom of the main program loop. | |||
{{Fcfile|ENC28J60_Example.fcfx|ENC28J60 Example}} | |||
==Macro reference== | ==Macro reference== | ||
===CheckArpPacketIsMyreplyArp=== | ===CheckArpPacketIsMyreplyArp=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckArpPacketIsMyreplyArp''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 70: | Line 85: | ||
===CheckForARP=== | ===CheckForARP=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckForARP''' | ||
|- | |- | ||
| colspan="2" | Checks to see if the received data is an ARP request with my IP address. | | colspan="2" | Checks to see if the received data is an ARP request with my IP address. | ||
| Line 89: | Line 104: | ||
===CheckForIp=== | ===CheckForIp=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckForIp''' | ||
|- | |- | ||
| colspan="2" | Checks to see if the received data is an IP request with my IP address. | | colspan="2" | Checks to see if the received data is an IP request with my IP address. | ||
| Line 108: | Line 123: | ||
===CheckForPing=== | ===CheckForPing=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckForPing''' | ||
|- | |- | ||
| colspan="2" | Checks to see if the received data is a Ping request | | colspan="2" | Checks to see if the received data is a Ping request | ||
| Line 122: | Line 137: | ||
===CheckForTCPPort=== | ===CheckForTCPPort=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckForTCPPort''' | ||
|- | |- | ||
| colspan="2" | Checks to see if the received data is requesting the server port | | colspan="2" | Checks to see if the received data is requesting the server port | ||
| Line 141: | Line 156: | ||
===CheckForTCPType=== | ===CheckForTCPType=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''CheckForTCPType''' | ||
|- | |- | ||
| colspan="2" | Checks to what kind of TCP type the received data is requesting. Returns a bit field specifying the type of request. 0x01 = Ack Requires, 0x02 = Synchronise 0x10 = Ack | | colspan="2" | Checks to what kind of TCP type the received data is requesting. Returns a bit field specifying the type of request. 0x01 = Ack Requires, 0x02 = Synchronise 0x10 = Ack | ||
| Line 155: | Line 170: | ||
===ClientSendPacket=== | ===ClientSendPacket=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ClientSendPacket''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 214: | Line 229: | ||
===ControlLEDs=== | ===ControlLEDs=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ControlLEDs''' | ||
|- | |- | ||
| colspan="2" | Allows both the LEDs on the Ethernet socket to be controlled. Useful for checking if the SPI communications are functioning correctly. | | colspan="2" | Allows both the LEDs on the Ethernet socket to be controlled. Useful for checking if the SPI communications are functioning correctly. | ||
| Line 233: | Line 248: | ||
===FillTcpArray=== | ===FillTcpArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''FillTcpArray''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 262: | Line 277: | ||
===FillTcpData=== | ===FillTcpData=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''FillTcpData''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 286: | Line 301: | ||
===GetDataLength=== | ===GetDataLength=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetDataLength''' | ||
|- | |- | ||
| colspan="2" | Returns the number of received data bytes after the headers | | colspan="2" | Returns the number of received data bytes after the headers | ||
| Line 300: | Line 315: | ||
===GetModuleRevision=== | ===GetModuleRevision=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetModuleRevision''' | ||
|- | |- | ||
| colspan="2" | Requets the module revision number and returns the value supplied by the module's firmware. | | colspan="2" | Requets the module revision number and returns the value supplied by the module's firmware. | ||
| Line 314: | Line 329: | ||
===GetSendersMAC=== | ===GetSendersMAC=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetSendersMAC''' | ||
|- | |- | ||
| colspan="2" | Gets the MAC address from locations 6-11 of the IP Header | | colspan="2" | Gets the MAC address from locations 6-11 of the IP Header | ||
| Line 333: | Line 348: | ||
===GetTcpDataPointer=== | ===GetTcpDataPointer=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''GetTcpDataPointer''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 347: | Line 362: | ||
===Initialise=== | ===Initialise=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Initialises the SPI connection to the TCPIP module and sets up some initial values. Flashes the LEDs on and off twice to confirm SPI comms are active. LEDs are then configured to auto functionality. | | colspan="2" | Initialises the SPI connection to the TCPIP module and sets up some initial values. Flashes the LEDs on and off twice to confirm SPI comms are active. LEDs are then configured to auto functionality. | ||
| Line 361: | Line 376: | ||
===InitialiseDataLengthInfo=== | ===InitialiseDataLengthInfo=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''InitialiseDataLengthInfo''' | ||
|- | |- | ||
| colspan="2" | Initialises the data pointers to allow us to craft a response containing data | | colspan="2" | Initialises the data pointers to allow us to craft a response containing data | ||
| Line 375: | Line 390: | ||
===MakeArpAnswerFromRequest=== | ===MakeArpAnswerFromRequest=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MakeArpAnswerFromRequest''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 389: | Line 404: | ||
===MakeArpRequest=== | ===MakeArpRequest=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MakeArpRequest''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:]] - | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | ServerIP | | width="90%" | ServerIP | ||
|- | |- | ||
| Line 408: | Line 423: | ||
===MakeEchoReplyFromRequest=== | ===MakeEchoReplyFromRequest=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MakeEchoReplyFromRequest''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 427: | Line 442: | ||
===MakeTcpAckFromAny=== | ===MakeTcpAckFromAny=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MakeTcpAckFromAny''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 446: | Line 461: | ||
===MakeTcpAckWithData=== | ===MakeTcpAckWithData=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MakeTcpAckWithData''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 465: | Line 480: | ||
===MakeTcpSynackFromSyn=== | ===MakeTcpSynackFromSyn=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MakeTcpSynackFromSyn''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 484: | Line 499: | ||
===PacketReceive=== | ===PacketReceive=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''PacketReceive''' | ||
|- | |- | ||
| colspan="2" | Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received. | | colspan="2" | Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received. | ||
| Line 498: | Line 513: | ||
===PacketSend=== | ===PacketSend=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''PacketSend''' | ||
|- | |- | ||
| colspan="2" | Attempts to transmit a data packet to the ENC28J60 module. | | colspan="2" | Attempts to transmit a data packet to the ENC28J60 module. | ||
| Line 517: | Line 532: | ||
===ReadArrayFromBuffer=== | ===ReadArrayFromBuffer=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadArrayFromBuffer''' | ||
|- | |- | ||
| colspan="2" | Reads an array of bytes from the buffer at location specified for the number of bytes specified. If a space character is encountered then the macro will return straight away without the space character in the string. | | colspan="2" | Reads an array of bytes from the buffer at location specified for the number of bytes specified. If a space character is encountered then the macro will return straight away without the space character in the string. | ||
| Line 546: | Line 561: | ||
===ReadRegister=== | ===ReadRegister=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadRegister''' | ||
|- | |- | ||
| colspan="2" | Reads the value from a single register onboard the ENC28J60 module. | | colspan="2" | Reads the value from a single register onboard the ENC28J60 module. | ||
| Line 565: | Line 580: | ||
===ReadStringFromBuffer=== | ===ReadStringFromBuffer=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ReadStringFromBuffer''' | ||
|- | |- | ||
| colspan="2" | Reads a string from the buffer at location specified for the number of bytes specified. If a space character is encountered then the macro will return straight away without the space character in the string. | | colspan="2" | Reads a string from the buffer at location specified for the number of bytes specified. If a space character is encountered then the macro will return straight away without the space character in the string. | ||
| Line 589: | Line 604: | ||
===SetMyIPAddress=== | ===SetMyIPAddress=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetMyIPAddress''' | ||
|- | |- | ||
| colspan="2" | Allows the IP Address specified in the component properties to be overridden. The IP Address will revert back to the IP specified in the component properties as part of the initialise macro. | | colspan="2" | Allows the IP Address specified in the component properties to be overridden. The IP Address will revert back to the IP specified in the component properties as part of the initialise macro. | ||
| Line 623: | Line 638: | ||
===SetMyMACAddress=== | ===SetMyMACAddress=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetMyMACAddress''' | ||
|- | |- | ||
| colspan="2" | Allows the MAC Address specified in the component properties to be overridden. The MAC Address will revert back to the MAC specified in the component properties as part of the initialise macro. | | colspan="2" | Allows the MAC Address specified in the component properties to be overridden. The MAC Address will revert back to the MAC specified in the component properties as part of the initialise macro. | ||
| Line 667: | Line 682: | ||
===WriteRegister=== | ===WriteRegister=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''WriteRegister''' | ||
|- | |- | ||
| colspan="2" | Writes a value to a single register onboard the ENC28J60 module. | | colspan="2" | Writes a value to a single register onboard the ENC28J60 module. | ||
| Line 692: | Line 707: | ||
==Property reference== | ==Property reference== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | TCP IP Specifics | ||
|- | |- | ||
|- | |- | ||
| Line 712: | Line 727: | ||
| colspan="2" | Number of bytes to use for the transmit and receive buffer, we actually use this +1 to allow for a null termination. 8-bit PICs should set this to 255 to allow compilation to succeed. Other devices can have larger buffers. Default = 500 | | colspan="2" | Number of bytes to use for the transmit and receive buffer, we actually use this +1 to allow for a null termination. 8-bit PICs should set this to 255 to allow compilation to succeed. Other devices can have larger buffers. Default = 500 | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | SPI Settings | ||
|- | |- | ||
|- | |- | ||
| Line 751: | Line 766: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | MAC Address | ||
|- | |- | ||
|- | |- | ||
| Line 785: | Line 800: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | IP Address | ||
|- | |- | ||
|- | |- | ||
| Line 809: | Line 824: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Simulation | ||
|- | |- | ||
|- | |- | ||
| Line 823: | Line 838: | ||
| colspan="2" | Decides how to perform the simulation of the component. TCP IP - Communicates using the Windows TCP IP communications DLL SPI / API - Communicates using the CAL SPI to allow the communications to be analysed and debugged. | | colspan="2" | Decides how to perform the simulation of the component. TCP IP - Communicates using the Windows TCP IP communications DLL SPI / API - Communicates using the CAL SPI to allow the communications to be analysed and debugged. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | SPI Simulation | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:37, 13 July 2026
| Author | Matrix TSL |
| Version | 2.2 |
| Category | Comms: Networking |
TCP/IP (ENC28J60) component
A set of routines used to control a ENC28J60 TCP/IP Module. Required connections VCC, Reset, GND, SCK, MISO, MOSI, CS. Leave these pins disconnected CLKOUT, ENC_WOL, ENC_INT
Component Source Code
Please click here to download the component source project: FC_Comp_Source_TCPIP_ENC28J60.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_TCPIP_ENC28J60.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Here is a simple example to help get started with the ENC28J60 module.
The example program creates a web page server on the network and will also respond to ping requests.
The HTML to drive the web pages is included in the flowchart near the bottom of the main program loop.
Macro reference
CheckArpPacketIsMyreplyArp
| CheckArpPacketIsMyreplyArp | |
| Return | |
CheckForARP
| CheckForARP | |
| Checks to see if the received data is an ARP request with my IP address. | |
| Length | |
| Return | |
CheckForIp
| CheckForIp | |
| Checks to see if the received data is an IP request with my IP address. | |
| Length | |
| Return | |
CheckForPing
| CheckForPing | |
| Checks to see if the received data is a Ping request | |
| Return | |
CheckForTCPPort
| CheckForTCPPort | |
| Checks to see if the received data is requesting the server port | |
| Port | |
| Return | |
CheckForTCPType
| CheckForTCPType | |
| Checks to what kind of TCP type the received data is requesting. Returns a bit field specifying the type of request. 0x01 = Ack Requires, 0x02 = Synchronise 0x10 = Ack | |
| Return | |
ClientSendPacket
| ClientSendPacket | |
| DestPort | |
| SourcePort | |
| Flags | |
| MaxSegmentSize | |
| ClearSeqAck | |
| NextAckNum | |
| DataLength | |
| DestMac | |
| DestIp | |
| Return | |
ControlLEDs
| ControlLEDs | |
| Allows both the LEDs on the Ethernet socket to be controlled. Useful for checking if the SPI communications are functioning correctly. | |
| Mode | |
| 0=Off, 1=On, 2=Auto | |
| Return | |
FillTcpArray
| FillTcpArray | |
| Position | |
| Count | |
| Data | |
| Return | |
FillTcpData
| FillTcpData | |
| Position | |
| Data | |
| Return | |
GetDataLength
| GetDataLength | |
| Returns the number of received data bytes after the headers | |
| Return | |
GetModuleRevision
| GetModuleRevision | |
| Requets the module revision number and returns the value supplied by the module's firmware. | |
| Return | |
GetSendersMAC
| GetSendersMAC | |
| Gets the MAC address from locations 6-11 of the IP Header | |
| MAC | |
| 6-byte Array to store the MAC address | |
| Return | |
GetTcpDataPointer
| GetTcpDataPointer | |
| Return | |
Initialise
InitialiseDataLengthInfo
| InitialiseDataLengthInfo | |
| Initialises the data pointers to allow us to craft a response containing data | |
| Return | |
MakeArpAnswerFromRequest
| MakeArpAnswerFromRequest | |
| Return | |
MakeArpRequest
| MakeArpRequest | |
| ServerIP | |
| Return | |
MakeEchoReplyFromRequest
| MakeEchoReplyFromRequest | |
| Length | |
| Return | |
MakeTcpAckFromAny
| MakeTcpAckFromAny | |
| Port | |
| Return | |
MakeTcpAckWithData
| MakeTcpAckWithData | |
| DataLength | |
| Return | |
MakeTcpSynackFromSyn
| MakeTcpSynackFromSyn | |
| Port | |
| Return | |
PacketReceive
| PacketReceive | |
| Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received. | |
| Return | |
PacketSend
| PacketSend | |
| Attempts to transmit a data packet to the ENC28J60 module. | |
| Length | |
| Return | |
ReadArrayFromBuffer
ReadRegister
| ReadRegister | |
| Reads the value from a single register onboard the ENC28J60 module. | |
| Address | |
| Return | |
ReadStringFromBuffer
SetMyIPAddress
SetMyMACAddress
WriteRegister
| WriteRegister | |
| Writes a value to a single register onboard the ENC28J60 module. | |
| Address | |
| Data | |
| Return | |