Jump to content

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

From Flowcode Help
No edit summary
No edit summary
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/FC_Comp_Source_TCPIP_ENC28J60.fcfx FC_Comp_Source_TCPIP_ENC28J60.fcfx]
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/TCPIP_ENC28J60.fcfx FC_Comp_Source_temp/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_temp/TCPIP_ENC28J60.fcfx FC_Comp_Source_temp/TCPIP_ENC28J60.fcfx]


==Detailed description==
==Detailed description==
Line 44: Line 44:


''<span style="color:red;">No additional examples</span>''
''<span style="color:red;">No additional examples</span>''




Line 51: Line 53:
==Macro reference==
==Macro reference==


===SetMyIPAddress===
===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;" | '''SetMyIPAddress'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckArpPacketIsMyreplyArp'''
|-
|-
| 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" | &nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP0
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===CheckForARP===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| colspan="2" | IP Address Parameter - e.g. 192&nbsp;
| 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="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| colspan="2" | Checks to see if the received data is an ARP request with my IP address.&nbsp;
| width="90%" | IP1
|-
|-
| 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-u16-icon.png]] - UINT
| width="90%" | IP2
| width="90%" | Length
|-
|-
| colspan="2" | IP Address Parameter - e.g. 1&nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===PacketSend===
===CheckForIp===
{| 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;" | '''CheckForIp'''
|-
|-
| colspan="2" | Attempts to transmit a data packet to the ENC28J60 module.&nbsp;
| colspan="2" | Checks to see if the received data is an IP request with my IP address.&nbsp;
|-
|-
|-
|-
Line 99: Line 100:
| colspan="2" | &nbsp;
| 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-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===MakeTcpSynackFromSyn===
===CheckForPing===
{| 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;" | '''CheckForPing'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Checks to see if the received data is a Ping request&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===MakeArpRequest===
===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;" | '''MakeArpRequest'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForTCPPort'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Checks to see if the received data is requesting the server port&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:]] -  
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | ServerIP
| width="90%" | Port
|-
|-
| colspan="2" | &nbsp;
| 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-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===InitialiseDataLengthInfo===
===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;" | '''InitialiseDataLengthInfo'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForTCPType'''
|-
|-
| colspan="2" | Initialises the data pointers to allow us to craft a response containing data&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" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| 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''
|}
|}




===MakeTcpAckFromAny===
===ClientSendPacket===
{| 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;" | '''MakeTcpAckFromAny'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ClientSendPacket'''
|-
| colspan="2" | &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="90%" | Flags
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | MaxSegmentSize
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ClearSeqAck
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &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="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
| width="90%" | DataLength
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | DestMac
|}
 
 
===PacketReceive===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | &nbsp;
| 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" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DestIp
|-
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| 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''
|}
|}




===CheckForTCPType===
===ControlLEDs===
{| 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;" | '''CheckForTCPType'''
| 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" | 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-u8-icon.png]] - BYTE
| width="90%" | Mode
|-
|-
| colspan="2" | 0=Off, 1=On, 2=Auto&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''
|}
|}




===CheckArpPacketIsMyreplyArp===
===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;" | '''CheckArpPacketIsMyreplyArp'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FillTcpArray'''
|-
|-
| 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-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Position
|}
 
 
===CheckForIp===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | &nbsp;
| 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="90%" | Count
|-
|-
| 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%" | Length
| width="90%" | Data
|-
|-
| 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''
|}
|}




===CheckForTCPPort===
===FillTcpData===
{| 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;" | '''FillTcpData'''
|-
|-
| colspan="2" | Checks to see if the received data is requesting the server port&nbsp;
| 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%" | Position
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
|-
| 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-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===CheckForPing===
===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;" | '''CheckForPing'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDataLength'''
|-
|-
| colspan="2" | Checks to see if the received data is a Ping request&nbsp;
| 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-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''
|}
|}
Line 283: Line 311:




