English
Language : 

PIC18F97J60_11 Datasheet, PDF (225/492 Pages) Microchip Technology – 64/80/100-Pin, High-Performance, 1-Mbit Flash Microcontrollers with Ethernet
PIC18F97J60 FAMILY
19.2.1.2 Receive Buffer
The receive buffer constitutes a circular FIFO buffer
managed by hardware. The register pairs,
ERXSTH:ERXSTL and ERXNDH:ERXNDL, serve as
pointers to define the buffer’s size and location within
the memory. The byte pointed to by the ERXST pair
and the byte pointed to by the ERXND pair are both
included in the FIFO buffer.
As bytes of data are received from the Ethernet
interface, they are written into the receive buffer
sequentially. However, after the memory pointed to by
the ERXND Pointers is written to, the hardware will
automatically write the next byte of received data to the
memory pointed to by the ERXST pair. As a result, the
receive hardware will never write outside the
boundaries of the FIFO.
The user may program the ERXST and ERXND
Pointers while the receive logic is disabled. The point-
ers must not be modified while the receive logic is
enabled (ERXEN (ECON1<2>) is set).
The buffer hardware uses an Internal Pointer (not
mapped to any user-accessible registers) to determine
where unvalidated incoming data is to be written. When
a packet has been completely received and validated,
the read-only ERXWRPTH:ERXWRPTL registers are
updated with the Internal Pointer’s value. Thus, the
ERXWRPT registers define the general area in the
receive buffer where data is currently being written. This
makes it useful for determining how much free space is
available within the FIFO.
The ERXRDPT registers define a location within the
FIFO where the receive hardware is forbidden to write to.
In normal operation, the receive hardware will write data
up to, but not including, the memory pointed to by the
ERXRDPT registers. If the FIFO fills up with data and
new data continues to arrive, the hardware will not over-
write the previously received data. Instead, the incoming
data will be thrown away and the old data will be
preserved. In order to continuously receive new data, the
application must periodically advance this pointer when-
ever it finishes processing some, or all, of the old
received data.
An example of how the Receive Buffer Pointers and
packet data are related in the circular buffer scheme is
shown in Figure 19-6. Note that while four packets are
shown in this example, the actual number of packets
may be greater or lesser.
FIGURE 19-6:
CIRCULAR FIFO BUFFER AND THE RELATIONSHIPS OF THE POINTERS
ERXST
ERXND
ERXRDPT:
Sets boundary that Internal PB
Write Pointer cannot advance
beyond. Prevents Internal
Write Pointer from moving
into Packet 1’s data space.
ERDPT:
Data being read
out to application.
PB
Packet 1
(being processed
by application)
Unused Buffer
(may contain old data)
Packet 2
Packet 4
(currently being
received)
Packet 3
Internal Write Hardware Pointer
points to the buffer
location being written
(packet data is still
being received).
ERXWRPT:
Shows the end of
the last complete
received packet.
PB
Direction of reading and writing data
(lower to higher buffer addresses).
PB
PB: Packet Boundary, as defined by
the Next Packet Pointers that precede
each packet.
 2011 Microchip Technology Inc.
DS39762F-page 225