MCP23S17 - Three different approaches - ShiftIn/ShiftOut / MSSP+PBP / MSSP+ASM


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: MCP23S17 - Three different approaches - ShiftIn/ShiftOut / MSSP+PBP / MSSP+ASM

    Hi Ryan7777;

    Try to add this 2 lines after the INTCON configuration and see if it works.

    TRISA = %00000000
    TRISB = %00000000
    Thanks and Regards;
    Gadelhas

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


    Did you find this post helpful? Yes | No

    Default Re: MCP23S17 - Three different approaches - ShiftIn/ShiftOut / MSSP+PBP / MSSP+ASM

    Hi Ryan7777;

    Have you allready tried my sugestion?

    I've tried and it worked, so you must add those to lines that i mention.
    Also remember that you are working with binary numbers, so this;

    Code:
        DataOut=DataOut+1        
        if dataout >=8 then
    will not light up all the leds.
    Thanks and Regards;
    Gadelhas

  3. #3
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: MCP23S17 - Three different approaches - ShiftIn/ShiftOut / MSSP+PBP / MSSP+ASM

    Oh hey, Thanks! You're exactly right the set up of my ports was the snag. I was also confused with the dataOut= and the pins on the port expander being addressed as a binary number (1,2,4,8,16,32,64,128). My first go after after setting up TRIS, the port expander was counting up in binary and of course stopping because of the if dataOut >=8 then bit of code. I fixed all of that and tossed together some quick, sloppy code using a couple of FOR NEXT loops and SELECT CASE structure to get it to count up and down in proper fashion to scan the LEDs one at a time up PORTA and back down. So if I wanted to play "night rider", now I all I'd need is a black firebird Now I feel like a have a good grasp on how to talk to the MCP23S17 for the project I had originally intended it for. Thank you for the fast replies and for posting your tutorial on this part! I'll post my "blinky" code when I get back to my real PC.

    Thanks again!

    Ryan

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