English
Language : 

PIC18F97J60_11 Datasheet, PDF (250/492 Pages) Microchip Technology – 64/80/100-Pin, High-Performance, 1-Mbit Flash Microcontrollers with Ethernet
PIC18F97J60 FAMILY
An example of how the entire assembled transmit
packet looks in memory is shown in Figure 19-10. To
construct and transmit a packet in this fashion:
1. Set the ETXST Pointers to an appropriate
unused location in the buffer. This will be the
location of the per-packet control byte. In the
example, it would be 0120h. It is recommended
that an even address be used for the ETXST
Pointers.
2. Using EDATA and the EWRPT registers,
sequentially write the packet data to the Ether-
net buffer. In order, write the data for the
per-packet control byte, the destination address,
the source MAC address, the type/length and
the data payload.
3. Set the ETXND Pointers to point to the last byte
in the data payload. In the example, it would be
programmed to 0156h.
4. Clear the TXIF flag bit (EIR<3>), and set the
TXIE (EIE<3>) and ETHIE bits to enable an
interrupt when done (if desired).
5. Start the transmission process by setting the
TXRTS bit (ECON1<3>).
If a DMA operation was in progress while the TXRTS bit
was set, the module will wait until the DMA operation is
complete before attempting to transmit the packet. This
possible delay is required because the DMA and
transmission engine share the same memory arbiter
channel. Similarly, if the DMAST bit is set after TXRTS
is already set, the DMA will wait until the TXRTS bit
becomes clear before doing anything.
While the transmission is in progress, the ETXST and
ETXND Pointers should not be modified. If it is
necessary to cancel the transmission, clear the TXRTS
bit.
When the packet is finished transmitting, or was
aborted due to an error/cancellation, several things
occur:
• The TXRTS bit is cleared.
• A 7-byte transmit status vector is written to the
buffer at the location pointed to by the ETXND
Pointers + 1.
• The TXIF flag is set.
• An interrupt will be generated (if enabled).
• The ETXST and ETXND Pointers will not be
modified.
To check if the packet was successfully transmitted,
read the TXABRT bit. If it has been set, poll the BUFER
bit in addition to the various fields in the transmit status
vector to determine the cause. The transmit status
vector is organized as shown in Table 19-4. Multi-byte
fields are written in little-endian format.
FIGURE 19-10: SAMPLE TRANSMIT PACKET LAYOUT
Buffer Pointers Address
Memory
Description
ETXST = 0120h
0120h
0121h
0122h
0Eh
data[1]
data[2]
Control
PHUGEEN, PPADN,
PCRCEN and POVERRIDE
Data Packet
Destination Address,
Source Address,
Type/Length and Data
ETXND = 0156h
0156h
0157h
0158h
0159h
015Ah
015Bh
015Ch
015Dh
015Eh
data[m]
tsv[7:0]
tsv[15:8]
tsv[23:16]
tsv[31:24]
tsv[39:32]
tsv[47:40]
tsv[55:48]
Status Vector
Status Vector
Written by the Hardware
Start of the Next Packet
DS39762F-page 250
 2011 Microchip Technology Inc.