Forms using GET

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
Forms using GET

Overview 

This section describes how to use web forms in the TCP/IP Demo App HTTP2 demo. For information about how to implement forms in your own page, see the HTTP2 form processing topic

Instructions 

  1. Program your board with the demo code and upload the demo app web page. Open your web browser and navigate to the board's web page (http://mchpboard by default).
  2. Observe the LED state on the board. Click on an LED indicator in the box on the top right of the Overview page. Verify that the LED state changes on the board. Note that some LEDs or buttons may not be implemented, depending on your hardware setup. Consult the TCPIP Demo App Features by Hardware Platform topic for more information.
  3. Navigate to the Form Processing page using the navigation panel on the left of the page.
  4. Select new LED states in the pull-down boxes. Click "Save" and observe that the LED states of your board changed to match the settings you selected.

 

Exercise 

You can optionally complete the exercise described on the "Form Processing" page. In this exercise, you will change the example to support LED5. You may want to read the HTTP2 form processing topic first.

  1. Start by opening forms.htm in your "TCPIP Demo App\WebPages2" folder.
  2. Locate the GET method implementation the will display the LEDs. You should see select forms for the four LEDs that are already implemented. Each of these has two options: the On option will send a '1' to the server when submitted and the Off option will send a '0' when submitted. Each of the declarations of these options also use the ledSelected dynamic variable to determine which option will be selected by default, based on the current status of the corresponding LED on the board. This dynamic variable accepts two arguments: the first defines which LED is being checked, and the second describes the state being checked for. So, for example, the ~ledSelected(4,TRUE)~ variable will be replaced by the word "SELECTED" if LED4 is on when this variable callback function is called. In this case, ~ledSelected(4,FALSE)~ would be replaced by nothing. This would result in the 'On' option being selected by default in the page.
  3. Create a new select input for LED5.
  4. Open CustomHTTPApp.c in the TCP/IP Demo App MPLAB project.
  5. Verify that the HTTPPrint_ledSelected dynamic variable callback function has been implemented for LED5.
  6. Find the HTTPExecuteGet function. Locate the section of code the processes GET arguments for the forms.htm file.
  7. Add implementation to search for the "led5" argument string in the GET data buffer and then set LED5_IO based on the associated value.
Module
Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.