Difference between revisions of "Component: TCP/IP (ENC28J60) (Comms: Networking)"

From Flowcode Help
Jump to navigationJump to search
 
(8 intermediate revisions by one other user not shown)
Line 16: Line 16:
  
 
==Component Source Code==
 
==Component Source Code==
 +
 +
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/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/FC_Comp_Source_TCPIP_ENC28J60.fcfx FC_Comp_Source_TCPIP_ENC28J60.fcfx]
Line 23: Line 25:
  
  
''No detailed description exists yet for this component''
 
  
==Examples==
 
  
  
  
''<span style="color:red;">No additional examples</span>''
 
  
==Macro reference==
 
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
''No detailed description exists yet for this component''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP0
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 192&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP1
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 168&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP2
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 1&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP3
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 250&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
==Examples==
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
Here is a simple example to help get started with the ENC28J60 module.
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PacketSend'''
 
|-
 
| colspan="2" | Attempts to transmit a data packet to the ENC28J60 module.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Length
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
The example program creates a web page server on the network and will also respond to ping requests.
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
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}}
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpSynackFromSyn'''
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Port
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
==Macro reference==
  
 +
===CheckArpPacketIsMyreplyArp===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpRequest'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckArpPacketIsMyreplyArp'''
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:]] -
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ServerIP
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===CheckForARP===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''InitialiseDataLengthInfo'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForARP'''
 
|-
 
|-
| colspan="2" | Initialises the data pointers to allow us to craft a response containing data&nbsp;
+
| colspan="2" | Checks to see if the received data is an ARP request with my IP address.&nbsp;
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpAckFromAny'''
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
+
| width="90%" | Length
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PacketReceive'''
 
|-
 
| colspan="2" | Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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 &nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckArpPacketIsMyreplyArp'''
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 190: Line 77:
  
  
 +
===CheckForIp===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 208: Line 96:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===CheckForPing===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForTCPPort'''
 
|-
 
| colspan="2" | Checks to see if the received data is requesting the server port&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Port
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 239: Line 110:
  
  
 +
===CheckForTCPPort===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetModuleRevision'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForTCPPort'''
 
|-
 
|-
| colspan="2" | Requets the module revision number and returns the value supplied by the module's firmware.&nbsp;
+
| colspan="2" | Checks to see if the received data is requesting the server port&nbsp;
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpAckWithData'''
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | DataLength
+
| width="90%" | Port
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC0
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC1
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC2
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC3
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC4
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC5
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpAnswerFromRequest'''
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | BufferLocation
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumberOfBytes
 
|-
 
| colspan="2" | Number of bytes to read from the buffer and store into string&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadRegister'''
 
|-
 
| colspan="2" | Reads the value from a single register onboard the ENC28J60 module.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Address
 
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
Line 372: Line 129:
  
  
 +
===CheckForTCPType===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForARP'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForTCPType'''
 
|-
 
|-
| colspan="2" | Checks to see if the received data is an ARP request with my IP address.&nbsp;
+
| 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 &nbsp;
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Length
 
 
|-
 
|-
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 390: Line 143:
  
  
 +
===ClientSendPacket===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 448: Line 202:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===ControlLEDs===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeEchoReplyFromRequest'''
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Length
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 484: Line 221:
  
  
 +
===FillTcpArray===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDataLength'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FillTcpArray'''
 
|-
 
|-
| colspan="2" | Returns the number of received data bytes after the headers&nbsp;
+
| colspan="2" | &nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
+
| width="90%" | Position
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTcpDataPointer'''
 
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
|-
+
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="90%" | Count
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteRegister'''
 
|-
 
| colspan="2" | Writes a value to a single register onboard the ENC28J60 module.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Address
 
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
Line 533: Line 250:
  
  
 +
===FillTcpData===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 556: Line 274:
  
  
 +
===GetDataLength===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadStringFromBuffer'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDataLength'''
 
|-
 
|-
| 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.&nbsp;
+
| colspan="2" | Returns the number of received data bytes after the headers&nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | BufferLocation
+
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
 +
 
 +
 
 +
