[SOLVED !] SPI to ENC28J60


Closed Thread
Results 1 to 2 of 2

Thread: SPI to ENC28J603745 days old

  1. #1
    gerben-88
    Guest gerben-88's Avatar

    0 Not allowed!

    Talking SPI to ENC28J60

    Hi All

    i use this bord http://www.olimex.com/dev/enc28j60-h.html for the connection between my pic (18f452) and my PC.

    i write a basic code for flashing the leds on the ENC28J60 connector.
    this is my code but it doesn't work

    code:

    DEVICE 18F452
    XTAL = 20
    CONFIG_START
    OSC = HS ; HS Oscillator
    PWRT = ON ; Enabled
    BOR = OFF ; Enabled
    ;BORV = 42 ; 4.2V
    WDT = OFF ; Disabled
    LVP = OFF ; Disabled
    DEBUG = OFF ; Disabled
    CONFIG_END

    ALL_DIGITAL = TRUE
    ;76543210
    PORTA = %000000
    PORTB = %00000000
    PORTC = %00000000
    PORTD = %00000000
    PORTE = %000

    ; 76543210
    TRISA = %000000
    TRISB = %11111111
    TRISC = %10010000
    TRISD = %00000011
    TRISE = %000

    ;REGISTERS VOOR SPI
    SSPSTAT = %01000000 ; Status register for SPI .
    SSPCON1 = %00100000 ; Controlregister 1 for SPI .



    ;variabelen
    SYMBOL CS PORTE.2 'CS chip select
    SYMBOL Mosi PORTC.5 'SPI out to ENCJ60
    SYMBOL Miso PORTC.4 'SPI in from ENC26J60
    SYMBOL SCLK PORTC.3 'SPI clock

    CLEAR

    DELAYMS 2000


    WHILE 1=1

    CS = 0
    SHOUT Mosi,SCLK,0,[00111000,10010000]

    DELAYMS 150

    SHOUT Mosi,SCLK,0,[00111001,10000000]
    DELAYMS 150
    CS = 1

    WEND
    END

    can anybody tell me what i doing wrong?

    sorry for the bad english

    greetz gerben

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    wastrix
    Guest wastrix's Avatar

    0 Not allowed!

    Default

    Are you using a 3.3V PIC or do you have level shifting? The ENC28J60 has 5V tolerant inputs but you will need to shift the outputs up if you have a 5V micro.

    I have not checked the data you are sending is correct, but I strongly recommend you use Gabi's code here: http://picbasic.org/forum/showthread.php?t=6353 and look at the 3rd post.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. ENC28J60 Driver
      By Dave-S in forum Proton Plus Compiler v3
      Replies: 1
      Last Post: 7th March 2017, 22:02
    2. ENC28J60 support
      By hadv215 in forum Ethernet Module
      Replies: 1
      Last Post: 15th November 2014, 07:42
    3. [SOLVED !] Problem with enc28j60 and 17F877A
      By pascalbianca in forum Absolute Beginners Section
      Replies: 7
      Last Post: 10th November 2014, 07:27
    4. ENC28J60 help
      By akvii in forum Ethernet Module
      Replies: 5
      Last Post: 17th May 2013, 21:12
    5. help connecting ENC28j60 to the network
      By codymarc in forum Proton Plus Compiler v3
      Replies: 3
      Last Post: 25th October 2007, 15:55

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts