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

From Flowcode Help
Jump to navigationJump to search
(Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix TSL |- | width="20%" style="color:gray;" | Version | 2.2 |- | width="20%" style="color:gray...")
 
 
(5 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==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
 
''No detailed description exists yet for this component''
 
''No detailed description exists yet for this component''
  
 
==Examples==
 
==Examples==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 28: 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}}
Additional examples can be found in the “Apps and Bundles” section of this Wiki:
 
 
[[Internet_Application_Guide | Internet Application Guide]]
 
 
[[Wireless_LAN_Application_Guide | Wireless LAN Application Guide]]
 
 
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==
Line 636: Line 654:
 
| colspan="2" | Initialises the SPI connection to the TCPIP module and sets up some initial values. Flashes the LEDs on and off twice to confirm SPI comms are active. LEDs are then configured to auto functionality. 
 
| colspan="2" | Initialises the SPI connection to the TCPIP module and sets up some initial values. Flashes the LEDs on and off twice to confirm SPI comms are active. LEDs are then configured to auto functionality. 
 
|-
 
|-
|-
 
| 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;" | '''RxFlushData_Sim'''
 
|-
 
| colspan="2" | Once data reception has been completed, this macro should be called to discard the data packet and allow other data packets to be read. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''RxDataSize'''
 
|-
 
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''CreateMACSocket'''
 
|-
 
| colspan="2" | This macro creates a socket for sending and receiving Ethernet data using raw data. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Promiscuous
 
|-
 
| colspan="2" | Receive everything (1) or just data bound for your MAC (0) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Broadcast
 
|-
 
| colspan="2" | Allows broadcast messages to be accepted (1) or rejected (0) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Error
 
|-
 
| colspan="2" | Allowsmessages with errors to be accepted (1) or rejected (0) 
 
|-
 
| 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;" | '''CreateUDPSocket_Sim'''
 
|-
 
| colspan="2" | This macro creates a socket for sending and receiving UDP data. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Src_Port
 
|-
 
| colspan="2" | Port Number 
 
|-
 
| 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;" | '''TxSendMyMAC'''
 
|-
 
| colspan="2" | This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''SetMACAddress'''
 
|-
 
| colspan="2" | This macro sets up the Internet E-Block's MAC address.  In most circumstances, this macro will not be required as the MAC address setting in the component property page will remain constant throughout your application. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC0
 
|-
 
| colspan="2" | First Byte of address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC1
 
|-
 
| colspan="2" | Second Byte of address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC2
 
|-
 
| colspan="2" | Third Byte of address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC3
 
|-
 
| colspan="2" | Fourth Byte of address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC4
 
|-
 
| colspan="2" | Fourth Byte of address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC5
 
|-
 
| colspan="2" | Fifth Byte of address 
 
|-
 
| 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;" | '''RxMatch_4_Bytes_Sim'''
 
|-
 
| colspan="2" | This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as those passed as parameters.  There are similar functions that check for 2 bytes and 6 bytes. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Byte1
 
|-
 
| colspan="2" | Specifies the value of the first byte 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Byte2
 
|-
 
| colspan="2" | Specifies the value of the second byte 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Byte3
 
|-
 
| colspan="2" | Specifies the value of the third byte 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Byte4
 
|-
 
| colspan="2" | Specifies the value of the fourth byte 
 
|-
 
| 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;" | '''RxDataSize_Sim'''
 
|-
 
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''SetSubnetMask'''
 
|-
 
| colspan="2" | This macro sets up the Internet E-Block's Subnet Mask.  In most circumstances, this macro will not be required as the subnet mask setting in the component property page will remain constant throughout your application. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP0
 
|-
 
| colspan="2" | First Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP1
 
|-
 
| colspan="2" | Second Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP2
 
|-
 
| colspan="2" | Third Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP3
 
|-
 
| colspan="2" | Fourth Byte of IP address 
 
|-
 
| 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;" | '''RxMatch_2_Bytes_Sim'''
 
|-
 
| colspan="2" | This macro returns a non-zero value when the next 2 bytes of data in the specified channel's reception buffer are the same as those passed as parameters.  There are similar functions that check for 4 bytes and 6 bytes. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Byte1
 
|-
 
| colspan="2" | Specifies the value of the first byte 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Byte2
 
|-
 
| colspan="2" | Specifies the value of the second byte 
 
|-
 
| 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;" | '''RxMatchMyMAC_Sim'''
 
|-
 
| colspan="2" | This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's IP address. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''TCPClose'''
 
|-
 
| colspan="2" | When an established TCP connection has finished transmission of data, either the local application (i.e. your code) or the remote application (i.e. the application at the other end of the connection) can initiate closure of the socket. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''GetSocketStatus'''
 
|-
 
| colspan="2" | This returns the state of the requested channel's socket. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''Initialise'''
 
|-
 
| colspan="2" | Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros  
 
|-
 
|-
 
| 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;" | '''SetGateway'''
 
|-
 
| colspan="2" | This macro sets up the Internet E-Block's Gateway address.  In most circumstances, this macro will not be required as the gateway address setting in the component property page will remain constant throughout your application. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP0
 
|-
 
| colspan="2" | First Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP1
 
|-
 
| colspan="2" | Second Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP2
 
|-
 
| colspan="2" | Third Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP3
 
|-
 
| colspan="2" | Fourth Byte of IP address 
 
|-
 
| 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;" | '''RxDataSize'''
 
|-
 
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''TxSendMyMAC'''
 
|-
 
| colspan="2" | This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''CreateMACSocket'''
 
|-
 
| colspan="2" | This macro creates a socket for sending and receiving Ethernet data using raw data. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Promiscuous
 
|-
 
| colspan="2" | Receive everything (1) or just data bound for your MAC (0) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Broadcast
 
|-
 
| colspan="2" | Allows broadcast messages to be accepted (1) or rejected (0) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Error
 
|-
 
| colspan="2" | Allowsmessages with errors to be accepted (1) or rejected (0) 
 
|-
 
| 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;" | '''GetSocketStatus'''
 
|-
 
| colspan="2" | This returns the state of the requested channel's socket. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''Initialise'''
 
|-
 
| colspan="2" | Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros  
 
|-
 
|-
 
| 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;" | '''TCPClose'''
 
|-
 
| colspan="2" | When an established TCP connection has finished transmission of data, either the local application (i.e. your code) or the remote application (i.e. the application at the other end of the connection) can initiate closure of the socket. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''RxMatchMyMAC'''
 
|-
 
| colspan="2" | This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's MAC address entered in the component's property page. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''RxDataSize'''
 
|-
 
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''ControlLEDs'''
 
|-
 
| colspan="2" | Allows both the LEDs on the Ethernet socket to be controlled. Useful for checking if the SPI communications are functioning correctly. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Mode
 
|-
 
| colspan="2" | 0=Off, 1=On, 2=Auto 
 
|-
 
| 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 
 
|-
 
|-
 
| 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;" | '''TxSendMyMAC'''
 
|-
 
| colspan="2" | This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Channel
 
|-
 
| colspan="2" | Specifies the communications channel 0-3 
 
|-
 
| 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;" | '''CreateMACSocket'''
 
|-
 
| colspan="2" | This macro creates a socket for sending and receiving Ethernet data using raw data. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Promiscuous
 
|-
 
| colspan="2" | Receive everything (1) or just data bound for your MAC (0) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Broadcast
 
|-
 
| colspan="2" | Allows broadcast messages to be accepted (1) or rejected (0) 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Error
 
|-
 
| colspan="2" | Allowsmessages with errors to be accepted (1) or rejected (0) 
 
|-
 
| 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;" | '''SetMACAddress'''
 
|-
 
| 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. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC0
 
|-
 
| colspan="2" | MAC Address Parameter 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC1
 
|-
 
| colspan="2" | MAC Address Parameter 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC2
 
|-
 
| colspan="2" | MAC Address Parameter 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC3
 
|-
 
| colspan="2" | MAC Address Parameter 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC4
 
|-
 
| colspan="2" | MAC Address Parameter 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | MAC5
 
|-
 
| colspan="2" | MAC Address Parameter 
 
|-
 
| 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;" | '''GetTcpDataPointer'''
 
|-
 
| colspan="2" |  
 
|-
 
|-
 
| 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;" | '''SetSubnetMask'''
 
|-
 
| colspan="2" | This macro sets up the Internet E-Block's Subnet Mask.  In most circumstances, this macro will not be required as the subnet mask setting in the component property page will remain constant throughout your application. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP0
 
|-
 
| colspan="2" | First Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP1
 
|-
 
| colspan="2" | Second Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP2
 
|-
 
| colspan="2" | Third Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP3
 
|-
 
| colspan="2" | Fourth Byte of IP address 
 
|-
 
| 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;" | '''WriteRegister'''
 
|-
 
| colspan="2" | Writes a value to a single register onboard the ENC28J60 module. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Address
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Data
 
|-
 
| colspan="2" |  
 
|-
 
| 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" |  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Position
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Data
 
|-
 
| colspan="2" |  
 
|-
 
| 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. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | BufferLocation
 
|-
 
| colspan="2" |  
 
|-
 
| 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 
 
|-
 
| 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;" | '''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. 
 
|-
 
|-
 
| 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;" | '''SetGateway'''
 
|-
 
| colspan="2" | This macro sets up the Internet E-Block's Gateway address.  In most circumstances, this macro will not be required as the gateway address setting in the component property page will remain constant throughout your application. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP0
 
|-
 
| colspan="2" | First Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP1
 
|-
 
| colspan="2" | Second Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP2
 
|-
 
| colspan="2" | Third Byte of IP address 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | IP3
 
|-
 
| colspan="2" | Fourth Byte of IP address 
 
 
|-
 
|-
 
| 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,445: 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 1,456: 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 1,491: 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 1,521: 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 1,542: Line 781:
 
| colspan="2" |  
 
| colspan="2" |  
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" | Scope Traces
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
|-
 
|-
| colspan="2" | Selects if the scope traces are automatically generated or not 
 
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | Console Data
+
| width="90%" | Label
|-
 
| colspan="2" | Selects if the console data is automatically generated or not 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | API
 
 
|-
 
|-
 
| 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%" | Network Interface
+
| width="90%" | Sim Type
 
|-
 
|-
| colspan="2" | List of network interfaces connected to the PC.  Sets which interface we are communicating via. 
+
| 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:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI Simulation
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
+
| width="90%" | Scope Traces
 
|-
 
|-
 +
| colspan="2" | Selects if the scope traces are automatically generated or not 
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| width="90%" | Label
+
| 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%" | Sim Type
+
| width="90%" | API
 
|-
 
|-
| colspan="2" | Decides how to perform the simulation of the component. TCP IP - Communicates using the Windows TCP IP communications DLL SPI / API - Communicates using the CAL SPI to allow the communications to be analysed and debugged. 
+
| colspan="2" |  
 
|}
 
|}

Latest revision as of 17:24, 9 November 2022

Author Matrix TSL
Version 2.2
Category Comms: Networking


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

Downloadable macro reference

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


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


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


Fc9-comp-macro.png MakeArpRequest
 
[[File:]] - ServerIP
 
Fc9-void-icon.png - VOID Return


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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



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