===MakeTcpAckWithData===
===GetSendersMAC===
{| 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;" | '''MakeTcpAckWithData'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSendersMAC'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Gets the MAC address from locations 6-11 of the IP Header&nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DataLength
| width="90%" | MAC
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | 6-byte Array to store the MAC address&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 302: Line 330:




===SetMyMACAddress===
===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;" | '''SetMyMACAddress'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTcpDataPointer'''
|-
|-
| 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;
| colspan="2" | &nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | MAC0
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| colspan="2" | MAC Address Parameter&nbsp;
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| 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="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="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 346: Line 358:




===MakeArpAnswerFromRequest===
===InitialiseDataLengthInfo===
{| 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;" | '''MakeArpAnswerFromRequest'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''InitialiseDataLengthInfo'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Initialises the data pointers to allow us to craft a response containing data&nbsp;
|-
|-
|-
|-
Line 360: Line 372:




===ReadArrayFromBuffer===
===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;" | '''ReadArrayFromBuffer'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpAnswerFromRequest'''
|-
| 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;
| 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="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 389: Line 386:




===ReadRegister===
===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;" | '''ReadRegister'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeArpRequest'''
|-
|-
| colspan="2" | Reads the value from a single register onboard the ENC28J60 module.&nbsp;
| colspan="2" | &nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:]] -  
| width="90%" | Address
| width="90%" | ServerIP
|-
|-
| 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''
|}
|}




===CheckForARP===
===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;" | '''CheckForARP'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeEchoReplyFromRequest'''
|-
|-
| colspan="2" | Checks to see if the received data is an ARP request with my IP address.&nbsp;
| colspan="2" | &nbsp;
|-
|-
|-
|-
Line 422: Line 419:
| 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''
|}
|}




