Вы находитесь на странице: 1из 50

KUVEMPU

UNIVERSITY

JNANASAHYADRI SHANKARAGHATTA

DEPT. OF ELECTRONICS

SEMINAR ON

WEB SERVER

CONTENTS
INTRODUCTION TO WEB SERVER .
EXTERNAL CONNECTER DESCRIPTION. PIC MICRO CONTROLLER. PIN CONFIGURATION OF PIC 18F67J60.

THE WEB SERVER. MICROCHIP TCP/IP STACK.

INTRODUCTION TO WEB SERVER


A web server can be refered to as either the hard ware,the computer or the software. The computer application that helps to deliver content that can be accessed through the internet,most people think web server is just the hardware computer,but webserver is also refered as the software computer application that is installed in the hardware computer. A webserver is what makes it possible to be able to access content like webpages or other data from anywhere as long as it is connected to internet The most common use of web servers are to host website. There are also different way to request content from web server the most comman request is HTTP, but there are also other request like internet message access protocol(IMAP) or FTP etc .

INTRODUCTION
PIC-WEB is compact board with 65x60 mm size which is supported by Microchips open source TCP-IP stack AN833. The board is designed with 64-pin high-performance, 1 Mbit Flash microcontroller with Ethernet PIC18F67J60 and supports: SLIP, ARP, IP, ICMP, TCP, UDP, HTTP, DHCP, FTP. The Microchip stack is written very modular and flexible and you can enable or disable modules and supports dynamic web pages which give you the possibility to control all PIC resources remotely via FTP, HTTP, UDP, TCP etc. With this board you can implement web and ftp server, send e-mails and almost everything what the big servers do. The on board 1Mbit serial flash is available for data storage.

BOARD FEATURES
PIC18F67J60 microcontroller 1Mbit on board serial flash for web pages storage ICSP/ICD connector for programming and debugging with PIC-ICD2, PICICD2POCKET and PIC-ICD2-TINY. Reset button User event button Thermistor for temperature monitoring RS232 driver and connector Complete web server and TCP-IP stack support as per Microchip's open source TCP-IP stack Power plug-in jack for +5VDC power supply Voltage regulator +3.3V and filtering capacitors status LED

BOARD USE REQUIREMENTS


Cables: Depends on the used programming/debugging tool. It could be 1.8 meter USB A-B cable to connect PIC-ICD2 or PIC-ICD2-POCKET to USB host on PC or RS232 cable in case of PIC-ICD2-TINY or other programming/debugging tools. You will need a serial cable if not for programming, than for configuring the board. You will also need a LAN cable. Hardware: Programmer/Debugger most of Olimex programmers are applicable, for example PIC-ICD2, PIC-ICD2-POCKET or other compatible programming/debugging tool. Software: PIC-WEB is tested with MPLAB IDE v.8.14 + MPLAB C18 C compiler. It is possible that the stack might not function properly if used with later versions of MPLAB IDE. You will also need a terminal program configured at 19 200 bps, 8N1 and no flow control.

PROCESSOR FEATURES
PIC-WEB board use CPU PIC18F67J60 from Microchip with these features: Operating Frequency - DC 41.67 MHz Flash program memory (bytes) 128k Flash program memory (Instructions) 65532 SRAM data memory (bytes) 3808 Interrupt Sources 26 Ethernet TX/RX Buffer (bytes) 8192 I/O Ports A, B, C, D, E, F, G I/O Pins 39 10-Bit A/D (ch) 11 Capture/Compare/PWM Modules 2 Enhanced Capture/Compare/PWM Modules 3

Serial Communications - MSSP (1), Enhanced USART (1) SPI Master I2C Comparators 2 Timers 8/16-Bit 2/3 Resets (and Delays) - POR, BOR, RESET Instruction, Stack Full, Stack Underflow, MCLR , WDT (PWRT, OST) Instruction Set - 75 Instructions, 83 with Extended Instruction Set Enabled

BOARD LAYOUT

POWER SUPPLY CIRCUIT


PIC-WEB can take power from two sources: - PWR_JACK where (9-12) VDC is applied by external power source. -EXT-20 pin VIN with the same voltage range. The board power consumption is: about 130 mA with all peripherals and MCU running at full speed.

RESET CIRCUIT
PIC-WEB reset circuit is made with R8 (10k) pull-up, R7 (330R) serial resistor and RST button.

Although on the schematic is made provision for external reset through EXT-16 pin.
Manual reset is possible by the RST button.

CLOCK CIRCUIT
Quartz crystal 25 MHz is connected to PIC18F67J60 clock in and clock out. Quartz crystal 32.768 KHz is connected to PIC18F67J60 T1OSO and T1OSI pins for its internal Real Time Clock

INPUT/OUTPUT
One User button with name BUT connected to PIC18F67J60 pin 3(RB0/INT0/FLT0); Status red LED with name LED connected to PIC18F67J60 pin 44 (RB4/KBI0). Power supply red LED with name PWR indicates that external power source is applied and board power supply is applied.

One trimmer AN_TR is connected to PIC18F67J60 pin 15 (RF3/AN8).

EXTERNAL CONNECTORS DESCRIPTION

INTRODUCTION
There is no way to plug a PIC into a standard computer (PC). A separate piece of hardware, called a programmer is required to connect to an I/O port of a PC on one side and to the PIC on the other side. There are many different PIC programmers available. Most of these use the parallel port, a serial port (COM port), or the USB ,etc On the PIC side there are two possibilities, socket and incircuit. A socket programmer provides a way to connect just a bare PIC to the programmer. Since all the connections are built into the programmer, their details are irrelevant to the end user. In-circuit programmers however connect to the PIC while it is connected to the target circuit.

ICSP
Definition: In-System Programming (ISP) is a technique where a programmable device is programmed after the device is placed in a circuit. In-Circuit Serial Programming (ICSP) is an enhancedISP technique implemented in Microchips PIC micro One-TimeProgrammable (OTP) and FLASH RISC microcontrollers (MCU). ICSP OVERVIEW : PICs are programmed using 5 signals. The data is transferred using a two wire synchronous Serial scheme With the clock always controlled by the programmer. The ICSP signals are as shown below.

The ICSP Connector


VPP - Programming mode Voltage . VDD This is the positive power input to the PIC. GND Negative power input to the PIC and the zero volt reference for the remaining signals . PGD Serial Data Line PGC - Clock line of the serial data interface. PGM The PIC PGM pin is used to enable low voltage programming on some PICs

RS-232
Definition: Officially RS -232 is defined as the Interface between data terminal equipment (DTE) and Data Communications Equipment using serial binary data exchange .
GND NC R1IN T1OUT NC

NC T2OUT

R2IN

NC

Pin Description in general


DCD (Data Carrier Detect) tied to pin 6 (driven high but not used). TXD -Transmit Data RXD Received Data N/C Not Connected GND Ground DSR Data Set Ready tied to pin 1 RTS Request to send CTS Clear to send RI Ring indicator

LAN CONNECTOR
A registered jack (RJ) is a standardized physical network interface both jack construction and wiring pattern for connecting telecommunications or data equipment to a service provided by a local exchange carrier or long distance carrier. The standard designs for these connectors and their wiring are named RJ11, RJ14, RJ21, RJ48, etc. Many of these interface standards are commonly used world-wide. And the jack is as shown below.

LED INDICATION

PIC MICRO CONTROLLER

PIC microcontroller
A PIC microcontroller is a single integrated circuit small enough to fit in the palm of a hand. Traditional microprocessor circuit contain four or five separate integrated circuit the micro processor (CPU) itself, an EPROM program memory chip, some RAM memory and input/output interface with PIC microcontrollers all these functions are included with one single package, making them cost effective and easy to use, PIC microcontroller can be used as the brain to control a large Varity of products in order to control devices. PIC are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, larger user bas extensive collection of application notes availability as low cost or free development tools and serial programming (pre-programming with flash memory) capability.

Core architecture
The PIC architecture is characterized by its multiple attributes. Separate code and data spaces[hardware architecture] for devices other than PIC 32. A small number of fixed length instructions. Most instructions are single cycle execution(2 clock cycles),with one delay cycle on branches and skips. One accumulator(W0), the use of which is implied. All RAM locations function as register as both source and/or destination of math and other factions. The hardware stack for storing return addresses. A fairly small amount of addressable data space(typically 256 bytes),extended through baking. Data space mapped CPU, port and peripheral registers.

