Difference between revisions of "Component: TCP/IP Dummy (ENC28J60) (Comms: Networking)"
Line 82: | Line 82: | ||
The HTML to drive the web pages is included in the flowchart near the bottom of the main program loop. | 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}} | {{Fcfile|ENC28J60_Example.fcfx|ENC28J60 Example}} | ||
+ | |||
+ | |||
Line 87: | Line 89: | ||
==Macro reference== | ==Macro reference== | ||
+ | ===PacketSend=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 105: | Line 108: | ||
+ | ===MakeTcpSynackFromSyn=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 123: | Line 127: | ||
+ | ===MakeArpRequest=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 141: | Line 146: | ||
+ | ===InitialiseDataLengthInfo=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 154: | Line 160: | ||
+ | ===MakeTcpAckFromAny=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 172: | Line 179: | ||
+ | ===PacketReceive=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 185: | Line 193: | ||
+ | ===CheckForTCPType=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 198: | Line 207: | ||
+ | ===CheckArpPacketIsMyreplyArp=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 211: | Line 221: | ||
+ | ===CheckForIp=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 229: | Line 240: | ||
+ | ===CheckForTCPPort=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 247: | Line 259: | ||
+ | ===CheckForPing=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 260: | Line 273: | ||
+ | ===GetModuleRevision=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 273: | Line 287: | ||
+ | ===MakeTcpAckWithData=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 291: | Line 306: | ||
+ | ===MakeArpAnswerFromRequest=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 304: | Line 320: | ||
+ | ===ReadRegister=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 322: | Line 339: | ||
+ | ===CheckForARP=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 340: | Line 358: | ||
+ | ===ClientSendPacket=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 398: | Line 417: | ||
+ | ===MakeEchoReplyFromRequest=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 416: | Line 436: | ||
+ | ===ControlLEDs=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 434: | Line 455: | ||
+ | ===GetDataLength=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 447: | Line 469: | ||
+ | ===GetTcpDataPointer=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 460: | Line 483: | ||
+ | ===WriteRegister=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 483: | Line 507: | ||
+ | ===FillTcpData=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 506: | Line 531: | ||
+ | ===ReadStringFromBuffer=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 529: | Line 555: | ||
+ | ===GetSendersMAC=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 547: | Line 574: | ||
+ | ===FillTcpArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 575: | Line 603: | ||
+ | ===Initialise=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- |
Revision as of 11:52, 3 February 2023
Author | Matrix TSL |
Version | 2.0 |
Category | Comms: Networking |
Contents
- 1 TCP/IP Dummy component
- 2 Component Source Code
- 3 Detailed description
- 4 Examples
- 5 Macro reference
- 5.1 PacketSend
- 5.2 MakeTcpSynackFromSyn
- 5.3 MakeArpRequest
- 5.4 InitialiseDataLengthInfo
- 5.5 MakeTcpAckFromAny
- 5.6 PacketReceive
- 5.7 CheckForTCPType
- 5.8 CheckArpPacketIsMyreplyArp
- 5.9 CheckForIp
- 5.10 CheckForTCPPort
- 5.11 CheckForPing
- 5.12 GetModuleRevision
- 5.13 MakeTcpAckWithData
- 5.14 MakeArpAnswerFromRequest
- 5.15 ReadRegister
- 5.16 CheckForARP
- 5.17 ClientSendPacket
- 5.18 MakeEchoReplyFromRequest
- 5.19 ControlLEDs
- 5.20 GetDataLength
- 5.21 GetTcpDataPointer
- 5.22 WriteRegister
- 5.23 FillTcpData
- 5.24 ReadStringFromBuffer
- 5.25 GetSendersMAC
- 5.26 FillTcpArray
- 5.27 Initialise
- 6 Property reference
TCP/IP Dummy 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_Dummy.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_TCPIP_ENC28J60_Dummy.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.
ENC28J60 Example
Macro reference
PacketSend
![]() |
PacketSend |
Attempts to transmit a data packet to the ENC28J60 module. | |
![]() |
Length |
![]() |
Return |
MakeTcpSynackFromSyn
![]() |
MakeTcpSynackFromSyn |
![]() |
Port |
![]() |
Return |
MakeArpRequest
![]() |
MakeArpRequest |
[[File:]] - | ServerIP |
![]() |
Return |
InitialiseDataLengthInfo
![]() |
InitialiseDataLengthInfo |
Initialises the data pointers to allow us to craft a response containing data | |
![]() |
Return |
MakeTcpAckFromAny
![]() |
MakeTcpAckFromAny |
![]() |
Port |
![]() |
Return |
PacketReceive
![]() |
PacketReceive |
Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received. | |
![]() |
Return |
CheckForTCPType
![]() |
CheckForTCPType |
Checks to what kind of TCP type the received data is requesting. Returns a bit field specifying the type of request. 0x01 = Ack Requires, 0x02 = Synchronise 0x10 = Ack | |
![]() |
Return |
CheckArpPacketIsMyreplyArp
![]() |
CheckArpPacketIsMyreplyArp |
![]() |
Return |
CheckForIp
![]() |
CheckForIp |
Checks to see if the received data is an IP request with my IP address. | |
![]() |
Length |
![]() |
Return |
CheckForTCPPort
![]() |
CheckForTCPPort |
Checks to see if the received data is requesting the server port | |
![]() |
Port |
![]() |
Return |
CheckForPing
![]() |
CheckForPing |
Checks to see if the received data is a Ping request | |
![]() |
Return |
GetModuleRevision
![]() |
GetModuleRevision |
Requets the module revision number and returns the value supplied by the module's firmware. | |
![]() |
Return |
MakeTcpAckWithData
![]() |
MakeTcpAckWithData |
![]() |
DataLength |
![]() |
Return |
MakeArpAnswerFromRequest
![]() |
MakeArpAnswerFromRequest |
![]() |
Return |
ReadRegister
![]() |
ReadRegister |
Reads the value from a single register onboard the ENC28J60 module. | |
![]() |
Address |
![]() |
Return |
CheckForARP
![]() |
CheckForARP |
Checks to see if the received data is an ARP request with my IP address. | |
![]() |
Length |
![]() |
Return |
ClientSendPacket
![]() |
ClientSendPacket |
![]() |
DestPort |
![]() |
SourcePort |
![]() |
Flags |
![]() |
MaxSegmentSize |
![]() |
ClearSeqAck |
![]() |
NextAckNum |
![]() |
DataLength |
![]() |
DestMac |
![]() |
DestIp |
![]() |
Return |
MakeEchoReplyFromRequest
![]() |
MakeEchoReplyFromRequest |
![]() |
Length |
![]() |
Return |
ControlLEDs
![]() |
ControlLEDs |
Allows both the LEDs on the Ethernet socket to be controlled. Useful for checking if the SPI communications are functioning correctly. | |
![]() |
Mode |
0=Off, 1=On, 2=Auto | |
![]() |
Return |
GetDataLength
![]() |
GetDataLength |
Returns the number of received data bytes after the headers | |
![]() |
Return |
GetTcpDataPointer
![]() |
GetTcpDataPointer |
![]() |
Return |
WriteRegister
![]() |
WriteRegister |
Writes a value to a single register onboard the ENC28J60 module. | |
![]() |
Address |
![]() |
Data |
![]() |
Return |
FillTcpData
![]() |
FillTcpData |
![]() |
Position |
![]() |
Data |
![]() |
Return |
ReadStringFromBuffer
GetSendersMAC
![]() |
GetSendersMAC |
Gets the MAC address from locations 6-11 of the IP Header | |
![]() |
MAC |
6-byte Array to store the MAC address | |
![]() |
Return |
FillTcpArray
![]() |
FillTcpArray |
![]() |
Position |
![]() |
Count |
![]() |
Data |
![]() |
Return |
Initialise
Property reference
![]() |
Properties |