Difference between revisions of "Component: TCP/IP (ENC28J60) (Comms: Networking)"
From Flowcode Help
Jump to navigationJump to search(2 intermediate revisions by 2 users not shown) | |||
Line 14: | Line 14: | ||
==TCP/IP component== | ==TCP/IP 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 | 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 Pack== | ||
+ | |||
+ | COMMSA | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
+ | |||
+ | |||
Line 26: | Line 34: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
+ | |||
+ | |||
Line 40: | Line 52: | ||
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}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Downloadable macro reference== | ==Downloadable macro reference== | ||
Line 662: | Line 668: | ||
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | | 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 | ||
|- | |- | ||
|- | |- | ||
Line 673: | Line 683: | ||
|- | |- | ||
| colspan="2" | Number of bytes to use for the transmit and receive buffer, we actually use this +1 to allow for a null termination. 8-bit PICs should set this to 255 to allow compilation to succeed. Other devices can have larger buffers. Default = 500 | | colspan="2" | Number of bytes to use for the transmit and receive buffer, we actually use this +1 to allow for a null termination. 8-bit PICs should set this to 255 to allow compilation to succeed. Other devices can have larger buffers. Default = 500 | ||
+ | |- | ||
+ | | width="10%" align="center" 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="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
Line 708: | Line 722: | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
+ | |- | ||
+ | | 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="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
Line 738: | Line 756: | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
+ | |- | ||
+ | | 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="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
Line 759: | Line 781: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] |
− | | width="90%" | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation |
− | |||
− | |||
|- | |- | ||
− | |||
− | |||
|- | |- | ||
− | + | | width="10%" align="center" | [[File:Fc9-type-10-icon.png]] | |
− | + | | width="90%" | Label | |
− | | width="10%" align="center" | [[File:Fc9-type- | ||
− | | width="90%" | | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
− | | width="90%" | | + | | width="90%" | Sim Type |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Decides how to perform the simulation of the component. TCP IP - Communicates using the Windows TCP IP communications DLL SPI / API - Communicates using the CAL SPI to allow the communications to be analysed and debugged. |
|- | |- | ||
− | | width="10%" align="center" style="background-color:# | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] |
− | | width="90%" style="background-color:# | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI Simulation |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] |
− | | width="90% | + | | width="90%" | Scope Traces |
|- | |- | ||
+ | | colspan="2" | Selects if the scope traces are automatically generated or not | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9-type- | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] |
− | | width="90%" | | + | | width="90%" | Console Data |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Selects if the console data is automatically generated or not |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
− | | width="90%" | | + | | width="90%" | API |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|} | |} |
Latest revision as of 17:24, 9 November 2022
Author | Matrix TSL |
Version | 2.2 |
Category | Comms: Networking |
Contents
TCP/IP 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 Pack
COMMSA
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
Downloadable macro reference
![]() |
PacketSend |
Attempts to transmit a data packet to the ENC28J60 module. | |
![]() |
Length |
![]() |
Return |
![]() |
MakeTcpSynackFromSyn |
![]() |
Port |
![]() |
Return |
![]() |
MakeArpRequest |
[[File:]] - | ServerIP |
![]() |
Return |
![]() |
InitialiseDataLengthInfo |
Initialises the data pointers to allow us to craft a response containing data | |
![]() |
Return |
![]() |
MakeTcpAckFromAny |
![]() |
Port |
![]() |
Return |
![]() |
PacketReceive |
Attempts to receive a data packet from the ENC28J60 module. Returns the number of bytes received. | |
![]() |
Return |
![]() |
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 |
![]() |
Return |
![]() |
CheckForIp |
Checks to see if the received data is an IP request with my IP address. | |
![]() |
Length |
![]() |
Return |
![]() |
CheckForTCPPort |
Checks to see if the received data is requesting the server port | |
![]() |
Port |
![]() |
Return |
![]() |
CheckForPing |
Checks to see if the received data is a Ping request | |
![]() |
Return |
![]() |
GetModuleRevision |
Requets the module revision number and returns the value supplied by the module's firmware. | |
![]() |
Return |
![]() |
MakeTcpAckWithData |
![]() |
DataLength |
![]() |
Return |
![]() |
MakeArpAnswerFromRequest |
![]() |
Return |
![]() |
ReadRegister |
Reads the value from a single register onboard the ENC28J60 module. | |
![]() |
Address |
![]() |
Return |
![]() |
CheckForARP |
Checks to see if the received data is an ARP request with my IP address. | |
![]() |
Length |
![]() |
Return |
![]() |
ClientSendPacket |
![]() |
DestPort |
![]() |
SourcePort |
![]() |
Flags |
![]() |
MaxSegmentSize |
![]() |
ClearSeqAck |
![]() |
NextAckNum |
![]() |
DataLength |
![]() |
DestMac |
![]() |
DestIp |
![]() |
Return |
![]() |
MakeEchoReplyFromRequest |
![]() |
Length |
![]() |
Return |
![]() |
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 |
Returns the number of received data bytes after the headers | |
![]() |
Return |
![]() |
GetTcpDataPointer |
![]() |
Return |
![]() |
WriteRegister |
Writes a value to a single register onboard the ENC28J60 module. | |
![]() |
Address |
![]() |
Data |
![]() |
Return |
![]() |
FillTcpData |
![]() |
Position |
![]() |
Data |
![]() |
Return |
![]() |
GetSendersMAC |
Gets the MAC address from locations 6-11 of the IP Header | |
![]() |
MAC |
6-byte Array to store the MAC address | |
![]() |
Return |
![]() |
FillTcpArray |
![]() |
Position |
![]() |
Count |
![]() |
Data |
![]() |
Return |