===GetModuleRevision===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
| colspan="2" | &nbsp;
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetModuleRevision'''
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
+
| colspan="2" | Requets the module revision number and returns the value supplied by the module's firmware.&nbsp;
| width="90%" | NumberOfBytes
 
 
|-
 
|-
| colspan="2" | Number of bytes to read from the buffer and store into string&nbsp;
 
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetSendersMAC===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 597: Line 321:
  
  
 +
===GetTcpDataPointer===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FillTcpArray'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTcpDataPointer'''
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Position
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Count
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===Initialise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 638: Line 349:
  
  
 
+
===InitialiseDataLengthInfo===
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | TCP IP Specifics
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Server Port
 
|-
 
| colspan="2" | Sets the server's TCP/IP port address which is used to filter incoming TCP packets.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Buffer Size
 
|-
 
| 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&nbsp;
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI Settings
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Channel
 
|-
 
| colspan="2" | SPI Channel selector&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Prescale
 
|-
 
| colspan="2" | Prescale option selector&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | MOSI
 
|-
 
| colspan="2" | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | MISO
 
|-
 
| colspan="2" | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | CLK
 
|-
 
| colspan="2" | SPI Clock Pin CLK - The Clock signal is driven by the SPI master.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | CS / SS
 
|-
 
| colspan="2" | Chip Select / Slave Select Pin  Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device. &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Reset Pin
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | MAC Address
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | MAC0
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | MAC1
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | MAC2
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | MAC3
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | MAC4
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | MAC5
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | IP Address
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | IP0
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | IP1
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | IP2
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | IP3
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Label
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Sim Type
 
|-
 
| 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.&nbsp;
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI Simulation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Scope Traces
 
|-
 
| colspan="2" | Selects if the scope traces are automatically generated or not&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
 
|-
 
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | API
 
|-
 
| colspan="2" | &nbsp;
 
|}==Macro reference==
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetMyIPAddress'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''InitialiseDataLengthInfo'''
 
|-
 
|-
| 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.&nbsp;
+
| colspan="2" | Initialises the data pointers to allow us to craft a response containing data&nbsp;
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP0
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 192&nbsp;
 
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP1
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 168&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP2
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 1&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP3
 
|-
 
| colspan="2" | IP Address Parameter - e.g. 250&nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 826: Line 363:
  
  
 +
===MakeArpAnswerFromRequest===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PacketSend'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpAnswerFromRequest'''
|-
 
| colspan="2" | Attempts to transmit a data packet to the ENC28J60 module.&nbsp;
 
 
|-
 
|-
 +
| colspan="2" | &nbsp;
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Length
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 844: Line 377:
  
  
 +
===MakeArpRequest===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpSynackFromSyn'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpRequest'''
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Port
+
| width="90%" | ServerIP
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
Line 862: Line 396:
  
  
 +
===MakeEchoReplyFromRequest===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpRequest'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeEchoReplyFromRequest'''
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:]] -  
+
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | ServerIP
+
| width="90%" | Length
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
Line 880: Line 415:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===MakeTcpAckFromAny===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''InitialiseDataLengthInfo'''
 
|-
 
| colspan="2" | Initialises the data pointers to allow us to craft a response containing data&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 911: Line 434:
  
  
 +
===MakeTcpAckWithData===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PacketReceive'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpAckWithData'''
|-
 
| colspan="2" | Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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 &nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckArpPacketIsMyreplyArp'''
 
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForIp'''
 
|-
 
| colspan="2" | Checks to see if the received data is an IP request with my IP address.&nbsp;
 
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
+
| width="90%" | DataLength
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===MakeTcpSynackFromSyn===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForTCPPort'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpSynackFromSyn'''
 
|-
 
|-
| colspan="2" | Checks to see if the received data is requesting the server port&nbsp;
+
| colspan="2" | &nbsp;
 
|-
 
|-
 
|-
 
|-
Line 981: Line 467:
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===PacketReceive===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForPing'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PacketReceive'''
 
|-
 
|-
| colspan="2" | Checks to see if the received data is a Ping request&nbsp;
+
| colspan="2" | Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received.&nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===PacketSend===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetModuleRevision'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PacketSend'''
 
|-
 
|-
| colspan="2" | Requets the module revision number and returns the value supplied by the module's firmware.&nbsp;
+
| colspan="2" | Attempts to transmit a data packet to the ENC28J60 module.&nbsp;
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpAckWithData'''
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | DataLength
+
| width="90%" | Length
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
Line 1,030: Line 505:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===ReadArrayFromBuffer===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC0
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC1
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC2
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC3
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC4
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC5
 
|-
 
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpAnswerFromRequest'''
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 1,114: Line 534:
  
  
 +