Data space(RAM)
PICs have a set of registers that functions as general purpose RAM. Special purpose control registers for on-chip hardware resources are also mapped into the data space. The addressability of memory varies depending on device series. And all PIC devices have some banking mechanism to extend addressing to additional memory. Later series of devices feature move instructions which can cover the whole addressable space, independent of the selected bank.

Code space
The code space is generally implemented as ROM,EPROM, or flash ROM. In general, external code memory is not directly addressable due to the lack of an external memory interface.

Word size
All PICs handle(and address) data in 8bit chunks, so they should be called 8 bitmicrocontrollers. However the unit of addressability of the code space is not generally the same as the data space.

stack
PICs have a hardware call stack, which is used to save return addresses. The hardware stack is not software accessible on earlier devices, but this changed with the 18 series devices.

Instruction set A PICs instructions vary from about 35 instructions for the lowend PICs to over 80 instructions for the high-end PICs. The instruction set includes instructions to perform a Varity of operations on registers directly, the accumulator and a literal constant or the accumulator and a registrar, as well as for condition execution, and program branching. Some operations, such as bit setting and testing, can be on any numbered register, but bi-operand arithmetic operations always involve the accumulator(W). In general PIC instructions fall into 5 classes: 1. Operation on W with 8-bit immediate operand. ex: movlw, andlw. 2. Operation with W and indexed register. the result can be written to either the w register(e,g addwf reg w) or the selected register(e,g addwf reg,f). 3. Bit operations. These take a register number and a bit number, and perform set or clear bit, and test and skip on set/clear. 4. Control transfers. E.g. goto, call. 5. A few miscellenaneous zero-operand instructions, such as return form subroutine, and sleep to enter low-power mode.

Limits
The PIC architectures have several limits: Only one accumulator. A small instruction set. Memory must be directly referenced in arithematic and logic operations, although indirect addressing is available via 2 additional registers. Register banking switching is required to access the entire RAM of many devices. Program memory is not directly addressable, and thus space-inefficient and/or time consuming to access. Indexed addressing mode is very rudimentary.

PIN DESCRIPTION

FEATURES FOR PIC18F97J60 FAMILY 64 PIN DEVICES


Operating frequency DC -41.667 MHZ Program memory-128K BYTES Program memory-65532 instructions

Data memory-3808 BYTES Interrput sources- 2 Input/ouput ports-ports A,B,C,D,E,F


port A-portB: intented for indication port D-portE: sufficient drive leval for exteral memory interfacing port B-portC: suitable for diret LED drive levals

Input/output pins-Depending on the device selected and features


enabled we select i/opins in this we use 39 i/o pins. TIMERS-There are 5 types of timers.

Timer 0 Timer 1 Timer 2 Timer 3 Timer 4 Capture/compare/PWM Modules-There are total of five ccp modules.In this we use 2 ccp modules i.e ccp2 and ccp5. Enhanced capture/compare/PWM Modules- Here we use 3 types of modules Eccp1,Eccp2,Eccp3 Serial communications-MSSP(1),Enhanced USART(1)

Ethernet communications-All members of PIC family devices features an embedded ethernet controller module.In this we use 10 Base T connectivity to a twisted pair network. 10-Bit Analog-to-Digital module-The Analog to Digital converter module has 11 inputs channel for the 64 pin devices.This module allows conversion of an
analog i/p signal to a corresponding 10 bit digital number.

Resets-The PIC Family of devices differentiates between various kinds of resets Reset during normal operation. POR-power on Reset. BOR-Brown out Reset. Reset instruction. Stack full reset. Stack under flow Reset. WDT-Reset during execution.

THE WEB SERVER

INTRODUCTION
Web server is a computer program that is responsible for accepting
HTTP requests from clients, which are known as web browsers, and additional content that may be included by a document, such as images, style sheets and Java Scripts. Using web server it is possible to access content like web pages, or other data from anywhere as long as it is connected to the internet. If a user puts a file in the directory that the web server is configured to share, the file can be read from a web browser. It is important to note that the web

server allows browsers to read files but are typically not configured to allow
browsers to write files.

WEB SERVER -FEATURES


Virtual hosting to serve many Web sites using one IP address. Large file support to be able to serve files whose size is greater than 2 GB on 32 bit OS. Bandwidth throttling to limit the speed of responses in order to not saturate the network and to be able to serve more clients. Server-side scripting to generate dynamic Web pages, but still keeping Web server and Web site implementations separate from each other.

Create an FTP site. An FTP site allows users to transfer


files to and from the site. Configure/nominate custom error pages. This allows you to build and display user friendly error messages on your website. For example, you can specify which page is

displayed when a user tries to access a page that doesn't


exist (i.e. a "404 error").

HOW WEB SERVERS WORK

LOAD LIMIT
A Web server (program) has defined load limits, because it can handle only a limited number of concurrent client connections (usually between 2 and 80,000, by default between 500 and 1,000) per IP address it When a Web server is near to or over its limits, it becomes unresponsive. It can serve only a certain maximum number of requests per second depending on: its own settings; the HTTP request type;

content origin (static or dynamic);


the hardware and software limits of the OS where it is working;

OVERLOAD CAUSES
Too much legitimate web traffic. Thousands or even millions of clients connecting to the web site in a short interval, Distributed Denial of Service attacks; Computer worms that sometimes cause abnormal traffic because of millions of infected computers (not coordinated among them);

XSS viruses can cause high traffic because of millions of infected


browsers and/or Web servers;

Internet (network) slowdowns, so that client requests are served more slowly and the number of connections increases so much that server limits are reached; Web servers (computers) partial unavailability. This can happen because

of required or urgent maintenance or upgrade, hardware or software


failures,(e.g., database) . in these cases the remaining web servers get too much traffic and become overloaded.

The symptoms of an overloaded Web server are:


Requests are served with (possibly long) delays (from 1 second to a few

hundred seconds);
500, 502, 503, 504 HTTP errors are returned to clients (sometimes also unrelated 404 error or even 408 error may be returned);

TCP connections are refused or reset (interrupted) before any content is sent
to clients; In very rare cases, only partial contents are sent

ADVANTAGES
You can use server-side scripting languages such as PHP and

ColdFusion.
Allows you to standardize your coding. For example, you can use rootrelative paths for your image references and hyperlinks (i.e.

"/directory/image.gif"). In other words, your paths can represent the


website structure rather than the directory structure of your computer.

Knowledge. The knowledge you gain from using your own web server

will help you understand how it works in the live environment. This
will most certainly help you when you need to communicate with your hosting provider - you'll be able to use terminology that makes it easier

for them to understand your request/issue.

THE MICROCHIP TCP/IP STACK

INTRODUCTION
The Microchip TCP/IP Stack is a set of programs that provides services to standard TCP/IP-based applications (HTTP Server, Mail Client, etc.) An additional major departure from traditional TCP/IP Stack implementation is the addition of two new modules: Stack Task and ARP Task. Stack Task manages the operations of the stack and all of its modules, while ARP Task manages the services of the Address Resolution Protocol (ARP) layer.

LAYERS OF THE TCP/IP REFERENCE MODEL

Application Layer Refers to standard network services like http, ftp, telnet as well as communication methods used by various application programs .
Also defines compatible representation of all data

Transport layer Manages the transfer of data by using connection oriented (TCP) and connectionless (UDP) transport protocols Manages the connections between networked applications Internet Layer Manages addressing of packets and delivery of packets between networks Fragments packets so that they can be dealt with by lower level layer (Network Interface layer Network) Network interface layer

Delivers data via physical link (Ethernet is the most common link level protocol ) Provides error detection and packet framing

COMPARISION BETWEEN TCP/IP STACK STRUCTURE AND TCP/IP REFERENCE MODEL

Like the TCP/IP reference model, the Microchip TCP/IP Stack divides the TCP/IP Stack into multiple layers as shown above. The code implementing each layer resides in a separate source file, while the services and APIs (Application Programming Interfaces) are defined through header/include files. Unlike the TCP/IP reference model, many of the layers in the Microchip TCP/IP Stack directly access one or more layers which are not directly below it. A decision as to when a layer would bypass its adjacent module for the services it needs ,was made primarily on the amount of overhead and whether a given service needs intelligent processing before it can be passed to the next layer or not.

KEY FEATURES OF MICROCHIP TCP/IP STACK


Optimized for all PIC18, PIC24, ds PIC and PIC32 families Supported Protocols: ARP, IP, ICMP, UDP, TCP, DHCP, SNMP, HTTP, FTP, TFTP Socket support for TCP and UDP Secure Sockets Layer (SSL) NetBIOS Name Service DNS Domain Name System Ethernet Device Discovery Support for MPLAB C18, C30, and C32 compilers

Вам также может понравиться