Documente Academic
Documente Profesional
Documente Cultură
Rabbit 3000 processor has a protocol converter that transmits the data
sent by serial equipment as TCP/IP data to the network. It also supports UDP Protocol for
Broadcast kind of application. As we are accessing the Internet in our daily life, so in that
the main problem occurring is speed of accessing i.e., many peoples are accessing the
same web site at same time so the heavy burden will occur for main server. So instead of
this problem we are developing a kit, which shares the risk of main server by means of
duping the home page code in to our Rabbit 3000 microprocessor & connecting it to our
main server. Then, the accessing time for people will access well when compared to
previous one.
1
DESCRIPTION ABOUT PROJECT
In this project static web pages will be hosted on an Rabbit Processor based
embedded module, this module will be having a Ethernet interface through which it can
be connected to internet. The software inside the module will have TCP / IP stack which
is used for establishing communication with other systems in the internet. This
Embedded module is designed with Rabbit 3000 processor to which memory chips and
Ethernet controllers are interfaced.
This project provides you with the tools to incorporate a low overhead web
server into your application or device. Using this framework offered you can provide
secure and efficient access to both static and dynamically generated content.
2
The basic series of operations that our application must perform is:
This Project explores the capabilities of the Rabbit Processor and its
features and specifications. It also gives the brief over view of the the TCP / IP protocol
and the networking concepts.
3
NETWORK THEORY
Application Application
layer layer
Transport Transport
layer layer
Network Network
layer layer
4
HOST –A HOST-B
Application Layer:
Since the IP stack has no layers between the application and transport
layers, the application layer in the IP suite include any protocols that act like the OSI’s
presentation and session layer protocols. The actual data sent over the network is passed
into the application layer where it is encapsulated into the application layer protocol.
From there, the data is passed down into the lower layer protocol in the transport layer
5
The two most common lower layer protocols are TCP and
UDP.Both of which require a port in order to use their service and most well-used
applications have specific ports assigned to them (HTTP has port 80; FTP has port 21;
etc.)for servers while clients use ephemeral ports. Routers do not utilize this layer.
Transport layer:
The transport layer is the layer between the application and the network
protocol (i.e., IP) and primarily provides the service of connecting applications together
through the use of ports. Since IP provides only a best effort delivery; the transport layer
is the first layer to address reliability.
The second protocol used in the transport layer is the User Datagram Protocol.
UDP is a connectionless datagram protocol. Like IP, it is a best effort or “unreliable”
protocol.UDP is typically used for applications such as streaming media (audio and
video, etc) where on-time arrival is more important than reliability or the overhead of
6
setting up a reliable connection is disproportionately large. Both TCP
and UDP are used to carry a number of higher-level applications. The
applications at any given network address are distinguished by their TCP or UDP c port.
Network layer:
The network layer solves the problem of getting packets across a single
network. With the advent of the concept of internetworking, additional functionally was
added to this layer, namely getting data from the source network to the destination
network. This generally involves routing the packet across a network of networks,
knowns an internet. In the internet protocol suite, IP performs the basic task of getting
packets of data from source to destination.IP can carry data for a number of different
upper layers protocols; these protocols are each identified by a unique protocol number:
ICMP and IGMP are protocols 1 and 2, respectively. Some of the protocols carried
by IP, such as ICMP (used to transmit diagnostic information about IP transmission) and
IGMP (used to manage multicast data) are layered on top of IP but perform internet work
layer functions.
ETHERNET:
EMBEDDED WEB SERVER
7
Ethernet is the most widely used LAN protocol. This
protocol was designed in 1973 by Xerox with a data rate of 10 Mbps and a
bus topology. Today it has a data rate of 100 Mbps and 1 Gbps. Ethernet is formally
defined by the IEEE 802.3 standard.
TRADITIONAL ETHERNET:
The original Ethernet, usually referred to as traditional Ethernet, had a
10-Mbps data rate. But there are other Ethernets with different data rates.
but the logical topology is always a bus. By this, we mean that the medium is shared
between stations and only one station at a time can use it. It also implies that all stations
receive a frame sent by a station (broadcasting).The real destination keeps the frame
while the rest drop it. In this situation, how can we be sure that the stations are not using
the medium at the same times? If they do, their frames will collide with each other.
8
collision; each sending station sends a jam signal to destroy the
data on the line and after each waits a deferent random time, try
gain. The random times prevent the simultaneous re-sending of data
In traditional ethernet, the minimum frame length is 520 bits, the transmission
rate is 10Mbps, propagation speed is almost the speed of light and the collision domain is
almost 2500 meters.
The traditional 10 Mbps Ethernet has 2 layers. The data link layer has two sub-
layers: the logical ink control (LLC) sub layer and the medium access control (MAC) sub
layer. The LLC layer is responsible for flow and error control and the data-link layer. The
MAC sub layer is responsible for the operation of the CSMA / CD access method. The
MAC sub layer also frames data received from the LLC layer and passes the frames to
the physical layer for encoding. The physical layer transfers data into electrical signals
and sends them to the next station via the transmission medium. This bottom layer also
detects and reports collisions to the data link layer.
ETHERNET FRAME:
IEEE 802.3 specifies one frame type containing seven fields: Preamble,
SFD, DA, SA, length /type of PDU, 802.2 frames, and the CRC. Ethernet does not
provide any mechanism for acknowledging received frames, making it what is known as
an unreliable medium. Acknowledgements must be implemented at the higher layers.
This format of the CSMA/CD MAC frame is shown below
9
PREAMBLE SFD DEST SOURCE LENGTH DATA and CRC
DE ADD ADD PADDING
7 bytes 1 bytes 6 bytes 6 bytes 2 bytes 4
bytes
Preamble:
The preamble of 802.3 contains 7 bytes (56 bits) of alternating 0s and 1s
and that alerts the receiving system to the coming frame and enables it to synchronize its
input timing. The preamble is actually added at the physical layer and is not (formally)
part of the frame.
The last two bits are 11 and are signal that the next field is the destination address.
Length type:
The length type field has one of two meanings. If the value of the field is
less than 1518, it is a length field defines the length of the data field that follows. If the
EMBEDDED WEB SERVER
10
value of the field is greater than 1536, if defines the upper layer protocol
that uses the service of the Internet.
Data:
The data field carries data encapsulated from the upper layer protocols.
It is a minimum of 46 and a maximum of 1500 bytes.
Crc:
The last field in the 802.3 frame contains the error detection information.
It tells whether the transmitted data is error free or not.
IMPLEMENTATIONS:
10BASE5 (thick ethernet) uses a bus topology with a thick coaxial cable as a
transmission medium.
10BASE2 (thin ethernet or cheaper net) uses a bus topology with a thin
coaxial cable as transmission medium.
10BASE-T (twisted pair Ethernet) uses a physical star topology with stations
connected by two pairs of twisted-pair cable to the hub.
10BASE-FL (fiber link Ethernet) uses a star topology with stations connected
by a pair of fiber-optic cables to the hub.
11
NETWORK ELEMENTS:
While dealing with the networks we most often come across the terms called
the routers, repeaters, bridges and hubs. These are used as connecting devices when we
are connecting the LANs or WANs together.
Repeaters:
A repeater is a device that operates only in the physical layer. Signals that carry
information within a network can travel a fixed distance before attenuation endangers the
integrity of data. A repeater receives a signal, before it becomes too weak or corrupted,
regenerates the original bit pattern. It then sends the refreshed signal. A repeater can
extend the physical length of a network.
Bridges:
A bridge operates in both the physical and the data link layers. As a physical
layer device, it regenerates the signal it receives. As a data link layer device, the bridge
can check the physical address (source and destination) contained in the packet. A bridge
has no physical address.
Hub:
Hub refers to any connecting device; it does have a specific meaning. A hub is
actually a multiport repeater. It is normally used to create Connections between stations
in the physical star topology. The hubs are also used to create multiple levels of
hierarchy.
Routers:
12
An internet is a combination of networks connected by
routers. When a datagram goes from a source and destination, it will
probably passes through many routers until it reaches the router attached to the
destination network. A router receives the packet from a network and passes it to another
network. A router usually attached to several networks.
DIFFERENCES:
There are three major differences between a router a repeater and a bridge.
1. A router has a physical and logical (IP) address for each of its interfaces.
2. A router acts only on those packets in which the destination address matches the
address of the interface at which the packet arrives. This is true for unicast,
multicast or broadcast addresses.
3. A router changes the physical address of the packet (both source and destination)
when its forwards the packet.
IP ADDRESSING:
At the network Layer we need to uniquely identify each device on the
Internet to allow global communication between all devices. The identifier used in the IP
layer of the TCP/IP protocol suite to identify each device connected to the Internet is
called the Internet address or IP address. An IP address is a 32-bit binary address that
uniquely and universally defines the connection of a host to a router to the Internet. IP
addresses are unique in the sense that each address defines one and only one connection
to the internet. Two devices in the internet can never have the same address. However, if
a device has two connections to the internet, via two networks, it has two IP addresses.
The IP addresses are universal in the sense that the addressing system must be accepted
by any host that wants to be connected to the Internet.
ADDRESS SPACE:
EMBEDDED WEB SERVER
13
A protocol like IP that defines address has an address
space. An address space is the total number of addresses used by the protocol. If a
protocol uses N bits to define an address, the address, space is 2 N because each bit can
have tow different values (o and 1(and N bits can have 2 N values. IPV4 (IP version 4)
uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296.
128.11.3.31
CLASSES IN IP ADDRESSING:
14
Class A covers half of the address space, class B covers
1/4th of the
whole address space, class C covers 1/8th of the address space, and class D covers 1/16th
of the address space.
Class A:
Net id Host id
Class A is divided into 128 blocks with each block having a different net
id. The first block covers addresses from 0.0.0.0 to 0.255.255.255(net id 0) The second
block covers the addresses from 1.0.0.0 to 1.255.255.255(net id 1). The last block covers
the addresses from 127.0.0.0 to 127.255.255.255(net id 127).For each block of addresses
the first byte (net id) is the same, but the other three bytes (host id) can take any value in
the given range. The first and the last blocks of this class are reserved for special purpose
and one block (net id 10) is used for private addresses. The remaining 125 blocks can be
EMBEDDED WEB SERVER
15
assigned to organizations. However each block in the class contains
16,777,216 addresses for hosts, which means that the organizations
should be a large one to use all the addresses. The first address in the block is used to
identify the organizations to the rest of the internet. This address is called the network
address. It defines the network of the organization, not individual hosts.
Class B:
10
Net id host id
Class B is divided into 16,384 blocks with each block having a different net
id. The first block covers the addresses from 128.0.0.0 to 128.0.255.255(net id 128.0).
The last block covers the addresses from 191.255.0.0 to 125.255.255.255 (net id
191.255).For each block of addresses the first 2 bytes (net id) are the same, but the other
2 bytes (hostid) can take any value in the given range.
There are 16,384 networks that are there in class B. Sixteen blocks are
reserved for private addresses .Therefore there are a total of 16,368 class B networks that
can be assigned to the organizations. Each block in the class contains 65,536 addresses to
be assigned to the hosts. Class B addresses are designed for mid size organizations.
Class C:
110
Net id Host id
Class C is divided into 2,097,052 blocks with each block having a different
net id. 256 blocks are used for private addresses leaving 2,096,896 blocks for assignment
EMBEDDED WEB SERVER
16
to organizations. The first block covers addresses from 192.0.0.0 to
192.0.0.255 (net id 192.0.0). The last block covers addresses from
223.255.255.0 to 223.255.255.255 (net id 223.255.255). For each block of address the
first three bytes (net id) are the same but the remaining byte (host id) can take any value
in the given range. There are 2,096,902 blocks that can be assigned this means that the
total number of organizations that can have class C address is 2,096,902.Howeever each
block in this class contain 256 address which means the organization should be small
enough to need less than 256 addresses. The first address is the network address and the
last address is reserved for special purpose. Class C addresses were designed for small
organizations with a small number of hosts attached to their networks.
Class D:
1110
Multicast address
Class E:
1111
17
There is just one block of class E address. It was
designed for use as reserved addresses. The last addresses in this class
255.255.255.255 are used for special address.
INTERNET PROTOCOL:
The internet protocol is a transmission mechanism used by the TCP/IP
protocols. IP is an unreliable and connection less datagram protocol a best effort delivery
service. The term best effort means that IP provides no error checking or tracking. IP
assumes the unreliability of the underlying layers and does its best to get a transmission
through its destination but with no guarantees.
If reliability is important, IP must be paired with reliable protocol such
as TCP. IP is also a connection less protocol packaged for a packet switching network
that uses the datagram approach. This means that each datagram is handled
independently and each datagram can follow a different route to the destination. This
implies that datagram send by the same source to the same destination could arrive out of
order. Also some could be lost or corrupted during transmission. Again IP also relies on
higher level protocol to take care of all these protocols.
Datagram:
18
IP DATAGRAM
32 bits
Version (VER):
This four bit field defines the version of IP protocols. Currently the version is
4. However version 6 may replace version 4 in few years. This field tells the IP software
running in the processing machine that the datagram has the format of the version 4. All
fields must be interpreted as specified in the fourth version of the protocol. If the
machine is using some other version of IP the data gram is discarded rather than
interpreted incorrectly.
field is 5(5*4 = 20). When the option field is at its maximum size the value of this field is
15(15*4 = 60).
Differentiated services:
In this interpretation the first six bits make up the code point subfield
and the last two bits are not used. The code point subfield can be used in two different
ways
20
1. When the three right most bits are zeros the three left most bits are
interpreted the same as the precedence bits in the service type
interpretation. In other words it is compatible with the old interpretation.
2. When the three right most bits are not all zeros, the six bits define 64 services based
on the priority assignment by the internet or the local authorities according to the
table given below.
The first category contains the 32 service types. The second any third
contains 16 bytes. The first category (numbers 2, 4, 6… 62) is assigned by the internet
authorities. The second category (3, 7, 11, 15 … 63) can be used by local authorities. The
third category (1, 5, 9 …61) is temporary and can be used for experimental purposes. The
numbers are not contiguous. If they were the first category would range from 0 to 31.
The second 32 to 47 and the third 48 to 63. This would be incompatible with the TOS
interpretation because xxx000 (which includes 0, 8, 16, 24,32,40,48 and 56) will fall into
all three categories.
Total length:
This is a 16 bit field that defines the total of the IP datagram in bytes. To
find the length of the data coming from the upper layer, subtract the header length from
the total length. The header length can be found by multiplying the value in the HLEN
field by four.
21
Since the field length is 16 bits the total length of the IP datagram is
limited to 65535 (2^16 – 1) of which 20 to 60 bytes of the header and the rest is data
from the upper layer. Though a size of 65535 bytes might seem large the size of IP
datagram may increase in the near future as the underlying technologies allow even more
throughput. Some physical networks are not able to encapsulate the datagram of 65535
bytes in their frames. The datagram must be fragmented to be able to pass through these
networks. When a machine receives a frame it drops the header and trailer leaving the
datagram.
Time to live:
A datagram has limited lifetime in its travel through its internet. This
field was originally designed to hold a timestamp which was decremented by each visited
router. The datagram was discarded when the value become zero. However for this
scheme all machines must have synchronized clocks and must know how long it takes for
datagram to go from one machine to another. Today this field is used mostly to control
the maximum number of hops visited by the datagram. When the source host sends the
datagram it stores a number in this field. This value is approximately 2 times the
maximum number of routes between any two hosts. Each router that processes the
datagram decrements this number by one. If this value after being decremented is zero
the router discards the datagram. This field is needed because routing tables in the
internet cab become corrupted. A datagram may travel between two or more routers for a
long time without getting delivered to the destination host. Resources may become tied
up. This field limits the life time for a datagram and prevents old data grams from
popping out of the networks and perhaps confusing higher level protocols (especially
EMBEDDED WEB SERVER
22
TCP). Another use of this field is to intentionally limit the journey of the
packet. For example if the source wants to confine the packet to the local
network it can store 1 in
this field. When the packet arrives at the first router this value is decremented to zero and
the datagram is discarded.
Protocol:
This eight bit field defines the higher level protocol that uses the services of
the IP layer. An IP datagram can encapsulate data from several higher level protocols
such as TCP, UDP, ICMP and the IGMP. This field specifies the final destination protocol
to which the IP datagram must be delivered. In other words since the IP protocol
multiplexes and demultiplexes data from different higher level protocols the value of this
field helps in demultiplexing process when the datagram arrives at its final destination
Check sum:
The check sum field tells the check sum of the datagram. It is used for the
error detection purpose. It is the redundant information added to the packet. The
checksum is calculated at the sender and the value obtained is sent with the packet. The
receiver repeats the same calculation on the whole packet including the checksum. If the
result is satisfactory the packet is accepted otherwise it is rejected.
Source address:
This 32 bit field defines the IP address of the source. This field must remain
unchanged during the time the IP datagram travels from the source host to the destination
host.
Destination address:
23
This 32 bit defines the IP address of the destination this field
must remain unchanged during the time the IP datagram travels from the
source host to the destination host.
Fragmentation:
protocol with an MTU of this size. However, for other physical networks we must divide
the datagram to make it possible to pass through these networks. This is called as
fragmentation. There are three fields used for the purpose of the fragmentation. The
fields that are related to fragmentation and reassembly of IP datagram are Identification,
flags, and fragmentation offset fields.
24
Identification:
This 16 bit field identifies a datagram originating from the source host. The
combination of Identification and source IP address must uniquely define a datagram
as it leaves the source host. To guarantee the uniqueness the IP protocol uses a counter to
label the datagrams. The counter is initialized to a positive number. When IP protocol
sends a datagram it copies the current value of the counter to the identification field and
increments the count by one.As long as the counter is kept in the main memory
uniqueness is guaranteed. When a datagram is fragmented the value in this identification
field is copied into all fragments. In other words all fragments had same identification
number which is also the same as the original datagram. The identification number helps
the destination in reassembling the datagram. It knows that all fragments having the same
identification value should be assembled into one datagram.
Flags:
This is a three bit field. The first field is reserved. The second bit is called do not
fragment bit. If its value is ‘1’ the machine must not fragment the datagram. If it cannot
pass the datagram through any physical network it discards the datagram and sends an
ICMP error message to the source host. If its value is zero the datagram can be
fragmented if necessary. The third bit is called more fragment bit. If its value is ‘1’ it
means the datagram is not the last fragment, there are more fragments after this one. If its
value is ‘0’ this is last or only fragment.
Fragmentation offset:
This 13 bit field shows the relative position of this fragment with respect
to the whole datagram. It is the offset of the data in the original datagram measured in
units of 8 bytes. For example a datagram with a data size of 4000 bytes is fragmented
into 3 fragments the bytes in the original data are numbered from 0 to 3999. The first
25
fragment carries the bytes from 0 to 1399. The offset for this datagram is
0/8 = 0. The second byte carries bytes from 1400 to 2799, the offset
value for this fragment is 1400/8 = 175. Finally the third fragment carries bytes 2800 to
3999. The offset value for this fragment is 2800/8 = 350.
TCP SERVICES:
The services offered by TCP to the processes at the application layer are
given below
Stream delivery service:
TCP is a stream oriented protocol. TCP allows the sending process to
deliver data as a stream of bytes and the receiving process to obtain data as a stream of
EMBEDDED WEB SERVER
26
bytes. TCP creates an environment in which two processes seem to be
connected by an imaginary tube that carries the data across the internet.
The sending process produces a stream of bytes and the receiving process consumes it.
Sending and receiving buffers:
Because a sending and receiving processes may not produce and
consume data at the same speed TCP needs to buffer for storage. There are two buffers,
the sending and receiving buffers for each direction used for storing the data in case of
flow control.
Segments:
Although buffering handles the disparity between speed of producing
and consuming processes we need one more step before we can send the data. The IP
layer as a service provider for TCP needs to send data in packets not as a stream of bytes.
At the transport layer TCP groups a number of bytes together into a packet called a
segment. TCP adds the header to each segment and delivers the segment to the IP layer
for transmission. The segments are encapsulated in the IP datagram and transmitted. This
entire operation is transparent to the receiving process.
Full duplex service:
TCP offers full duplex service where data can flow in both directions at
the same time. Each TCP has sending and receiving buffers and segments are send in
both directions
27
This is a virtual connection but not a physical connection
.The TCP segment is encapsulated in an IP datagram and can be sent out of order or lost
or corrupted and then resent. Each may use a different path to reach the destination.
Theirs is no physical connection. However, because TCP creates a stream oriented in
which it accepts the responsibility of delivering the bytes in order to the other site. The
situation is similar to that of having a connection between the two sites.
PROJECT DESCRIPTION
BLOCK DIAGRAM:
Processor Ethernet
RABBIT controller RTL
3000 8019AS
EMBEDDED WEB SERVER
28
RJ45
CONNECTOR
PC PC
PC PC
PC PC
DESCRIPTION:
1. A computer that is responsible for accepting HTTP requests from clients, which are
known as Web browsers, and serving them Webpages, which are usually HTML
documents.
2. A computer program that provides the functionality described in the first sense of the
term.
29
This web server consists of Rabbit processor, Ethernet controller,
flash memory, RJ45 jack. The web pages are stored in the flash memory.
When ever a request comes from a client the Ethernet controller first receives the request
and attaches the source and destination address and forwards the frame to rabbit
processor. Then the processor serves the web pages to the pc that request the page.
There are two ways to connect our web server one way by using a direct
connection between pc and RCM board using Ethernet cross over cable or simple
arrangement using a hub. In order to set up this direct connection the user will have to
use a pc without networking or disconnecting a pc from the corporate network.
The figure below shows the two ways of connecting the RCM 3700 module to the Pc
OPERATION
30
1. We need TCP / IP properties of network neighbourhood that is IP
address of client or server we use 169. 254. 52. 47
2. Subnet mask =255. 255. 255. 0
3. Default Gateway = 169. 254. 52. 10
4. DNS Server = 169. 254. 52. 10
5. Alternate DNS Server = 218. 248. 240. 23
The IP address 169. 254. 52. 47 have been code dumped in the Rabbit
module. For this we used a special type of bus compatible with LAN and Rabbit.
A Web page is opened. Now we can activate the device by typing the IP address
169. 254. 52. 47.
To change IP Address:
At WINDOWS XP ‘START’.
START SETTINGS CONTROL PANEL NETWORK CONNECTION
LAN CONNECT.
31
If you want to change IP Address change to 169 . 254. 52. 56 (for
example.).
WEB SERVER
INTRODUCTION:
32
• A computer that is responsible for accepting HTTP requests from
clients, which are known as Web browsers, and serving them Web pages, which
are usually HTML documents.
• A computer program that provides the functionality described in the first sense of
the term.
• Although Web server programs differ in detail, they all share some basic common
features.
• Every Web server program operates by accepting HTTP requests from the
network, and providing an HTTP response to the requester.
• The HTTP response typically consists of an HTML document, but can also be a
raw text file, an image, or some other type of document.
• The origin of the content sent by server is called static if it comes from an
existing file or dynamic if it is dynamically generated by some other program or
script called by Web server. Serving static content is usually much faster than
serving dynamic content.
INTRODUCTION:
33
Now-a-days the servers that are commonly used are
APACHE, TOMCAT etc. These servers are very huge in size and are to
be operated from a fixed location .In contrast EMBEDDED WEB SERVER is portable
web-server that can be moved to any remote location and can be accessed by connecting
it to the network where ever it is required. The web server is designed using RCM 3700
module.
34
6. Ten 8-bit timers (six cascadable) and one 10-bit timer with two match
registers.
7. 512K flash memory and 512K SRAM (Options for 256K flash memory and 128K
SRAM).
8. 1Mbytes serial flash memory, which is required to run the optional Dynamic C FAT
file system.
9. Real-time clock.
10. Provision for customer-supplied backup battery via connections on header J1.
11.10-bit free-running PWM counter and four pulse-width registers.
12. Two-channel Input Capture can be used to time input signals from various port pins
13. Two-channel Quadrature Decoder accepts inputs from external incremental encoder
modules.
14. Four available 3.3 V CMOS-compatible serial ports: maximum asynchronous baud
rate of 2.76 Mbps. Three ports are configurable as a clocked serial port (SPI), and
one port is configurable as an HDLC serial port. Shared connections to the Rabbit
microprocessor make a second HDLC serial port available at the expense of two of
the SPI configurable ports, giving you two HDLC ports and one asynchronous/SPI
serial port.
15. Watchdog supervisor.
35
1.
4. Generous memory size allows large programs with tens of thousands of lines of code,
and Substantial data storage.
5. Program download utility (Rabbit Field Utility) and cloning board options for rapid
production loading of programs.
6. Fast to market using a fully engineered ”ready- to- run/ready- to- program”
microprocessor core.
8. Integrated Ethernet port for network connectivity, with royalty-free TCP/IP software.
36
RCM3700 Digital Inputs and Outputs:
The RCM3700 has 52 parallel I/O lines grouped in seven 8-bit ports
available on headers J1 and J2. The 44 bidirectional I/O lines are located on pins
PA0–PA7, PB0, PB2–B7, PD2–PD7, PE0–PE1, PE3–PE7, PF0–PF7, and PG0–PG7.
Figure shows the RCM3000 Rabbit Core series pin outs for headers J1 and J2.
37
Figure: RCM3700 Pinouts
The signals labeled PD2, PD3, PD6, and PD7 on header J1 (pins 29–
32) and the pins that are not connected (pins 33–34 on header J1 and pin 33 on header J2)
are reserved for future use on other models in the RCM3000 series.
38
Figure: The Use of the Rabbit 3000 Ports in the RCM3700 Series Rabbit Core
modules:
The ports on the Rabbit 3000 microprocessor used in the RCM3000 Series are
configurable, and so the factory defaults can be reconfigured.
The Rabbit 3000 address lines (A0–A18) and all the data lines (D0–D7) are
routed internally to the onboard flash memory and SRAM chips. I/0 write (/IOWR) and
I/0 read (/IORD) are available for interfacing to external devices.
Parallel Port A can also be used as an external I/O data bus to isolate
external I/O from the main data bus. Parallel Port B pins PB2–PB5 and PB7 can also be
used as an auxiliary address bus.
39
When using the auxiliary I/O bus for either Ethernet or the
LCD/keypad module on the Prototyping Board, you must define the usage of port A as
the auxiliary I/O bus.
SERIAL COMMUNICATION:
The RCM3700 board does not have any serial
transceivers directly on the board. However, a serial interface may be
incorporated on the board the RCM3700 is mounted on.
For Example, the Prototyping Board has RS-232, RS-485 and IrDA
transceiver chips.
Serial ports:
There are five serial ports designated as Serial Ports A,
C, D, E, and F. All five serial ports can operate in an asynchronous
mode up to the baud rate of the system clock divided by 8.An
asynchronous port can handle 7 or 8 data bits. A 9th bit address
scheme, where an additional bit is sent to mark the first byte of a
message, is also supported.
Serial Port A is normally used as a programming port, but
may be used either as an asynchronous or as a clocked serial port
once the RCM3700 has been programmed and is operating in the Run
Mode.
Serial Ports C and D can also be operated in the clocked
serial mode. In this mode, a clock line synchronously clocks the data in
or out. Either of the two communicating devices can supply the clock.
Serial Ports E and F can also be configured as HDLC serial
ports. The IrDA protocol is also supported in SDLC format by these two
ports.
40
Either Serial Ports C and D or Serial Port F
can be used at one time because these ports share some
common pins on header J1, as shown in below Figure. The selection of
port(s) depends on your need for two clocked serial ports (Serial Ports
C and D) vs. a second HDLC serial port (Serial Port F).
The serial ports used are selected with the serXOpen function call, where X
is the serial port (C, D, or F). Remember that Serial Ports C and D cannot be used if
Serial Port F is being used.
Ethernet port:
The figure below shows the pinout for the RJ-45 Ethernet port (J3).
41
Two LEDs are placed next to the RJ-45 Ethernet jack, one to indicate an
Ethernet link (LINK) and one to indicate Ethernet activity (ACT).The RJ-45 connector
is shielded to minimize EMI effects to/from the Ethernet signals.
Programming Port:
Serial Port A has special features that allow it to cold-boot the system after
reset. Serial Port A is also the port that is used for software development under Dynamic
C. The RCM3700 is accessed using a 10-pin program header labeled J2. The
programming port uses the Rabbit 3000’s Serial Port A for communication, and is used
for the following operations.
• Programming/debugging
• Cloning
42
The Rabbit 3000 startup-mode pins (SMODE0, SMODE1)
are presented to the programming port so that an externally connected
device can force the RCM3700 to start up in an external bootstrap mode. The Rabbit
3000 status pin is also presented to the programming port. The status pin is an output that
can be used to send a general digital signal. The clock line for Serial Port A is presented
to the programming port, which makes synchronous serial communication possible.
The programming port is used to start the RCM3700 in a mode where the
RCM3700 will download a program from the port and then execute the program. The
MEMORY:
SRAM:
RCM3700 series boards have 256K–512K of SRAM
packaged in 32-pins Package.
Flash ROM:
43
Serial Flash:
SCHEMATIC DIAGRAM:
44
RABBIT 3000 MICRO PROCESSOR
INTORDUCTION:
45
Rabbit Semiconductor was formed expressly to design a
better microprocessor for use in small and medium-scale controllers. The
first microprocessor was the Rabbit 2000. The second microprocessor, now available, is
the Rabbit 3000. Rabbit microprocessor designers have had years of experience using
Z80, Z180, and HD64180 microprocessors in small controllers. The Rabbit shares a
similar architecture and a high degree of compatibility with these microprocessors, but it
is a vast improvement. The Rabbit 3000 has been designed in close cooperation with Z-
World, Inc., a long-time manufacturer of low-cost single-board computers. Z-World’s
products are supported by an innovative C-language development system (Dynamic C).
Z-World is providing the soft-ware development tools for the Rabbit 3000.
The Rabbit 3000 is easy to use. Hardware and software interfaces are as
uncluttered and are as foolproof as possible. The Rabbit has outstanding computation
speed for a micro-processor with an 8-bit bus. This is because the Z80-derived
instruction set is very compact, and the timing of the memory interface allows higher
clock speeds for a given memory speed.
46
• Industrial specifications are for 3.3 V ±10% and a temperature
range from -40°C to +85°C. Modified commercial specifications
are for a voltage variation of 5% and a temperature range from -40°C to 70°C.
• 1-megabyte code-data space allows C programs with 50,000+ lines of code. The
extended Z80-style instruction set is C-friendly, with short and fast opcodes for
the most important C operations.
• Four levels of interrupt priority make a fast interrupt response practical for critical
applications. The maximum time to the first instruction of an interrupt routine is
about 0.5 µs at a clock speed of 50 MHz.
• Hardware design is simple. Up to six static memory chips (such as RAM and
flash memory) connect directly to the microprocessor with no glue logic. Also
most I/O devices may be connected without glue logic.
• The memory read cycle is two clocks long. The write cycle is 3 clocks long. A
clean memory and I/O cycle completely avoid the possibility of bus fights.
Peripheral I/O devices can usually be interfaced in glue less fashion using the common
47
3000 based system can be assured of passing FCC or CE EMI
tests as long as minimal design precautions are followed.
• The Rabbit may be cold-booted via a serial port or the parallel access slave port.
This means that flash program memory may be soldered in unprogrammed, and
can be reprogrammed at any time without any assumption of an existing program
or BIOS.
• There are 56 parallel I/O lines. Some I/O lines are timer synchronized, which
permits precisely timed edges and pulses to be generated under combined
hardware and software control.
• Four pulse width modulated (PWM) outputs are implemented by special
hardware. The repetition frequency and the duty cycle can be varied over a wide
range. The resolution of the duty cycle is 1 part in 1024.
• There are six serial ports. All six serial ports can operate asynchronously in a
variety of commonly used operating modes. Four of the six ports (designated A,
B, C, D) support clocked serial communications suitable for interfacing with
“SPI” devices and various similar devices such as A/D converters and memories
that use a clocked serial protocol. Two of the ports E and F, support HDLC /
SDLC synchronous communication. High data rates are supported by all six serial
ports.
• Numerous timers and counters can be used to generate interrupts, baud rate
clocks, and timing for pulse generation.
48
• Two quadrature decoder units accept input from incremental
optical shaft encoders. These units can be used to track the
motion of a rotating shaft or similar device.
• A built-in clock doubler allows ½-frequency crystals to be used.
• The built-in main clock oscillator uses an external crystal or a ceramic resonator.
Typical crystal or resonator frequencies are in the range of 1.8Mhz to 30Mhz.The
current is proportional to voltage and clock speed at 1.8 V and 3.84 MHz the
current could be about 5 mA, and at 1 MHz the current is reduced to about 1 mA..
This greatly reduces the power used by flash memory when operating at low
clock speeds.
• There is a built-in watch dog timer.
. The built- in battery- backable time / date clock uses an external 32.768 kHz
crystal oscillator. The time / date clock can be used to provide interrupts every
488 µs.Typical battery current consumption is about 3µA.
49
RABBIT 3000 ADVANTANAGES:
• The glue less architecture makes it is easy to design the hardware system.
• There are a lot of serial ports and they can communicate very fast.
50
• Precision pulse and edge generation is a standard feature.
• The ultra low power mode can perform computations and execute logical tests
since the processor continues to execute, albeit at 32 kHz or even as slow as 2
kHz.
• One can write serious software, be it 1,000 or 50,000 lines of C code. The tools
are there and they are low in cost.
• The Rabbit 3000 is backed by extensive software development tools and libraries,
especially in the area of networking and embedded Internet.
51
The major on-chip peripherals are the serial ports, system
clock, time/date oscillator, parallel I/O, slave port, motion encoders, pulse width
modulators, pulse measurement, and timers. These and other features are described
below.
5 V Tolerant Inputs:
The Rabbit 3000 operates on a voltage in the range of 1.8 V to 3.6 V, but most
Rabbit 3000 input pins are 5 V tolerant. The exceptions are the power supply pins, and
oscillator buffer pins. The 5 V tolerant features allow 5 V devices that have a suitable
switching threshold to be directly connected to the Rabbit.
Serial Ports:
There are six serial ports designated ports A, B, C, D, E, and F. All six serial
ports can operate in an asynchronous mode up to a baud rate equal to the system clock
divided by 8. The asynchronous ports use 7-bit or 8-bit data formats, with or without
parity. A 9th bit address scheme, where an additional bit is set or cleared to mark the first
byte of a message, is also supported.
Serial ports A, B, C and D can be operated in the clocked serial mode. In this
mode, a clock line synchronously clocks the data in or out. Either the Rabbit serial port
or the remote device can supply the clock. Serial Port A has special features. It can be
used to cold-boot the system after reset. Serial Port A is the normal port that is used for
software development under Dynamic C.
All the serial ports have a special timing mode that supports infrared data
communications standards.
52
System Clock:
Parallel I/O:
There are 56 parallel input/output lines divided among seven 8-bit ports
designated A through G. Most of the port lines have alternate functions, such as serial
data or chip select strobes. Parallel Ports D, E, F, and G have the capability of timer-
synchronized outputs.
Slave Port:
The slave port is designed to allow the Rabbit to be a slave to another
processor, which could be another Rabbit. The port is shared with Parallel Port A and is a
53
bidirectional data port. The slave port can be used to signal the master to
perform tasks using a variety of communication protocols over the slave
port.
The Rabbit 3000 instruction set supports memory access and I/O access.
Memory access takes place in a 1 megabyte memory space. I/O access takes place in a
64K I/O space. In a traditional microprocessor design the same address and data lines are
used for both memory and I/O spaces. Sharing address and data lines in this manner often
forces compromises or makes With the Rabbit 3000, the designer has the option of
enabling completely separate buses for I/O and memory. Parallel Port A is used to
provide 8 bidirectional data lines.
The input capture channels are used to determine the time at which an event
takes place. An event is signaled by a rising or falling edge (or optionally by either edge)
on one of 16 input pins. A 16 bit counter is used to record the time at which the event
takes place. The input capture channels can be used to measure the width of fast pulses.
This is done by starting the counter on the first edge of the pulse and capturing the
counter value on the second edge of the pulse.
with each other. By having quadrature signals, the direction of rotation can be detected
by noting which signal leads the other signal. The Rabbit 3000 has 2 quadrature encoder
EMBEDDED WEB SERVER
54
units. Each unit has 2 inputs, one being the normal input and the other
the 90 degree or quadrature input.
Timers:
The Rabbit has several timer systems The periodic interrupt is driven by
the 32.768 KHz oscillator divided 16, giving an interrupt every 488 micro-seconds if
enabled. This is intended to be used as a general-purpose clock interrupt. Timer A
consists of ten 8-bit countdown and reload registers. Each countdown register can be set
to divide by any number between 1 and 256.The output of six of the timers is used to
provide baud clocks for the serial ports. Timer B consists of a 10 bit counter that can be
read but not written.
55
EMBEDDED WEB SERVER
56
PIN CONFIGURATIONS:
57
EMBEDDED WEB SERVER
58
DETAILS ON RABBIT MICROPROCESSOR
FEATURES:
The slave port allows a Rabbit to act as a slave to another processor, which
can also be a Rabbit. The slave has to have only a processor chip, a RAM chip, and clock
and reset signals that can be supplied by the master. The master can cold boot and
download a program to the slave. The master does not have to be a Rabbit processor, but
can be any type of processor. The slave processor’s slave port is connected to the master
processor’s data bus.
The compiler actually generates code for root code and constants and
extended code and extended constants. It allocates space for data variables, but does not
generate data bits to be stored in memory. In any but the smallest programs, most of the
code is compiled to extended memory. This code executes in the 8K window from E000
to FFFF. This 8K window uses paged access.
Parallel Ports:
59
The important properties of the ports are summarized below:
• Port A — Shared with the slave port data interface and auxiliary I/O data bus.
• Port B — Shared with control lines for slave port, auxiliary I/O address bus, and
clock I/O for clocked serial mode option for Serial Ports A and B.
• Port D — 4 bits shared with alternate I/O pins for Serial Ports A and B. 4 bits are
not shared.
• Port E — All bits of Port E can be configured as I/O strobes. 4 bits of port E can
be used as external interrupt inputs. One bit of port E is shared with the slave port
chip select.
• Port F — Parallel Port F outputs can carry the four Pulse-Width Modulator
outputs. As inputs, Parallel Port F inputs can carry the inputs to the two channels
of the quadrature decoders. Port F pins can also be configured to be used as clock
pins for clocked Serial Ports C and D.
• Port G — Port G inputs and outputs are also used for access to other serial
peripherals on the chip such as those used for asynchronous or synchronous
communication.
• Parallel Ports D–G behave in the same manner when used as digital I/O.
TIMERS:
There are two timers Timer A and Timer B. Timer A is intended mainly for
generating the clock for various peripherals, baud clock for the serial ports, a periodic
clock for clocking Parallel Ports D and E, or for generating periodic interrupts. Timers
60
A1–A7 are general-purpose timers, and Timers A8–A10 are dedicated to specific
peripherals. Timer B can be used for the same functions, but it cannot generate the baud
clock. Timer B is more flexible when it can be used because the program can read the
time from a continuously running counter and events can be programmed to occur at a
specified future time.
EMI CONTROL:
The Rabbit 3000 has important features that aid in the control of EMI.
• The power supply for the processor core is on separate pins from the power
supply for the I/O buffers associated with the processor and various peripheral
devices.
• A spectrum spreader in the clock circuit can be enabled to spread the spectrum of
the clock by varying the clock frequency in a regular pattern.
61
Watchdog Timer Support:
Watchdog Timer:
62
The Schematic Diagram below shows the Interfacing of Rabbbit3000
Processor with Ethernet Controller Chip.
63
The Rabbit 8-bit Processor vs. Other Processors:
The Rabbit 3000 processor has been designed with the objective of creating
practical systems to solve real world problems in an economical fashion.
• The Rabbit is a processor that can be used to build a system in which EMI is
nearly absent, even at clock frequencies in excess of 40 MHz. This is due to the
split power supply, the clock doubler, the clock spectrum spreader.
• Execution speed with the Rabbit is usually a pleasant surprise compared to other
processors. This is due to the well-chosen and compact instruction set partnered
with and excellent compiler and library.
• The Rabbit memory bus is an exceptionally efficient and very clean design. No
external logic is required to support static memory chips. Battery-backed external
memory is supported by built-in functionality.
• The Rabbit 3000 operates at 3.6 V or less, but it has 5 V tolerant inputs and has a
second complete bus for I/O operations that is separate from the memory bus.
This second auxiliary bus can be enabled by the application as a designer option.
These features make it easy to design systems that mix 3 V and 5 V components,
and avoid the loading problems and the EMI problems that result if the memory
bus is extended to connect with many I/O devices.
64
• The Rabbit is an 8-bit processor with an 8-bit external data bus and an 8-bit
internal data bus. Because the Rabbit makes the most of its external 8-bit bus and
because it has a compact instruction set, its performance is as good as many 16-
bit
processors. Many Rabbit instructions are 1 byte long. In contrast, the
minimum instruction length on most 32-bit RISC processors is 32 bits.
65
ETHERNET CONTROLLER
GENERAL DESCRIPTION:
66
is built in with 16K-byte SRAM in a single chip. It is designed not to provide more
friendly functions but also to save the effort of SRAM sourcing and inventory.
FEATURES:
• 100-pin PQFP
• RTL8019 software compatible
• Supports PnP auto detect mode (RTL8019AS only)
• Compliant to Ethernet II and IEEE802.3 10Base5, 10Base2, 10BaseT
• Software compatible with NE2000 on both 8 and 16-bit slots
• Supports both jumper and jumper less modes
• Supports Microsoft‘s Plug and Play configuration for jumper less mode
• Supports Full-Duplex Ethernet function to double channel bandwidth
• Supports three level power down modes:
• Sleep
• Power down with internal clock running
• Power down with internal clock halted
• Built-in data prefetch function to improve performance
• Supports UTP, AUI & BNC auto-detect (RTL8019AS only)
• Supports auto polarity correction for 10BaseT
• Support 8 IRQ lines
• Supports 16 I/O base address options
• _ and extra I/O address fully decode mode (RTL8019AS only)
• Supports 16K, 32K, 64K and 16K-page mode access to BROM (up to 256 pages
with 16K bytes/page)
• Supports BROM disable command to release memory after remote boot
67
• Supports flash memory read/write (RTL8019AS only)
• 16k byte SRAM built in (RTL8019AS only)
• Use 9346 (64*16-bit EEPROM) to store resource configurations and ID parameters
• Capable of programming blank 9346 on board for manufacturing convenience
• Support 4 diagnostic LED pins with programmable outputs
The below figure shows the pinout for the RJ-45 Ethernet port (J3).
68
PIN CONFIGURATIONS OF RTL 8019AS:
69
DYNAMIC C SUPPORT FOR THE RABBIT:
70
POWER SUPPLY
DESCRIPTION:
ORDINARY
AC VOLTAGE VOLTAGE
POWER SUPPLY
REGULATOR
BLOCK DIAGRAM OF R P S
The supply given is the +5V DC. The incoming power is 230V AC.So there
is need to convert it into +5V DC
The input AC supply is stepped down from 230V to 12-0-12V.The rectifier
consists of diodes D1, D2, D3 and D4 that makes the supply DC i.e. unidirectional
waveform. The output from rectifier is a URDC, whose value is +12V peak to peak.
The voltage regulator makes this URDC to RDC of +5V.The capacitor C1
and C2 is used to maintain constant voltage between two consecutive positive cycles
71
where as C3 and C4 is used to remove the fluctuations caused by
regulator. Here we are selecting +12V as a peak value. Because of fluctuations, the peak
voltage may decrease, and then regulator cannot step up to +5V.If we select peak value, a
higher one, then the problem can be overcome.
A regulated power supply, which maintains the output voltage constant
irrespective of AC mains fluctuations or load variations, is known as regulated power
supply. A regulated power supply consists of an ordinary power supply and voltage-
regulating device. The output of ordinary power supply is fed to the voltage regulator,
which produces the final output. The output voltage remains constant whether the load
current changes or there are fluctuations in the input AC voltage.
The rectifier converts the transformer secondary AC voltage into pulsating
voltage.The pulsating DC voltage is applied to the capacitor filter. This filter reduces the
pulsations in the rectifier DC output voltage.Finally; it reduces the variations in the
filtered output voltage.
Need of RPS:
In an ordinary power supply, the voltage regulation is poor i.e. DC output
voltage changes with load current. Output voltage also changes due to variations in the
input AC voltage. This is due to the following reasons:
1. There are considerable variations in AC line voltage caused by outside factors
beyond our control. This change the DC output voltage. Most of the electronic
circuits will refuse to work satisfactorily on such output voltage fluctuations.
These necessities to use regulated DC power supply.
2. The internal resistance of ordinary power supply in relatively
large.Therefore,output voltage is markedly affected by the amount of load
current
drawn from the supply . These variations in DC voltage may cause erratic
operation of electronic circuits. Therefore, regulated DC power supply is the only
solution in such situations
72
CIRCUIT DIAGRAM:
INPUT OUTPUT
+VCC
_ _ LM
7805
D1D1 D3
+ +
C1 C2 C3 C4
_
D2 _
+ D4
+
GROUND
1 3
o
utp
ut
230vAC +5
73
C1=1000 µf
.
C2=100 µf
C3=10 µf
C4=1 µf
WAVE FORMS:
74
DYNAMIC-C
Description:
75
• Editing
• Compiling
• Linking
• Loading
• Debugging
In fact, compiling, linking and loading are one function. Dynamic C has an
easy-to-use, built-in, full-featured, text editor. Dynamic C programs can be executed and
debugged interactively at the source-code or machine-code level. Pull-down menus and
keyboard shortcuts for most commands make Dynamic C easy to use.
76
statements and co functions) that support real-world embedded system
development. Dynamic C supports cooperative and preemptive
multitasking.
Dynamic C comes with many function libraries, all in source code. These
libraries support realtime programming, machine level I/O, and provide standard string
and math functions.
Speed:
77
Dynamic C differs from a traditional C programming system
running on a PC or under UNIX. The reason? To be better help
customers write the most reliable embedded control software possible. It is not possible
to use standard C in an embedded environment without making adaptations. Standard C
makes many assumptions that do not apply to embedded systems.
Many enhancements have been added to Dynamic C. Some of these are listed below:
• Dynamic C has a set of features that allow the programmer to make fullest use of
extended memory. Dynamic C supports the 1 MB address space of the microprocessor.
The address space is segmented by a memory management unit (MMU). Normally,
Dynamic C takes care of memory management, but there are instances where the
programmer will want to take control of it. Dynamic C has keywords and directives to
help put code and data in the proper place.
78
The keyword root selects root memory. The keyword
xmem selects extended memory, which means anywhere in the 1024 KB
or 1 MB code space. root and xmem are semantically meaningful in function
prototypes and more efficient code is generated when they are used. Their use must
match between the prototype and the function definition.
Dynamic C can be used to edit source files, compile and run programs, and
choose options for these activities using pull-down menus or keyboard shortcuts. There
are two modes: edit mode and run mode. To debug a program, a controller must be
connected to the PC, either directly via a programming cable or indirectly via an Ethernet
connection and a Rabbit Link board. Multiple instances of Dynamic C can run
simultaneously.
FLOW CHART:
START
INITIALIZE THE
PORT
PARAMETERS
IF NO
ANY
REQUEST?
YES
NO
CHECK
VALIDITY?
YES
GET HTML PAGES
AND
FORM INTO PACKETS
SERVE FIRST
LINK PAGE
EMBEDDED WEB SERVER
80
NO
ANY LINK
REQUESTE
D
YES
YES
SERVE REMAINING
LINK PAGES
IS NO
DISCONNE
C--TED
YES
DISCONNECT THE
LINK SERVING
YES
A
ALGORITHM
Step-1 Initializing the port parameters like baurd rate=96 MHz, enable serial
Communication.
Step-2 Initializing the TCP/IP parameters like IP address, subnet mask, default gateway
EMBEDDED WEB SERVER
81
and DNS server.
Step-5 Convert the IP address into 64-bit string and load it into the Ethernet device.
Step-6 If any request from the client arrives go to step-7, otherwise repeat step-6.
Step-7 Check for validity of IP address? If yes, go to step-8, otherwise repeat step-6.
Step-8 Get the HTML Pages from the computer main server and form data into packets.
Step-9 Then serves the first link page to the requested PC.
Step-10 Check for further link request? If yes to go step-11, otherwise repeat
step10.
Step-11 Serve the remaining link pages requested from the corresponding PC.
Step-12 Check whether the link is disconnected or not; If yes, goto step-13.otherwise
repeat step-12.
browseled.c
Z-World, 2003
82
with prototyping boards.
Description
===========
This program demonstrates a basic controller running a
WEB page. Two "device LED's" are created with two
buttons to toggle them. Users can browse to the device
and change thestatus of the lights. The LED's on the
prototyping board will match the ones on the web page.
Instructions
============
1. Make changes below in the configuration section to
match your application.
2. Compile and run this program.
3. With your WEB browser access the WEB page running on
the controller.
4. View LEDS on Web page and the prototyping board to
see that they match-up when changing them via the
WEB pagecontrol button.
**********************************************************/
#class auto
/***********************************
EMBEDDED WEB SERVER
83
* Configuration Section *
* --------------------- *
* All fields in this section must *
* be altered to match your local *
* network settings. *
***********************************/
/*
* Pick the predefined TCP/IP configuration for this sample. See
* LIB\TCPIP\TCP_CONFIG.LIB for instructions on how to set the
* configuration.
*/
#define TCPCONFIG 1
/*
* TCP/IP modification - reduce TCP socket buffer
* size, to allow more connections. This can be increased,
* with increased performance, if the number of sockets
* are reduced. Note that this buffer size is split in
* two for TCP sockets--1024 bytes for send and 1024 bytes
* for receive.
*/
/*
EMBEDDED WEB SERVER
84
* Define the number of HTTP servers and socket buffers.
* With tcp_reserveport(), fewer HTTP servers are needed.
*/
#define HTTP_MAXSERVERS 2
#define MAX_TCP_SOCKET_BUFFERS 2
/*
* Our web server as seen from the clients.
* This should be the address that the clients (netscape/IE)
* use to access your server. Usually, this is your IP address.
* If you are behind a firewall, though, it might be a port on
* the proxy, that will be forwarded to the Rabbit board. The
* commented out line is an example of such a situation.
*/
#define REDIRECTHOST _PRIMARY_STATIC_IP
// #define REDIRECTHOST "my.host.com:8080"
/********************************
* End of configuration section *
********************************/
/*
85
#memmap xmem
#use "dcrtcp.lib"
#use "http.lib"
/*
* Notice that we have ximported in the source code for
* this program. This allows us to <!--#include file="ssi.c"-->
* in the pages/showsrc.shtml.
*
*/
/*
* In this case the .html is not the first type in the
* type table. This causes the default (no extension)
* to assume the shtml_handler.
*
*/
86
SSPEC_MIMETABLE_START
SSPEC_MIME_FUNC(".shtml", "text/html", shtml_handler),
SSPEC_MIME(".html", "text/html"),
SSPEC_MIME(".gif", "image/gif"),
SSPEC_MIME(".cgi", "")
SSPEC_MIMETABLE_END
/*
* Each ledx contains a text string that is either
* "ledon.gif" or "ledoff.gif" This string is toggled
* each time the ledxtoggle.cgi is requested from the
* browser.
*
*/
char led1[15];
char led2[15];
/*
* Instead of sending other text back from the cgi's
* we have decided to redirect them to the original page.
87
if (strcmp(led1,"ledon.gif")==0)
strcpy(led1,"ledoff.gif");
else
strcpy(led1,"ledon.gif");
cgi_redirectto(state,REDIRECTTO);
return 0;
}
cgi_redirectto(state,REDIRECTTO);
return 0;
}
SSPEC_RESOURCETABLE_START
SSPEC_RESOURCE_XMEMFILE("/", index_html),
SSPEC_RESOURCE_XMEMFILE("/index.shtml", index_html),
SSPEC_RESOURCE_XMEMFILE("/showsrc.shtml", showsrc_shtml),
SSPEC_RESOURCE_XMEMFILE("/rabbit1.gif", rabbit1_gif),
SSPEC_RESOURCE_XMEMFILE("/ledon.gif", ledon_gif),
SSPEC_RESOURCE_XMEMFILE("/ledoff.gif", ledoff_gif),
SSPEC_RESOURCE_XMEMFILE("/button.gif", button_gif),
SSPEC_RESOURCE_XMEMFILE("browseled.c", browseled_c),
SSPEC_RESOURCE_ROOTVAR("led1", led1, PTR16, "%s"),
EMBEDDED WEB SERVER
88
SSPEC_RESOURCE_ROOTVAR("led2", led2, PTR16, "%s"),
SSPEC_RESOURCE_FUNCTION("/led1tog.cgi", led1toggle),
SSPEC_RESOURCE_FUNCTION("/led2tog.cgi", led2toggle),
SSPEC_RESOURCETABLE_END
void update_outputs()
{
auto int value;
/* update O0 */
if (strcmp(led1,"ledon.gif"))
value|=DS1;
/* update O1 */
if (strcmp(led2,"ledon.gif"))
value|=DS2;
main()
{
strcpy(led1,"ledon.gif");
strcpy(led2,"ledoff.gif");
EMBEDDED WEB SERVER
89
sock_init();
http_init();
tcp_reserveport(80);
while (1)
{
update_outputs();
http_handler();
}
}
#nodebug
HTML Description
INTRODUCTION:
90
displayed in a web browser. HTML is used to structure information
denoting certain text as headings, paragraphs, lists and so on and can be
used to describe, to some degree, the appearance and semantics of a document.
91
• Presentational markup. Describes the appearance of the text, regardless of its
function. For example,
<b>boldface</b>
will render "boldface" in bold text. In the majority of cases, using presentational markup
is inappropriate, and presentation should be controlled by using CSS. In the case of both
<b>bold</b> and <i>italic</i> there are elements which usually have an equivalent
visual rendering but are more semantic in nature, namely <strong>strong
emphasis</strong> and <em>emphasis</em> respectively .Hypertext markup Links
parts of the document to other documents.
92
HYPERTEXT TRANSFER PROTOCOL
Upon receiving the request, the server sends back a status line, such as
"HTTP/1.1 200 OK", and a message of its own, the body of which is perhaps the
requested file, an error message, or some other information.
Request Message:
The request message consists of the following:
• Request line, such as GET /images/logo.gif HTTP/1.1, which requests the file
logo.gif from the /images directory .
93
• An empty line .
The request line and headers must all end with CRLF (i.e. a carriage return
followed by a line feed). The empty line must consist of only CRLF and no other
whitespace.Some headers are optional, while others (such as Host) are required by the
HTTP/1.1 protocol.
Request methods:
• GET – Requests a representation of the specified resource. By far the most common
method used on the Web today.
• HEAD – Asks for the response identical to the one that would correspond to a GET
request, but without the response body.
• POST – Submits user data (e.g. from a HTML form) to the identified resource. The
data is included in the body of the request.
• TRACE – Echoes back the received request, so that a client can see what
intermediate servers are adding or changing in the request.
• OPTIONS – Returns the HTTP methods that the server supports. This can be used to
check the functionality of a web server.
• CONNECT – For use with a proxy that can change to being an SSL tunnel.
94
HTTP versions:
• 0.9 Deprecated. Was never widely used. Only supports one command, GET. Does not
support headers. Since this version does not support POST the client can't pass much
information to the server.
• HTTP/1.1 Current version, persistent connections enabled by default and works well
with proxies. Also supports request pipelining, allowing multiple requests to be sent
at the same time, allowing the server to prepare for the workload and potentially
transfer the requested resources more quickly to the client.
In HTTP/0.9 and HTTP/1.0, a client sends a request to the server, the server
sends a response back to the client. After this, the connection is closed. HTTP/1.1,
however, supports persistent connections. This enables the client to send a request and
get a response, and then send additional requests and get additional responses. The TCP
connection is not released for the multiple additional requests, so the relative overhead
due to TCP is much less per request. The use of persistent connection is often called keep
alive. It is also possible to send more than one (usually between two and five) request
before getting responses from previous requests. This is called pipelining.
95
APPLICATIONS
• Attendance Recording
ADVANTAGES
96
CONCLUTION:
97
]
FUTURE ENHANCEMENTS
• Embedded devices
• Mobile browsers
Today/Tomorrow
98
BIBILOGRAPHY
BOOKS
By BEHROUZ A FOROUZAN
2. COMPUTER NETWORKS
By A.S. TANENBAUM
WEB SITES
1. WWW.RABBITSEMICONDUCTOR.COM
2. WWW.WIKEPEDIA.COM
3. WWW.ZWORLD.COM
99
RCM 3700 MODULE
100
Today/Tomorrow
101
EMBEDDED WEB SERVER
102
EMBEDDED WEB SERVER
103
EMBEDDED WEB SERVER
104
EMBEDDED WEB SERVER
105
EMBEDDED WEB SERVER
106
EMBEDDED WEB SERVER
107
EMBEDDED WEB SERVER
108
EMBEDDED WEB SERVER
109
EMBEDDED WEB SERVER
110
EMBEDDED WEB SERVER
111
EMBEDDED WEB SERVER
112
EMBEDDED WEB SERVER
113
EMBEDDED WEB SERVER
114
EMBEDDED WEB SERVER
115
EMBEDDED WEB SERVER
116
EMBEDDED WEB SERVER
117
EMBEDDED WEB SERVER
118
EMBEDDED WEB SERVER
119
EMBEDDED WEB SERVER
120
EMBEDDED WEB SERVER
121
EMBEDDED WEB SERVER
122
EMBEDDED WEB SERVER
123
EMBEDDED WEB SERVER
124
EMBEDDED WEB SERVER
125
EMBEDDED WEB SERVER
126
EMBEDDED WEB SERVER
127
EMBEDDED WEB SERVER
128
EMBEDDED WEB SERVER
129
EMBEDDED WEB SERVER
130
EMBEDDED WEB SERVER
131
EMBEDDED WEB SERVER
132
EMBEDDED WEB SERVER
133
EMBEDDED WEB SERVER
134
EMBEDDED WEB SERVER
135
EMBEDDED WEB SERVER
136
EMBEDDED WEB SERVER
137
EMBEDDED WEB SERVER
138
EMBEDDED WEB SERVER
139
EMBEDDED WEB SERVER
140
EMBEDDED WEB SERVER
141
EMBEDDED WEB SERVER
142
EMBEDDED WEB SERVER
143
EMBEDDED WEB SERVER
144
EMBEDDED WEB SERVER
145
EMBEDDED WEB SERVER
146
EMBEDDED WEB SERVER
147
EMBEDDED WEB SERVER
148
EMBEDDED WEB SERVER
149
EMBEDDED WEB SERVER
150
EMBEDDED WEB SERVER
151
EMBEDDED WEB SERVER
152
EMBEDDED WEB SERVER
153
EMBEDDED WEB SERVER
154
EMBEDDED WEB SERVER
155
EMBEDDED WEB SERVER
156
EMBEDDED WEB SERVER
157
EMBEDDED WEB SERVER
158
EMBEDDED WEB SERVER
159
EMBEDDED WEB SERVER
160
EMBEDDED WEB SERVER
161
EMBEDDED WEB SERVER
162
EMBEDDED WEB SERVER
163
EMBEDDED WEB SERVER
164
EMBEDDED WEB SERVER
165
EMBEDDED WEB SERVER
166
EMBEDDED WEB SERVER
167
EMBEDDED WEB SERVER
168
EMBEDDED WEB SERVER
169
EMBEDDED WEB SERVER
170
EMBEDDED WEB SERVER
171
EMBEDDED WEB SERVER
172
EMBEDDED WEB SERVER
173
EMBEDDED WEB SERVER
174
EMBEDDED WEB SERVER
175
EMBEDDED WEB SERVER
176
EMBEDDED WEB SERVER
177
EMBEDDED WEB SERVER
178
EMBEDDED WEB SERVER
179