Component: Webserver (NM7010A) (Comms: Networking)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd.
Version 1.4 (Release)
Category Comms: Networking


Image Webserver (NM7010A) component

Webserver component designed to work with the NM7010A module from Wiznet, as used in the version 1 EB023 E-block. Provides a very simple interface to allow webpages to be hosted from hardware or simulation.

Examples

This example starts a web page server running via the embedded external Wiznet module. The web page can be accessed by typing the IP address of the module into your browser.


The example also hosts a web page server during simulation using your PC. You can access the web pages served by the PC running Flowcode by using the localhost loopback IP address "127.0.0.1:5000" where 5000 is the port assigned to the Webserver component (0x1388 = 5000). You can access the web pages from a PC on a network by using the IP address of the machine running Flowcode and specifying the correct port. Port 80 is used by default for HTML transfer but windows can be a bit funny about what is allowed on port 80 so we have used port 5000 in the example. You may have to check your server PC's incoming firewall settings to get this fully functional via a remote PC. FC6 Icon.png Webpage Server Example Here is one of the pages generated by the example.

Webpage2.jpg


The TCPIP tab of the console window will show all the data sent and received during simulation which is useful for learning how things like web page servers work.

WebLog2.jpg


Please note that due to limitations with use if RAM storage on some processors you will need to ensure that each line of the page text (HTML) is quite short, usually below 100 characters. Otherwise this can cause an error such as “Error: No remaining RAM block (on target) big enough for:”


Additional examples can be found in the “Apps and Bundles” section of this Wiki:

Internet Application Guide

Wireless LAN Application Guide

Downloadable macro reference

SetOutValue

Set the value of an outbound substitution string

Parameters

BYTE index
<- STRING value
This parameter may be returned back to the caller


Return value

This call does not return a value


GetInValue

Returns the string value of a Request parameter

Parameters

BYTE index


Return value

STRING


CreateServerSocket

Creates a listening socket on the selected channel and port ready to accept incoming web page requests.

Parameters

BYTE Channel
BYTE Port_Hi
BYTE Port_Lo


Return value

BYTE


CheckSocketActivity

Checks for activity on the server socket and serves out the webpages to any requesting parties.

Parameters

This macro has no parameters


Return value

BYTE


Initialise

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

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Label

This property is of type Line of text and can be referenced with the variable name label.

Label used to help identify the component on the panel.

Max Channels

This property is of type Signed integer and can be referenced with the variable name max_channels.

Max number of concurrent channels allowed

I2C Address 0

This property is of type Fixed list of ints and can be referenced with the variable name I2C_Addr0.

I2C address of the module - bit 0

I2C Address 1

This property is of type Fixed list of ints and can be referenced with the variable name I2C_Addr1.

I2C address of the module - bit 1

I2C Address 2

This property is of type Fixed list of ints and can be referenced with the variable name I2C_Addr2.

I2C address of the module - bit 2

HTML Source

This property is of type Fixed list of ints and can be referenced with the variable name html_source.

Sets the method for streaming data, we can either host it loacally using a property or refer to external files.

Max Pages

This property is of type Signed integer and can be referenced with the variable name max_pages.

Maximum number of pages we can serve using the embedded page type webserver.

Name Page 1

This property is of type Line of text and can be referenced with the variable name name1.

Name of HTML page 1 - index.htm is the default page that will be presented.

HTML Page 1

This property is of type Multiple lines of text and can be referenced with the variable name html1.

Embedded HTML code used for page 1

Name Page 2

This property is of type Line of text and can be referenced with the variable name name2.

Name of HTML page 2

HTML Page 2

This property is of type Multiple lines of text and can be referenced with the variable name html2.

Embedded HTML code used for page 2

Name Page 3

This property is of type Line of text and can be referenced with the variable name name3.

Name of HTML page 3

HTML Page 3

This property is of type Multiple lines of text and can be referenced with the variable name html3.

Embedded HTML code used for page 3

Name Page 4

This property is of type Line of text and can be referenced with the variable name name4.

Name of HTML page 4

HTML Page 4

This property is of type Multiple lines of text and can be referenced with the variable name html4.

Embedded HTML code used for page 4

I2C Channel

This property is of type Fixed list of ints and can be referenced with the variable name channel.

I2C channel selection

Int Pin

This property is of type Single digital pin and can be referenced with the variable name int_pin.

Interrupt pin connection on Wiznet module

SDA Pin

This property is of type Single digital pin and can be referenced with the variable name sda_pin.

I2C serial data pin connection on Wiznet module

SCL Pin

This property is of type Single digital pin and can be referenced with the variable name scl_pin.

I2C serial clock pin connection on Wiznet module

Gateway0

This property is of type Signed integer and can be referenced with the variable name gateway0.

IP address of the gateway to the internet if applicable.

Gateway1

This property is of type Signed integer and can be referenced with the variable name gateway1.

IP address of the gateway to the internet if applicable.

Gateway2

This property is of type Signed integer and can be referenced with the variable name gateway2.

IP address of the gateway to the internet if applicable.

Gateway3

This property is of type Signed integer and can be referenced with the variable name gateway3.

IP address of the gateway to the internet if applicable.

Subnet0

This property is of type Signed integer and can be referenced with the variable name subnet0.

Subnet mask of the server - usually 255.255.255.0

Subnet1

This property is of type Signed integer and can be referenced with the variable name subnet1.

Subnet mask of the server - usually 255.255.255.0

Subnet2

This property is of type Signed integer and can be referenced with the variable name subnet2.

Subnet mask of the server - usually 255.255.255.0

Subnet3

This property is of type Signed integer and can be referenced with the variable name subnet3.

Subnet mask of the server - usually 255.255.255.0

IP0

This property is of type Signed integer and can be referenced with the variable name ip0.

IP address of the server - usually 192.168.0.x or 192.168.1.x

IP1

This property is of type Signed integer and can be referenced with the variable name ip1.

IP address of the server - usually 192.168.0.x or 192.168.1.x

IP2

This property is of type Signed integer and can be referenced with the variable name ip2.

IP address of the server - usually 192.168.0.x or 192.168.1.x

IP3

This property is of type Signed integer and can be referenced with the variable name ip3.

IP address of the server - usually 192.168.0.x or 192.168.1.x

MAC0

This property is of type Signed integer and can be referenced with the variable name mac0.

MAC address of the server

MAC1

This property is of type Signed integer and can be referenced with the variable name mac1.

MAC address of the server

MAC2

This property is of type Signed integer and can be referenced with the variable name mac2.

MAC address of the server

MAC3

This property is of type Signed integer and can be referenced with the variable name mac3.

MAC address of the server

MAC4

This property is of type Signed integer and can be referenced with the variable name mac4.

MAC address of the server

MAC5

This property is of type Signed integer and can be referenced with the variable name mac5.

MAC address of the server