every second. When the dhcp_state_engine subroutine is
called, the bleaseflag value is checked and if the bleaseflag is
set and the EDTP Ethernet MINI is bound to the Linksys
router, the 32-bit lease time value is decremented. If the
lease time value rolls into zero, the dhcp_state_engine code
kicks off another DHCP lease request to the Linksys router.
Before we can use any of that nifty 32-bit caveman arithmetic, we must accept the gracious offer that the Linksys router
has given to us. We do that by blasting out a DHCP Request
message, which is seen in Sniffer format in Screenshot 4.
Up to this point, our ported PICBASIC PRO EDTP
Ethernet MINI driver code is working perfectly. There’s only
one more step to gaining access to the network: receiving
the acknowledgment message to our lease request. The
positive acknowledgment talker message in Screenshot 1
backs up the DHCP Ack Sniffer capture you see in
Screenshot 5. All that’s left to do is parse the incoming
DHCP Ack message and place the IP addresses, subnet
masks, and lease time values into their proper memory slots.
Once the EDTP Ethernet MINI received its new IP and
gateway addresses, the send_bound_datagram subroutine
pushed a UDP datagram out onto the network. The MCHP
Detect application captured the data you see in Screenshot 6.
ANOTHER BRICK IN
You have joined an elite club. You
are now part of the initial PICBASIC
PRO EDTP Ethernet MINI driver
rollout. To my knowledge, at this time
there are no other free PICBASIC PRO
ports of PIC18F67J60 network drivers
available to the public.
The only brick that is yet to be
placed in our PICBASIC PRO wall of
networking fame is TCP. I think you all
have enough knowledge to get that
done without talking about it in an
additional installment of Design Cycle.
You have the C template in the PIC
BASIC PRO port download package.
And, you know all of my tricks. I’m sure
you also have some tricks of your own.
So, go forth and network, you Basic
lovers. Make Peter and his potties
proud! See you next time. NV
■ microEngineering Labs
( www.melabs.com): PICBASIC PRO
■ EDTP Electronics, Inc. ( www.
edtp.com): EDTP Ethernet MINI
■ Microchip ( www.microchip.com):
PIC18F67J60; MPLAB; REAL ICE
■ Network General ( www.network
general.com): Sniffer Portable LAN
■ HI-TECH Software ( www.htsoft.
com): The original EDTP Ethernet
MINI driver C application was
coded with HI-TECH PICC- 18.
CONTACT THE AUTHOR
■ Fred Eady can be reached via
email at firstname.lastname@example.org.