MCP23017 INPUT

For general Flowcode discussion that does not belong in the other sections.
Post Reply
zoli2496
Posts: 28
http://meble-kuchenne.info.pl
Joined: Wed Sep 22, 2021 7:23 am
Been thanked: 2 times

MCP23017 INPUT

Post by zoli2496 »

Good afternoon!

How to configure MCP23017 macro to act as an input? I would like to connect 3 push buttons to port A GPA0-GPA1-GPA2.

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: MCP23017 INPUT

Post by medelec35 »

Hello.
What version of Flowcode are you using?
When starting a new topic, we recommend using either a 9 or 10 post icon when the post is specific to a version of Flowcode.
Martin

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: MCP23017 INPUT

Post by BenR »

Hello,

Just call the read function with the appropriate port index and mask and the data direction will be done for you.

zoli2496
Posts: 28
Joined: Wed Sep 22, 2021 7:23 am
Been thanked: 2 times

Re: MCP23017 INPUT

Post by zoli2496 »

Hello
I use Flowcode v9. The output already works with the MCP23017, but the input does not. I want to use only certain inputs from the MCP ic, with a push button. If I press the button, the value of the corresponding variable should be 0 or 1. This is what I want to achieve.

I have attached pictures.
Attachments
SCHEMATIC.JPG
SCHEMATIC.JPG (32.03 KiB) Viewed 968 times
MCP_IN.JPG
MCP_IN.JPG (32.2 KiB) Viewed 968 times
DEBUG.JPG
DEBUG.JPG (34.52 KiB) Viewed 968 times

zoli2496
Posts: 28
Joined: Wed Sep 22, 2021 7:23 am
Been thanked: 2 times

Re: MCP23017 INPUT

Post by zoli2496 »

more picture
Attachments
MCP_IN_CONFIG_3.JPG
MCP_IN_CONFIG_3.JPG (35.81 KiB) Viewed 968 times
MCP_IN_CONFIG_2.JPG
MCP_IN_CONFIG_2.JPG (37.2 KiB) Viewed 968 times
MCP_IN_CONFIG_1.JPG
MCP_IN_CONFIG_1.JPG (35.56 KiB) Viewed 968 times

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: MCP23017 INPUT

Post by medelec35 »

Hello.
Does reading the port work?
Attachments
MCP20317 port read demo.fcfx
(9.54 KiB) Downloaded 39 times
Martin

zoli2496
Posts: 28
Joined: Wed Sep 22, 2021 7:23 am
Been thanked: 2 times

Re: MCP23017 INPUT

Post by zoli2496 »

Only "DF_PLAYER" works, "VOL_UP" and "VOL_DOWN" do not work. Also, the value of "VOL_DOWN" is constantly 1. (no button is pressed, the value of "VOL_DOWN" is still 1.) It does not respond to "VOL_UP".
Attachments
DUMA_CLOCK_PSA08_MCP_IN.fcfx
(150.52 KiB) Downloaded 33 times

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: MCP23017 INPUT

Post by medelec35 »

One thing I have noticed.
With

Code: Select all

VOL_UP = 1 OR VOL_DOWN = 1
you have got OR which is a bitwise OR operator.
Can you try with

Code: Select all

VOL_UP = 1 || VOL_DOWN = 1
|| which is a logical OR operator.
| is the pipe key which is usually on the same key as the backslash \

Have you measured the voltage directly on the MCP23017 input pins to check the hardware?
Martin

Post Reply