===ReadRegister===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 1,132: Line 553:
  
  
 +
===ReadStringFromBuffer===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForARP'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadStringFromBuffer'''
 
|-
 
|-
| colspan="2" | Checks to see if the received data is an ARP request with my IP address.&nbsp;
+
| 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.&nbsp;
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Length
+
| width="90%" | BufferLocation
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | NumberOfBytes
 +
|-
 +
| colspan="2" | Number of bytes to read from the buffer and store into string&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===SetMyIPAddress===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ClientSendPacket'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetMyIPAddress'''
 
|-
 
|-
| colspan="2" | &nbsp;
+
| 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.&nbsp;
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | DestPort
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | SourcePort
 
 
|-
 
|-
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Flags
+
| width="90%" | IP0
 
|-
 
|-
| colspan="2" | &nbsp;
+
| colspan="2" | IP Address Parameter - e.g. 192&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | MaxSegmentSize
+
| width="90%" | IP1
 
|-
 
|-
| colspan="2" | &nbsp;
+
| colspan="2" | IP Address Parameter - e.g. 168&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ClearSeqAck
+
| width="90%" | IP2
 
|-
 
|-
| colspan="2" | &nbsp;
+
| colspan="2" | IP Address Parameter - e.g. 1&nbsp;
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | NextAckNum
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | DataLength
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DestMac
+
| width="90%" | IP3
 
|-
 
|-
| colspan="2" | &nbsp;
+
| colspan="2" | IP Address Parameter - e.g. 250&nbsp;
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | DestIp
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 1,208: Line 611:
  
  
 +
===SetMyMACAddress===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeEchoReplyFromRequest'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetMyMACAddress'''
 
|-
 
|-
| colspan="2" | &nbsp;
+
| 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.&nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Length
+
| width="90%" | MAC0
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ControlLEDs'''
 
|-
 
| colspan="2" | Allows both the LEDs on the Ethernet socket to be controlled. Useful for checking if the SPI communications are functioning correctly.&nbsp;
 
 
|-
 
|-
 +
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Mode
+
| width="90%" | MAC1
|-
 
| colspan="2" | 0=Off, 1=On, 2=Auto&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDataLength'''
 
|-
 
| colspan="2" | Returns the number of received data bytes after the headers&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTcpDataPointer'''
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteRegister'''
 
|-
 
| colspan="2" | Writes a value to a single register onboard the ENC28J60 module.&nbsp;
 
 
|-
 
|-
 +
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Address
+
| width="90%" | MAC2
 
|-
 
|-
| colspan="2" | &nbsp;
+
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
+
| width="90%" | MAC3
 
|-
 
|-
| colspan="2" | &nbsp;
+
| colspan="2" | MAC Address Parameter&nbsp;
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FillTcpData'''
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Position
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Data
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | BufferLocation
 
|-
 
| colspan="2" | &nbsp;
 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumberOfBytes
+
| width="90%" | MAC4
|-
 
| colspan="2" | Number of bytes to read from the buffer and store into string&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSendersMAC'''
 
|-
 
| colspan="2" | Gets the MAC address from locations 6-11 of the IP Header&nbsp;
 
 
|-
 
|-
 +
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | MAC
+
| width="90%" | MAC5
 
|-
 
|-
| colspan="2" | 6-byte Array to store the MAC address&nbsp;
+
| colspan="2" | MAC Address Parameter&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 1,357: Line 655:
  
  
 +
===WriteRegister===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FillTcpArray'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteRegister'''
 
|-
 
|-
| colspan="2" | &nbsp;
+
| colspan="2" | Writes a value to a single register onboard the ENC28J60 module.&nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Position
+
| width="90%" | Address
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Count
 
 
|-
 
|-
 
| colspan="2" | &nbsp;
 
| colspan="2" | &nbsp;
Line 1,383: Line 677:
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
  
  

Latest revision as of 09:56, 11 December 2023

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. FC6 Icon.png ENC28J60 Example

Macro reference

CheckArpPacketIsMyreplyArp

Fc9-comp-macro.png CheckArpPacketIsMyreplyArp
 
