SPI instead of SHIFTOUT - MAX7219


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Momboz View Post
    What I did in my code is:
    Code:
    INTCON = %11000000       ' Set the interrupts, i.e. enable GIE and PEIE
    SSPIE = 1                       ' Enable SSPIE interrupt
    Is there any mistake I have overlooked in my interrupts setting?
    NO! You don't want to do that.

    You just use the flag to tell when the SSP is finished.
    If you enable interrupts without any interrupt Handlers, it goes off into never never land, overflows Stacks and generally just doesn't work.
    <br>
    DT

  2. #2
    Join Date
    Mar 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Default SPI instead of SHIFTOUT - MAX7219

    Quote Originally Posted by Darrel Taylor View Post
    NO! You don't want to do that.

    You just use the flag to tell when the SSP is finished.
    If you enable interrupts without any interrupt Handlers, it goes off into never never land, overflows Stacks and generally just doesn't work.
    <br>
    Sorry DT

    I wasn't complete in my previous answer.

    The first thing I did was to test with the addition of the while loop as you proposed and it wasn't successful, i.e. No toggle on PORTB.0 signal. It looks like the While loop is blocking the process (or like SSPIF is never set). if I suppress the while loop the PORTB.0 will toggle again.

    That's the reason why I thought about setting the interrupts.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Here is some sample code from meLabs. Maybe that would be of help to you.

    http://www.melabs.com/resources/samples/pbp/spimast.bas
    http://www.melabs.com/resources/samp...p/spislave.bas
    Tim Barr

  4. #4
    Join Date
    Mar 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Default SPI instead of SHIFTOUT - MAX7219

    Quote Originally Posted by falingtrea View Post
    Here is some sample code from meLabs. Maybe that would be of help to you.

    http://www.melabs.com/resources/samples/pbp/spimast.bas
    http://www.melabs.com/resources/samp...p/spislave.bas
    @falingtrea

    Many thanks for the advice. I have seen these examples and I couldn't succeed since I need a peer to talk to via the SPI. I am intending just to drive a MAX7219.

    Vielen Dank nochmals.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Momboz View Post
    It looks like the While loop is blocking the process (or like SSPIF is never set). if I suppress the while loop the PORTB.0 will toggle again.

    That's the reason why I thought about setting the interrupts.
    Works fine here.
    Ran your program (with the suggested changes) on an 877, and It sends data from the SSP and blinks the LED.

    It's A VERY FAST blink. Not visible to the naked eye (or clothed ones).

    Try putting a PAUSE 200 in the Main Loop.
    <br>
    DT

  6. #6
    Join Date
    Mar 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Smile SPI instead of SHIFTOUT - MAX7219

    Quote Originally Posted by Darrel Taylor View Post
    Works fine here.
    Ran your program (with the suggested changes) on an 877, and It sends data from the SSP and blinks the LED.

    It's A VERY FAST blink. Not visible to the naked eye (or clothed ones).

    Try putting a PAUSE 200 in the Main Loop.
    <br>
    Dear DT

    I would like, first, to thank you very very much for your support and then I wish to give you a feedback on how far I went with my SPI interface.

    After some investigation I could find the reason of the problem I have making SPI running on my board. It is a hardware issue. It's the way I am using the Melabs PICPROTO-USB board. That doesn't mean that Melabs PICPROTO-USB board is faulty.

    On that board you have the possibility to use the USB board in high speed. Therefore you need a capacitor C7 (0.470 µF) as shown in the documentation of that Melabs board (http://www.melabs.com/downloads/ppusbsch_06.pdf). This seems to prevent the SPI interface for running properly. I have taken the C7 away and everything went fine with SPI interface.

    Maybe we will have a new Melabs board with a jumper that could leave this capacitor out when using the SPI interface

    For the time being I have to make a choice for by Melabs board usage: either using USB high speed (and put the C7 capacitor) or using SPI (and take away the capacitor).

    Once again many thanks for your help.

    Best wishes / Momboz

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Good find Momboz!

    I see you mentioned the PICPROTO-USB up in post #3.
    But I never even looked at the schematic.

    For the time being I have to make a choice for by Melabs board usage: either using USB high speed (and put the C7 capacitor) or using SPI (and take away the capacitor).
    If you're using a PIC with USB, the SPI interface will be on different pins, so it shouldn't be a problem.
    But you're right. meLabs should have put a jumper in there for the capacitor.

    Cheers!
    DT

Similar Threads

  1. Max7219 cascading problem ?
    By iugmoh in forum General
    Replies: 2
    Last Post: - 13th December 2020, 10:53
  2. 7 Segment Displays and MAX7219
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 31st October 2010, 18:30
  3. Smart Star (how to use shift registers)
    By mackrackit in forum Code Examples
    Replies: 3
    Last Post: - 30th November 2008, 20:06
  4. Shorter Subroutines for MAX7219
    By exelanoz in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th March 2007, 11:35
  5. Replace Shiftout with spi
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 7th January 2007, 16:57

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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