Hello David,
home made board, PIC18F4685 at 40MHz 5V , an ENC28J60 Ethernet LAN / Network Module For Arduino with 3.3v / 5V level converter.
In module ENC28J60.BAS a little modify on MACInit SUB for 40MHz clock.
- Code: Select all
Public Sub MACInit()
#ifndef FULL_DUPLEX
#ifndef HALF_DUPLEX
Dim Register As REG
Dim PHYRegister As PHYREG
#endif
#endif
Dim i As Byte
// Set up the SPI module on the PIC for communications with the ENC28J60
ENC_CS_IO = 1
Output(ENC_CS_IO) // Make the Chip Select pin an output
ENC_SCK_TRIS = 0
ENC_SDO_TRIS = 0
ENC_SDI_TRIS = 1
// Set up SPI
#if _clock = 20 or _clock = 10
ENC_SPICON1 = $20 // SSPEN bit is set, SPI in master mode, FOSC/4, IDLE state is low level
#elseif _clock = 40
ENC_SPICON1 = $21 // SSPEN bit is set, SPI in master mode, FOSC/16, IDLE state is low level
#else
#error "MACInit() undefined SPI setup for clock frequency."
#endif
' ENC_SPICON1 = $20 // SSPEN bit is set, SPI in master mode, FOSC/4, IDLE state is low level
' ENC_SPICON1 = $21 // SSPEN bit is set, SPI in master mode, FOSC/16, IDLE state is low level
' ENC_SPICON1 = $22 // SSPEN bit is set, SPI in master mode, FOSC/64, IDLE state is low level
I noticed that the compiled SF Toolsuite are slightly faster because in some cases such as the direct control of GLCD I was forced to reduce the clock speed .. an example that the KS0108 with FW hangs with 40MHz clock and you do not able to have a filled rectangle if not decreasing the frequency to 32MHz. And 'certainly the optimization of compiled since the two ASM routines differ slightly in that routine where a FOR loop draws horizontal lines at a speed such as to lock the bus of the display.