|
Part 2: Revving It Up
by Fred Eady
Start ı Tera
Term Pro ı Road Test ı The
Hardware ı As a Web Server ı Branching
Out ı Making Changes ı ReadyıSet?
ı Go ı Sources
and PDF
GO
After the PIC16F877 is notified that
the physical connection to the ISP is established, the PIC is responsible
for passing the ball to the S-7600A. This is done by setting the Connection
Valid bit in the S-7600A PPP control and status register. Setting
this bit tells the network stack that the layer below it is up and
operational. The Use PAP and PPP enabled bits also reside in the PPP
control and status register and are set with the same command used
to signal a good connection to the ISP. If you follow WWII movies,
this is where the pilot of the B-17 turns over control to the guy
with the Norden bombsight. The PIC sets the SCTL bit in the serial
port configuration register and gives control of the S-7600A UART
to the Seiko IC and its network stack mechanism.
This is the point in the process where
the S-7600A performs its magic. Iıve taken a full snapshot of the
process using Serialtest Async. Iım providing it to you as a readable
file so you can follow through the PPP negotiation sequence frame
by frame, beginning to end. The only information Iıll censor is my
logon password. Iım also including an Acrobat file that contains the
Serialtest
Async frame decodes. Using the
ASCII file in conjunction with the PDF file will illustrate the total
PPP process.
Bit 0 of the PPP control and status register
confirms to the PIC16F877 that PPP is up and operating. Your ISP assigned
IP address is negotiated and Photo 8 is the Tera Term Pro view of
the result.
|
|
| Photo 8ıThe IP address is the
address given to the S-7600A by my ISP during PPP negotiation.
Socket open indicates that the S07600A has passively opened
a socket for listening on Port 80. |
The S-7600A/PIC16F877 Internet Engineıs
PIC16F877 code has now entered the web server loop area. The code
here checks PPP up status and the condition of the modemıs DCD pin
to determine if the link is up and functioning. The S-7600A is capable
of supporting two sockets. This web server application uses Socket
0. Because the S-7600A/PIC16F877 Internet Engine is serving, Port
80 is loaded into the S-7600A, the server mode is activated, and Socket
0 is brought online.
If no timeouts occur and the link remains
active, a request from a remote web browser can be fielded. S-7600A
socket status is interrogated to ensure that a good connection exists
and that the TCP state is listening. If a request is received from
a web browser, an HTTP header is constructed and transmitted followed
by the HTML stored in the 24LC256 EEPROM. Time and temperature are
obtained from the DS1629 and inserted into the HTML text. The assembled
HTML page is then sent to the S-7600Aıs socket data register. The
data is sent and the PIC16F877 waits for the transmit to complete.
The socket is then closed and reopened making it ready to serve yet
another page of HTML like the one shown in Photo
9.
Iıve shown you how to take an everyday
PIC, a C compiler, a tiny firmware protocol stack, and a handful of
common components and put them on the Internet. For those of you who
wish to build and experiment with your own S-7600A/PIC16F877 Internet
Engine, Iıll post the details of how to purchase the kit at www.edtp.com.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ıCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |