Home

Interfacing an HTML Form to the eZ80F91 MCU

image

Contents

1. CJ oC A The ZTP stack is available on www zilog com and can be downloaded to a PC with a user registration key ZTP can be installed in any specified location the default location is C Program Files Zilog gt Note For information on ZDS II version and ZTP version used in this appli cation see Hardware and Software Requirements on page 8 Follow the steps below to add and integrate the application files to the ZTP stack 1 Download ZTP available for download on www zilog com Browse to the location where ZTP is downloaded and open the ZTP_2 1 0 Lib ZDS ZTP Sam plePrograms ZTPDemo folder 2 Download the ANO208 SC01 zip file from www zilog com and extract the zip file con tents to a folder on your PC this folder is referred to as AN0208 SC01 folder in this application note The two extracted folders within the ANO208 SCO01 folder are TD_Demo and TD_Website Acclaim 3 Copy the mailsubmission_ form htm file in the ANO208 SCO1 TD_Website Acclaim folder to the ZTP_2 1 0 Lib ZDS ZTP SamplePrograms website Acclaim folder 4 Copy all the c and h files located in the AN0208 SC01 TD_Demo folder to the ZTP 2 1 0 Lib ZDS ZTP Sam plePrograms ZTPDemo folder 5 Launch ZDS II for eZ80AcclaimPlus and open the website zdsproj project located in the path ZTP_2 1 0 Lib ZDS ZTP SamplePrograms web site Acclaim 6 Click Project Add Files to add the mailsubmission_form htm file to the w
2. mance necessary to execute complex applications supporting networking functions quickly and effi ciently Combining on chip Flash and SRAM eZ80AcclaimPlus devices provide the memory required to implement communication protocol stacks and achieve flexibility when performing in system updates of application firmware Zilog also offers two eZ80AcclaimPlus devices without Flash memory the eZ80L92 and eZ80190 microprocessors ZTP Overview The ZTP integrates a rich set of networking ser vices with an efficient real time operating system RTOS The operating system is a compact pre emptive multitasking multi threaded kernel with inter process communications IPC support and soft real time attributes Table 1 lists the standard network protocols implemented as part of the embedded TCP IP protocol stack in ZTP Table 1 Standard Network Protocols in ZTP HTTP TFTP SMTP Telnet IP PPP DHCP DNS TIMEP SNMP TCP UDP ICMP IGMP ARP RARP FTP PPPoE SNTP SSL SSL is available only with SSL package Many TCP IP application protocols are designed using the client server model The final stack size is link time configurable and determined by the protocols included in the build Copyright 2008 by Zilog Inc All rights reserved www zilog com Interfacing an HTML Form to the eZ80F91 MCU Zilog Discussion device for PPP connections and the EMAC for Eth ernet connections Figure displays the general data comm
3. to send the emails The init function located in the Test_cont c file initializes the appropriate port pins as inputs to obtain the status of the switches Pressing the switch SW1 SW2 SW3 on the eZ80 Development Platform causes the appropri ate email to be sent to the required destination The Test _switch function located in the Test_cont c file polls the SW1 SW2 SW3 switch continuously and reads the switch status in the main program If any of the switches are pressed logic 0 the Test_ switch function calls another function sendmail to send the mail to the specified address gt Note Any other trigger event may be used instead of switches Adding and Integrating Form Interface Files to ZTP The Form Interface application described in this application note requires the eZ80AcclaimPlus Development Board and ZTP stack To execute this application the files specific to the application must be added and integrated to the ZTP stack before it is downloaded to the eZ80AcclaimPlus Development Board This section provides infor mation on adding the Form Interface application files to the ZTP stack The Form Interface application files that must be added to the ZTP project files are located in the AN0208 SC01 zip file available for download on www zilog com The files are of the following types e C c files h files htm files e Header e HTML ANO020803 0708 1 l A eA Z ITAN
4. 7 requires the settings for the email to be entered directly into the mail function In the Form Interface application this functionality is abstracted into an HTML form The software implementation focuses on the functions developed for setting and storing the email content via an HTML submission form Reading Information from the Mail Submission Form The email submission form displayed in Figure 2 on page 4 is an HTML form generated from the mailsubmission_form htnm file This file is located in the ANO208 SCO01 zip file available for download on www zilog com Page 3 of 11 Interfacing an HTML Form to the eZ80F91 MCU Zilog 4 Welcome to the e280 Acclaim Website Microsoft Internet Explorer File Edit View Favorites Tools Help 9 B a a 9 o 2 m B Z Stop Refr Home Search Favorites History Mail Print Edit Discuss Messenger Back to Welcome to ZiLOG SS i 6 200 CV B0 Acclaim Flash Microcontrollers HOME PRODUCT INFO ABOUT THIS SITE Mail Submission Form TCP IP Suite Documentation To Development Kit 280 F92 F93 From eZ80F92 F93 TCP IP Suite Subject 4 Documentation i Max 30 characters Development Kit mo Mail Send Mail form pte aa Message javascrip Java Applets Max 300 CGI Calculator Characters Site Info This Site A Hardware Software Mail Server Address _ YI SMTP Test Condition SW1 z Submit Reset For
5. Application Note N MCU AN020803 0708 Abstract This application note demonstrates how to use Zilog s eZ80F91 microcontroller unit MCU as a web server to send electronic mails emails using an hypertext markup language HTML email sub mission form This application note is an exten sion of another application note that describes sending emails using Zilog TCP IP ZTP soft ware suite For more information refer to The eZ80F91 MCU as a Mail Server Application Note AN0207 gt Notes 1 The source code file associated with this application note AN0208 SCO1 zip is avail able for download on www zilog com 2 The source code files in this doc ument are intended for use with the ZTP software suite v2 1 0 and ZDS Il eZ80Acclaim v4 11 0 Zilog Product Overview This section provides brief description of Zilog products used in this application note which includes the award winning Zilog s eZ80AcclaimPlus MCUs and the full featured Zilog TCP IP ZTP software suite eZ80AcclaimPlus MCU Family Overview The eZ80AcclaimPlus family of MCUs includes Flash and non Flash products The Flash based eZ80AcclaimPlus MCUs such as eZ80F91 eZ80F92 and eZ80F93 are an exceptional value for designing high performance embedded applica Interfacing an HTML Form to the eZ80F91 Flash Microcontrollers tions With speeds up to 50 MHz and an on chip Ethernet MAC eZ80F91 only it has the perfor
6. P address in the URL field to open the eZ80AcclaimPlus Demo home page 2 Click the Send Mail form link in the left panel The email submission form is displayed see Figure 2 on page 4 3 Enter the required information in all the fields Select SW1 in the test condition field and click the Submit button to submit the form 4 Press SW1 switch on the eZ80 Development Platform for one second 5 Check the specified mailbox after a couple of minutes depending on the network traffic to see if an email with the predefined text is received The eZ80AcclaimP us ZTP Mail Server suc cessfully sends the email to the specified address gt Note Follow the same procedure to submit emails with test conditions SW2 and SW3 These emails are sent when the SW2 and SW3 switches are pressed Page 9 of 11 Summary This application note highlights an HTML form interface to the eZ80F91 web server eZ80F91 MCU with ZTP An HTML form is a convenient and easy to use interface with the clearly defined fields to obtain specific input In this application note an HTML form is used to obtain and store email messages that are sent only when specific events occur Such a concept can be effectively used in a control system application where concerned personnel receive timely alerts on pre defined conditions ANO020803 0708 Interfacing an HTML Form to the eZ80F91 MCU oy l m f IIA AN Z i i U U References The documents
7. TP Test Condition Figure 3 The Email Submission Form The mail_cgi function located in the mail_cgi c file receive arguments from the mail submission HTML form and stores them in the email parm structure located in the send _mail h file The Form Interface software is implemented for storing the contents of three emails in a single cli ent database formed by the email_parm struc ture You must fill the email submission form and submit it The submitted data email content cor responding to the selected switch is stored in the client database When an event is triggered in this Demo the triggering event is pressing the SW1 SW2 SW3 switch on the eZ80 Development Plat form the corresponding email is fetched from the client database and sent to the specified mailbox ANO020803 0708 The email submission form is also used for updat ing or modifying the client database Sending an Email The sendmail function located in the send_mail c file is responsible for sending the email to the specified email ID The standard ZTP mail function is called within the sendmail function For detailed descriptions on the sendmail and mail functions refer to The eZS0F91 MCU as a Mail Server application note AN0207 Page 5 of 11 Interfacing an HTML Form to the eZ80F91 MCU Monitoring the Trigger Event to Send an Email The SW1 SW2 and SW3 switches are used to generate the trigger events to the MCU
8. associated with eZ80 CPU eZ80F91 MCU ZPAK II ZDS II for eZ80Acclaim MCUs and ZTP available on www zilog com are provided below eZ80 CPU User Manual UM0077 e eZ80F91 Development Kit User Manual UM0142 e eZ80F91 Product Specification PS0192 e eZ80F91 Module Product Specification PS0193 e The eZ80F91 MCU as a Mail Server Applica tion Note AN0207 e ZPAK II Debug Interface Tool Product User Guide PUG0015 e Zilog Developer Studio II eZ80Acclaim User Manual UM0144 e Zilog TCP IP Stack API Reference Manual RM0040 e Zilog TCP IP Software Suite Programmers Guide RM0041 e Zilog TCP IP Software Suite Quick Start Guide QS0049 Page 10 of 11 Interfacing an HTML Form to the eZ80F91 MCU 7 ILEA AN ZItOOQO A N Warning DO NOT USE IN LIFE SUPPORT LIFE SUPPORT POLICY ZILOG S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS PRIOR WRITTEN APPROVAL OF THE PRESIDENT AND GENERAL COUNSEL OF ZILOG CORPORATION As used herein Life support devices or systems are devices which a are intended for surgical implant into the body or b support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in a significant injury to the user A critical component is any component in a life support device or system whose failure to p
9. ebsite zdsproj project Page 6 of 11 7 Open the website c file from within ZDS II and enter the following prototype declarations prototype declarations extern struct staticpage mailsubmission form htm extern int mail cgi int 8 The website c file contains the array Webpage website which provides infor mation on the HTML pages Replace the last line of the array 0 NULL NULL NULL with the following lines of code HTTP PAGE STATIC mailsubmission form htm text html mailsubmission form htm HTTP_PAGE DYNAMIC cgi bin mail text html struct staticpage mail cgi 0 NULL NULL NULL From within ZDS II open the left htm file located in the Web Files folder Search for the Demos lt br gt statement and locate the Demos lt br gt code 10 Add the following HTML lines of code above the Demo lt br gt statement in the left htm file to create a link from the eZ80AcclaimPlus home page to the Form Interface web page and the Mail Submission form Demo Mail lt br gt nbsp amp nbsp amp nbsp lt a href mailsubmission form htm target main gt Send Mail form lt a gt lt br gt 11 Build the website zdsproj project to obtain the new library file Acclaim _website 1ib 12 Close the website zdsproj project 13 From within ZDS II open the ZTPDemo_F91 zdsproj project available in the ZTP_ 2 1 0 Lib ZDS ZTP Sam plePrograms ZTPDemo filepat
10. erform can be reasonably expected to cause the failure of the life support device or system or to affect its safety or effectiveness Document Disclaimer 2008 by Zilog Inc All rights reserved Information in this publication concerning the devices applications or technology described is intended to suggest possible uses and may be superseded ZILOG INC DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE INFORMATION DEVICES OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT ZILOG ALSO DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION DEVICES OR TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE The information contained within this document has been verified according to the general principles of electrical and mechanical engineering eZ80 and eZ80AcclaimPlus are trademarks or registered trademarks of Zilog Inc All other product or service names are the property of their respective owners ANO020803 0708 Page 11 of 11
11. eturn OK statement at the end of the INT16 ZTPAppEntry void function Init while 1 Test_switch RZKSuspendThread RZKGetCurrentThr ead 1 18 Open the ez80HWConf c file and change the default MAC address provided by ZTP such that each eZ80 Development Platform on the LAN contains a unique MAC address For example const CHAR 91 mac_addr ETHPKT ALEN 0x00 0x90 0x23 0x00 OxDF 0x91 In the 6 byte MAC address shown above the first 3 bytes must not be modified the last 3 bytes can be used to assign a unique MAC address to the eZ80 Development Platform 19 For this application Dynamic Host Configura tion Protocol DHCP is disabled therefore ensure that byte b use dhcp FALSE 20 Save the files and close the ZTPDemo_F91 project Using the eZ80F91 Form Interface Application This section provides the hardware and software requirements the settings and the instructions to setup and execute the Form Interface application Hardware and Software Requirements This section provides the hardware and software requirements for running the Form Interface appli cation ANO020803 0708 Hardware The hardware required to execute the Form Inter face application include e eZ80F91 Development Kit eZ80F910200ZCO eZ80F910300ZCO e PC with an Internet Browser and HyperTermi nal Software Requirements The software required to execute the Form Inter face applicati
12. h 14 Click Project Add Files to add all the c files located in the AN0208 SCO1 TD_Demo folder to the ANO020803 0708 Interfacing an HTML Form to the eZ80F91 MCU Zilog ZTPDemo_F91 zdsproj project The c files to be added are listed below e mail_cgi c e send mail c e Test_cont c 15 Open the main c file of the ZTPDemo_F91 zdsproj project and add the following include file include send mail h 16 Check for the commonServers structure defi nition in the ZTPConfig c file struct commonServers csTbl 172 16 6 28 Default Timer Server n Default rfs server Default File Server N not currently Used 172 16 6 194 Default Name Server struct If ifTbl MAX_ NO IF interface 0 gt Ethernet Configuration amp usrDevBlk 0 Control block for this device ETH interface type ETH MTU MTU ETH 100 Speed can be ETH_10 AUTOSENCE 172 16 6 198 Default IP address 172 16 6 1 Default Gateway OxffffOOO0OUL Default Subnet Mask The Bootrecord variable contains network parameters and settings in the four octet dotted decimal format specific to the local area network LAN at Zilog as default Modify the above structure definition with appropriate IP addresses within your local area network Page 7 of 11 Interfacing an HTML Form to the eZ80F91 MCU 17 Add the following lines of code above the r
13. m www zilog com requires a registration key ZTP HTTP CGI Functions Embedded systems do not contain a file system Therefore the embedded systems cannot save CGI scripts as separate programs Instead of saving CGI scripts as separate programs ZTP uses C function calls collectively called CGI functions When a CGI function is called it gener ates an HTML page that is sent to the browser It is in these function calls that a code is written to read the information sent by a form via a web browser This information is then processed as required by the application ZTP provides the following CGI functions e int http _output_reply http request request int reply e char http_find_argument http request request char arg e int http write http request request char buff int count In each ZTP CGI function the pointer to the request structure keeps the requests from differ ent clients separate AN020803 0708 Interfacing an HTML Form to the eZ80F91 MCU The http_output_reply function returns an acknowledgement to the browser that made the request The http_find_argument function extracts parameters from the received data in the parsed browser request The http _write macro returns data to the browser that sent the request that invoked the CGI function Developing the Form Interface Application The mail server application described in The eZSOF91 MCU as a Mail Server application note AN020
14. more information about ZiLOG s eZ80 Internet Processors please visit www ZiLOG Note You need to connect to the Internet in order to view external URLs Send mail to support zilog com with questions or comments about this web site Copyright 2003 ZiLOG Ino Last modified April 23 2003 Software Version vl 2 E agp internet Figure 2 Web Page with the Email Submission Form The email submission form see Figure 3 on Mail Server Address This field consists of the page 5 consists of the following entry fields IP address of the SMTP mail server that distributes the email to the destination ID To This field consists of the email ID destination in the user domainname com format Test Condition lIn this field selecting a test condition from the drop down list links this email From This field consists of the sender s email to a particular triggering event Therefore if the ID in the eZ80webserver zilog com format SW1 test condition is selected this email is sent when the SW1 switch is pressed on the eZ80 Subject This field consists of the subject or Development Platform topic of the email Message This field consists of the text content of the message to be sent ANO020803 0708 Page 4 of 11 Interfacing an HTML Form to the eZ80F91 MCU Zilog Mail Submission Form To From Subject Max 30 characters Message Max 300 Characters Mail Server Address SM
15. ngs provided in the HyperTerminal Settings on page 8 From within the HyperTerminal press z repeatedly and then press the Reset button on ZPAK II to view the menu to set the ZPAKII IP address Enter H to display help menu and follow the menu instructions to obtain the IP address for ZPAK II in order to download the demo appli cation file This ZPAK II IP address must be entered in the ZDS H IDE Launch ZDSII for eZ80AcclaimPlus and open the Form Interface application project file ZTPDemo_F91 zdsproj located in the file path ZTP_2 1 0 Lib ZDS ZTP Sam plePrograms ZTPDemo Open the ZTPConfig c file Ensure that the BootInfo struct commonServers struct If ifTb1 structure contains infor mation that is relevant to your network config uration Use the IP address in the structure to view the Form Interface web pages Build the project and download the resulting file to the eZ80F91 module mounted on the ANO020803 0708 l m AN Z ILIA AN l U U eZ80 Development Platform using ZDS II For details on the downloading procedure refer to Zilog TCP IP Software Suite Program mers Guide RM0041 10 Execute the Form Interface application For details on executing the Form Interface appli cation see Executing the Form Interface Application Executing the Form Interface Application Follow the steps below to execute the Form Inter face application 1 Launch an Internet Browser and enter the server I
16. on include e Zilog Developer Studio II IDE for eZ80Acclaim v4 11 0 e Zilog TCP IP Software Suite v2 1 0 Setup The basic setup to assemble the Form Interface application Demo is displayed in Figure 1 on page 2 This setup displays the connections between the PC LAN WAN Internet and the eZ80F91 Development Kit Settings The HyperTerminal and Jumper settings include HyperTerminal Settings Set the HyperTerminal to 57 6 kbps Baud 8 N 1 with no flow control Jumper Settings The Jumper settings for the eZ80 Development Platform include e Jill J7 and J2 are ON e J3 J20 J21 and J22 are OFF e For J14 connect 2 and 3 e For J19 MEM CENI is ON and CS_EX_IN MEM_CEN2 and MEM_CEN3 are OFF Page 8 of 11 Interfacing an HTML Form to the eZ80F91 MCU The Jumper settings for the eZ80F91 Module mounted on the eZ80 Development Platform include JP3 is ON Procedure The following steps describe the procedure to build and execute the Form Interface application 1 Ensure that the required Form Interface appli cation files are added and integrated to ZTP For more information see Adding and Inte grating Form Interface Files to ZTP on page 6 Connect the hardware as displayed in Figure 1 on page 2 Follow the jumper settings provided in Jumper Settings on page 8 Connect the 5 V power supply to ZPAK II and the 7 5 V power supply to the Ethernet HUB Launch the HyperTerminal and follow the set ti
17. unication path for email using the eZ80F91 development kit ZTP consists of a set of libraries that implement an ZPAK II and an Ethernet HUB With this hard embedded TCP IP stack ZTP functions only as a ware the eZ80F91 MCU can be used as an effi client with a message body size of 32 K cient web server when ZTP software is downloaded on to it ZTP provides the software to drive the hardware used for TCP IP connections This hardware comprises of a SERIAL1 UART1 Development PC Ethernet Hub eZ80 Development ZPAK II Platform RS 232 Hardware Setup for the ZTP Applications using ZPAK II 9 VDC eZ80 _ Development Platform Development PC eZ80 Dev Serial Smart Cable USB ZDI Smart Cable RS 232 Hardware Setup for the ZTP Applications using Serial Smart Cable USB Smart Cable Figure 1 General Data Communication Path for Electronic Mail AN020803 0708 Page 2 of 11 ZTP API The ZTP applications programming interface API allows to rapidly develop internet ready applications with minimal effort by using any member of the eZ80 family of microprocessors including the eZ80AcclaimPlus product line Because the API is common to all members of the eZ80 family applications targeting one processor are easily ported to any other eZ80 devices For more details on the ZTP software suite refer to Zilog TCP IP Software Suite Programmers Guide RM0041 Downloading the ZTP software fro

Download Pdf Manuals

image

Related Search

Related Contents

Manual M-CEN    SUAVIZANTE TEXTIL  compound saw kapp-und gehrungssäge scie a coupe  GT-2S  クッションの取扱説明書        

Copyright © All rights reserved.
Failed to retrieve file