===ClientSendPacket===
===MakeTcpAckFromAny===
{| 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;" | '''MakeTcpAckFromAny'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 437: Line 434:
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | DestPort
| width="90%" | Port
|-
| 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="90%" | Flags
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | MaxSegmentSize
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | ClearSeqAck
|-
| colspan="2" | &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="90%" | DestMac
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | DestIp
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 486: Line 443:




===MakeEchoReplyFromRequest===
===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;" | '''MakeEchoReplyFromRequest'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpAckWithData'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | &nbsp;
Line 496: Line 453:
|-
|-
| 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;
Line 505: Line 462:




===ControlLEDs===
===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;" | '''ControlLEDs'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MakeTcpSynackFromSyn'''
|-
|-
| 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" | &nbsp;
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Mode
| width="90%" | Port
|-
|-
| colspan="2" | 0=Off, 1=On, 2=Auto&nbsp;
| 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 524: Line 481:




===GetDataLength===
===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;" | '''GetDataLength'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PacketReceive'''
|-
|-
| colspan="2" | Returns the number of received data bytes after the headers&nbsp;
| colspan="2" | Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received.&nbsp;
|-
|-
|-
|-
Line 538: Line 495:




===GetTcpDataPointer===
===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;" | '''GetTcpDataPointer'''
| 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;
| 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-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===WriteRegister===
===ReadArrayFromBuffer===
{| 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;" | '''WriteRegister'''
| 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;
|-
|-
|-
| 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="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%" | Address
| width="90%" | NumberOfBytes
|-
|-
| colspan="2" | &nbsp;
| 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="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
Line 576: Line 543:




===FillTcpData===
===ReadRegister===
{| 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;" | '''FillTcpData'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadRegister'''
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | Reads the value from 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;
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}
Line 624: Line 586:




===GetSendersMAC===
===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;" | '''GetSendersMAC'''
| 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;
|-
|-
| colspan="2" | Gets the MAC address from locations 6-11 of the IP Header&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="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | MAC
| width="90%" | IP3
|-
|-
| colspan="2" | 6-byte Array to store the MAC address&nbsp;
| 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 643: Line 620:




===FillTcpArray===
===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;" | '''FillTcpArray'''
| 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;
|-
|-
| colspan="2" | &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-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Position
| width="90%" | MAC3
|-
|-
| colspan="2" | &nbsp;
| colspan="2" | MAC Address Parameter&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Count
| width="90%" | MAC4
|-
|-
| 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%" | MAC5
|-
|-
| 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="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 672: Line 664:




===Initialise===
===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;" | '''Initialise'''
| 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" | 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" | [[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="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID

Revision as of 12:03, 3 February 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_temp/TCPIP_ENC28J60.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_temp/TCPIP_ENC28J60.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples




Macro reference

CheckArpPacketIsMyreplyArp

CheckArpPacketIsMyreplyArp
 
- BYTE Return


CheckForARP

CheckForARP
Checks to see if the received data is an ARP request with my IP address. 
- UINT Length
 
- BYTE Return


CheckForIp

CheckForIp
Checks to see if the received data is an IP request with my IP address. 
- UINT Length
 
- BYTE Return


CheckForPing

CheckForPing
Checks to see if the received data is a Ping request 
- BYTE Return


CheckForTCPPort

CheckForTCPPort
Checks to see if the received data is requesting the server port 
- UINT Port
 
- BYTE 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  
- BYTE Return


ClientSendPacket

ClientSendPacket
 
- UINT DestPort
 
- UINT SourcePort
 
- BYTE Flags
 
- BYTE MaxSegmentSize
 
- BYTE ClearSeqAck
 
- UINT NextAckNum
 
- UINT DataLength
 
- BYTE DestMac
 
- BYTE DestIp
 
- VOID Return


ControlLEDs

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


FillTcpArray

FillTcpArray
 
- UINT Position
 
- UINT Count
 
- BYTE Data
 
- VOID Return


FillTcpData

FillTcpData
 
- UINT Position
 
- STRING Data
 
- UINT Return


GetDataLength

GetDataLength
Returns the number of received data bytes after the headers 
- UINT Return


GetModuleRevision

GetModuleRevision
Requets the module revision number and returns the value supplied by the module's firmware. 
- BYTE Return


GetSendersMAC

GetSendersMAC
Gets the MAC address from locations 6-11 of the IP Header 
- BYTE MAC
6-byte Array to store the MAC address 
- VOID Return


GetTcpDataPointer

GetTcpDataPointer
 
- UINT Return


Initialise

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. 
- VOID Return


InitialiseDataLengthInfo

InitialiseDataLengthInfo
Initialises the data pointers to allow us to craft a response containing data 
- VOID Return


MakeArpAnswerFromRequest

MakeArpAnswerFromRequest
 
- VOID Return


MakeArpRequest

MakeArpRequest
 
[[File:]] - ServerIP
 
- VOID Return


MakeEchoReplyFromRequest

MakeEchoReplyFromRequest
 
- UINT Length
 
- VOID Return


MakeTcpAckFromAny

MakeTcpAckFromAny
 
- UINT Port
 
- VOID Return


MakeTcpAckWithData

MakeTcpAckWithData
 
- UINT DataLength
 
- VOID Return


MakeTcpSynackFromSyn

MakeTcpSynackFromSyn
 
- UINT Port
 
- VOID Return


PacketReceive

PacketReceive
Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received. 
- UINT Return


PacketSend

PacketSend
Attempts to transmit a data packet to the ENC28J60 module. 
- UINT Length
 
- VOID Return


ReadArrayFromBuffer

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. 
- UINT BufferLocation
 
- BYTE NumberOfBytes
Number of bytes to read from the buffer and store into string 
- BYTE Data
 
- VOID Return


ReadRegister

ReadRegister
Reads the value from a single register onboard the ENC28J60 module. 
- BYTE Address
 
- BYTE Return


ReadStringFromBuffer

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. 
- UINT BufferLocation
 
- BYTE NumberOfBytes
Number of bytes to read from the buffer and store into string 
- STRING Return


SetMyIPAddress

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. 
- BYTE IP0
IP Address Parameter - e.g. 192 
- BYTE IP1
IP Address Parameter - e.g. 168 
- BYTE IP2
IP Address Parameter - e.g. 1 
- BYTE IP3
IP Address Parameter - e.g. 250 
- VOID Return


SetMyMACAddress

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. 
- BYTE MAC0
MAC Address Parameter 
- BYTE MAC1
MAC Address Parameter 
- BYTE MAC2
MAC Address Parameter 
- BYTE MAC3
MAC Address Parameter 
- BYTE MAC4
MAC Address Parameter 
- BYTE MAC5
MAC Address Parameter 
- VOID Return


WriteRegister

WriteRegister
Writes a value to a single register onboard the ENC28J60 module. 
- BYTE Address
 
- BYTE Data
 
- VOID Return



Property reference

Properties
TCP IP Specifics
Server Port
Sets the server's TCP/IP port address which is used to filter incoming TCP packets. 
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 
SPI Settings
Channel
SPI Channel selector 
Prescale
Prescale option selector 
MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
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.  
Reset Pin
 
MAC Address
MAC0
 
MAC1
 
MAC2
 
MAC3
 
MAC4
 
MAC5
 
IP Address
IP0
 
IP1
 
IP2
 
IP3
 
Simulation
Label
 
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. 
SPI Simulation
Scope Traces
Selects if the scope traces are automatically generated or not 
Console Data
Selects if the console data is automatically generated or not 
API