Need help with MCP23S08


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Nov 2007
    Posts
    11

    Default Need help with MCP23S08

    It's killing me and I've become obsessed but I can't get the !@#$ thing to work
    I've got 8 leds connected to the outputs, and can see things being sent on the scope, and tried changing things around but still nothing. Maybe you might see it.
    I've attached the code as a text file to this note
    Thanks
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    A couple of things ....

    Don't REV (reverse) the bit order, both the MSSP and MCP23S08 use MSB first transfers.

    And, the CS (chip select) should be taken low before each command, then made high again when the command is complete. Otherwise it thinks you're next command is consecutive bytes to the first one.
    <br>
    DT

  3. #3
    Join Date
    Nov 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Thank you for your suggestion. I will change the code tomorrow and I will post the results.
    Had a thought i should be deselecting with each new command, but thought Microchip might have accounted for that. Also, I was reversing the bit order because I thought (incorrectly) the SSPBUF sent out the bits in reverse.
    So glad I joined this community of experts
    Nukte

  4. #4
    Join Date
    Nov 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel
    Your suggestion worked just right, and now the LEDS's light up just as I thought (hoped) they would. So thanks ever so much for the help.
    Just one more item if you can. I actually have 4 of the 23so8 chips and 32 LED's. The 23s08's have a common chip select line, all tied to my pic output port at RA1. I have set each of the addresses for each 23s08 from 00 to 11, but all of the LED's are coming on at the same time. I tried changing the addresses in my code but that did not change the problem. What do you think I can do now?
    Thanks Nukte

  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 nukte View Post
    Hi Darrel
    Your suggestion worked just right, and now the LEDS's light up just as I thought (hoped) they would. So thanks ever so much for the help.
    Great! One step down.

    For step 2, you'll just need to set the HAEN bit (bit3), in the IOCON register (address 5). Which enables the Hardware Address pins. Without it, all chips respond to address 00.

    hth,
    DT

  6. #6
    Join Date
    Nov 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Smile Thanks

    Project working .. Nuke is happy now
    Had the right code for setting HAEN but I was sending it to the wrong address.
    Thank you very much This helps me alot

  7. #7
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Thanks

    Only one thread on the 23S08. Well, maybe someone can help.

    I believe my problem is in the hardware but if someone can check the command below, that would be great. I took the attached file in the first thread and believe only the write command needed to be changed. I modified it to this but I still get nothing out of the 23S08. I'm using the PICkit serial SPI board.

    MCP_WRITE:
    low CS
    SSPBUF=0
    GOSUB CLOCK_BIT
    SSPBUF = spout
    high CS
    return

    I feel like something is missing in there. Also, to rule out the board, I was toggling one pin at a time. When I toggle the MOSI or MISO pins, the both appear to be connected because both pins go high and low at the same time. In other words, I pulse the MOSI with a 2 Hz signal and the MISO pin appears to be in parallel.

    Confused....

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


    Did you find this post helpful? Yes | No

    Default Re: Thanks

    After loading SSPBUF the second time, you need to wait for it to finish the transfer before taking CS high again.
    DT

  9. #9
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Nothing

    No dice. I think that command was wrong and this one *looks* correct after doing some more reading.
    Code:
    MCP_WRITE:
        low CS
        SSPBUF=64
        GOSUB CLOCK_BIT
        SSPBUF=MCP_ADDRESS
        GOSUB CLOCK_BIT
        SSPBUF = MCP_DATA
        GOSUB CLOCK_BIT                      
        high CS
    return
    Maybe one of the IC's on the PICkit board is bad. I wouldn't expect, although I don't know for sure, the MOSI and MISO pins to both go high or low at the same time if you only have power on one of those pins.

  10. #10
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: Nothing

    Hi Christopher;

    Check this wiki article. It shows how to handle the MCP23S17. Maybe can help you if you adapt to your ic.
    http://www.picbasic.co.uk/forum/cont...P-PBP-MSSP-ASM
    Thanks and Regards;
    Gadelhas

  11. #11
    Join Date
    Feb 2014
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: Need help with MCP23S08

    I would love to know why this info on the mcp23s08 is not in the data sheet or the application notes from the manufacturer?

    It has taken me a week of on-off searching to answer this question.

    Thanks to all.
    Last edited by Larrystein; - 6th February 2014 at 14:51.

  12. #12
    Join Date
    Nov 2014
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Need help with MCP23S08

    I am having a very strange problem with the Microchip MCP23S08.
    It seems no matter what I do, bit #6, GP6 is ALWAYS an input.
    I send 0 to the IODIR register to make all 8 bits to be outputs.
    I can output to any output except GP6.

    X1 VAR BYTE
    MCPWRT = $40
    MCPREAD = $41

    MCP23S08_IODIR = 0
    SHIFTOUT SDO2, SCK2, MSBFIRST, [MCPWRT,MCP23S08_IODIR,0]

    if I read back the IODIR register
    SHIFTOUT SDO2, SCK2, MSBFIRST, [MCPREAD,MCP23S08_IODIR]
    SHIFTIN SDI2, SCK2, MSBPRE, [X1]

    X1 always comes back and hex 40 indication GP6 is an input

    Help!

  13. #13
    Join Date
    Nov 2014
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Need help with MCP23S08

    scratch that, the problem was I erroneously has another device also chip selected on the bus.

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