Fc9-u8-icon.png - BYTE Return


CheckForARP

Fc9-comp-macro.png CheckForARP
Checks to see if the received data is an ARP request with my IP address. 
Fc9-u16-icon.png - UINT Length
 
Fc9-u8-icon.png - BYTE Return


CheckForIp

Fc9-comp-macro.png CheckForIp
Checks to see if the received data is an IP request with my IP address. 
Fc9-u16-icon.png - UINT Length
 
Fc9-u8-icon.png - BYTE Return


CheckForPing

Fc9-comp-macro.png CheckForPing
Checks to see if the received data is a Ping request 
Fc9-u8-icon.png - BYTE Return


CheckForTCPPort

Fc9-comp-macro.png CheckForTCPPort
Checks to see if the received data is requesting the server port 
Fc9-u16-icon.png - UINT Port
 
Fc9-u8-icon.png - BYTE Return


CheckForTCPType

Fc9-comp-macro.png 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  
Fc9-u8-icon.png - BYTE Return


ClientSendPacket

Fc9-comp-macro.png ClientSendPacket
 
Fc9-u16-icon.png - UINT DestPort
 
Fc9-u16-icon.png - UINT SourcePort
 
Fc9-u8-icon.png - BYTE Flags
 
Fc9-u8-icon.png - BYTE MaxSegmentSize
 
Fc9-u8-icon.png - BYTE ClearSeqAck
 
Fc9-u16-icon.png - UINT NextAckNum
 
Fc9-u16-icon.png - UINT DataLength
 
Fc9-u8-icon.png - BYTE DestMac
 
Fc9-u8-icon.png - BYTE DestIp
 
Fc9-void-icon.png - VOID Return


ControlLEDs

Fc9-comp-macro.png ControlLEDs
Allows both the LEDs on the Ethernet socket to be controlled. Useful for checking if the SPI communications are functioning correctly. 
Fc9-u8-icon.png - BYTE Mode
0=Off, 1=On, 2=Auto 
Fc9-void-icon.png - VOID Return


FillTcpArray

Fc9-comp-macro.png FillTcpArray
 
Fc9-u16-icon.png - UINT Position
 
Fc9-u16-icon.png - UINT Count
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


FillTcpData

Fc9-comp-macro.png FillTcpData
 
Fc9-u16-icon.png - UINT Position
 
Fc9-string-icon.png - STRING Data
 
Fc9-u16-icon.png - UINT Return


GetDataLength

Fc9-comp-macro.png GetDataLength
Returns the number of received data bytes after the headers 
Fc9-u16-icon.png - UINT Return


GetModuleRevision

Fc9-comp-macro.png GetModuleRevision
Requets the module revision number and returns the value supplied by the module's firmware. 
Fc9-u8-icon.png - BYTE Return


GetSendersMAC

Fc9-comp-macro.png GetSendersMAC
Gets the MAC address from locations 6-11 of the IP Header 
Fc9-u8-icon.png - BYTE MAC
6-byte Array to store the MAC address 
Fc9-void-icon.png - VOID Return


GetTcpDataPointer

Fc9-comp-macro.png GetTcpDataPointer
 
Fc9-u16-icon.png - UINT Return


Initialise

Fc9-comp-macro.png Initialise
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. 
Fc9-void-icon.png - VOID Return


InitialiseDataLengthInfo

Fc9-comp-macro.png InitialiseDataLengthInfo
Initialises the data pointers to allow us to craft a response containing data 
Fc9-void-icon.png - VOID Return


MakeArpAnswerFromRequest

Fc9-comp-macro.png MakeArpAnswerFromRequest
 
Fc9-void-icon.png - VOID Return


MakeArpRequest

Fc9-comp-macro.png MakeArpRequest
 
Fc9-u8-icon.png - BYTE ServerIP
 
Fc9-void-icon.png - VOID Return


MakeEchoReplyFromRequest

Fc9-comp-macro.png MakeEchoReplyFromRequest
 
Fc9-u16-icon.png - UINT Length
 
Fc9-void-icon.png - VOID Return


MakeTcpAckFromAny

Fc9-comp-macro.png MakeTcpAckFromAny
 
Fc9-u16-icon.png - UINT Port
 
Fc9-void-icon.png - VOID Return


MakeTcpAckWithData

Fc9-comp-macro.png MakeTcpAckWithData
 
Fc9-u16-icon.png - UINT DataLength
 
Fc9-void-icon.png - VOID Return


MakeTcpSynackFromSyn

Fc9-comp-macro.png MakeTcpSynackFromSyn
 
Fc9-u16-icon.png - UINT Port
 
Fc9-void-icon.png - VOID Return


PacketReceive

Fc9-comp-macro.png PacketReceive
Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received. 
Fc9-u16-icon.png - UINT Return


PacketSend

Fc9-comp-macro.png PacketSend
Attempts to transmit a data packet to the ENC28J60 module. 
Fc9-u16-icon.png - UINT Length
 
Fc9-void-icon.png - VOID Return


ReadArrayFromBuffer

Fc9-comp-macro.png ReadArrayFromBuffer
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. 
Fc9-u16-icon.png - UINT BufferLocation
 
Fc9-u8-icon.png - BYTE NumberOfBytes
Number of bytes to read from the buffer and store into string 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


ReadRegister

Fc9-comp-macro.png ReadRegister
Reads the value from a single register onboard the ENC28J60 module. 
Fc9-u8-icon.png - BYTE Address
 
Fc9-u8-icon.png - BYTE Return


ReadStringFromBuffer

Fc9-comp-macro.png ReadStringFromBuffer
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. 
Fc9-u16-icon.png - UINT BufferLocation
 
Fc9-u8-icon.png - BYTE NumberOfBytes
Number of bytes to read from the buffer and store into string 
Fc9-string-icon.png - STRING Return


SetMyIPAddress

Fc9-comp-macro.png SetMyIPAddress
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. 
Fc9-u8-icon.png - BYTE IP0
IP Address Parameter - e.g. 192 
Fc9-u8-icon.png - BYTE IP1
IP Address Parameter - e.g. 168 
Fc9-u8-icon.png - BYTE IP2
IP Address Parameter - e.g. 1 
Fc9-u8-icon.png - BYTE IP3
IP Address Parameter - e.g. 250 
Fc9-void-icon.png - VOID Return


SetMyMACAddress

Fc9-comp-macro.png SetMyMACAddress
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. 
Fc9-u8-icon.png - BYTE MAC0
MAC Address Parameter 
Fc9-u8-icon.png - BYTE MAC1
MAC Address Parameter 
Fc9-u8-icon.png - BYTE MAC2
MAC Address Parameter 
Fc9-u8-icon.png - BYTE MAC3
MAC Address Parameter 
Fc9-u8-icon.png - BYTE MAC4
MAC Address Parameter 
Fc9-u8-icon.png - BYTE MAC5
MAC Address Parameter 
Fc9-void-icon.png - VOID Return


WriteRegister

Fc9-comp-macro.png WriteRegister
Writes a value to a single register onboard the ENC28J60 module. 
Fc9-u8-icon.png - BYTE Address
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png TCP IP Specifics
Fc9-type-21-icon.png Server Port
Sets the server's TCP/IP port address which is used to filter incoming TCP packets. 
Fc9-type-21-icon.png Buffer Size
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 
Fc9-conn-icon.png SPI Settings
Fc9-type-16-icon.png Channel
SPI Channel selector 
Fc9-type-16-icon.png Prescale
Prescale option selector 
Fc9-type-5-icon.png MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
Fc9-type-5-icon.png MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
Fc9-type-5-icon.png CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
Fc9-type-5-icon.png CS / SS
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
Fc9-type-5-icon.png Reset Pin
 
Fc9-conn-icon.png MAC Address
Fc9-type-21-icon.png MAC0
 
Fc9-type-21-icon.png MAC1
 
Fc9-type-21-icon.png MAC2
 
Fc9-type-21-icon.png MAC3
 
Fc9-type-21-icon.png MAC4
 
Fc9-type-21-icon.png MAC5
 
Fc9-conn-icon.png IP Address
Fc9-type-21-icon.png IP0
 
Fc9-type-21-icon.png IP1
 
Fc9-type-21-icon.png IP2
 
Fc9-type-21-icon.png IP3
 
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
 
Fc9-type-16-icon.png Sim Type
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. 
Fc9-conn-icon.png SPI Simulation
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically generated or not 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-16-icon.png API