RobTillaart / MCP23S17

Arduino library for SPI based MCP23S17 16 channel port expander
MIT License
27 stars 11 forks source link

Is the hardware address correct? #36

Closed NNGB-kor closed 8 months ago

NNGB-kor commented 9 months ago

check the datasheet of the 'microchip' company, the hardware address will be as shown in the image. 2024-02-24 233625

The hardware address is 0x00 0x01... Is this correct? 0x20 0x21 0x22... is correct?

RobTillaart commented 9 months ago

Thanks for the question. Will investigate coming week

RobTillaart commented 9 months ago

@NNGB-kor

Had a quick look as the library just works.

The 0x2.. is handled low level in MCP23S17.cpp around line 590 by the two masks. the 0x4 part is the shifted 0x2 part of the address.

////////////////////////////////////////////////////
//
//  PRIVATE
//

//  low level read / write masks
#define MCP23S17_WRITE_REG    0x40
#define MCP23S17_READ_REG     0x41

Does this solve your question?

RobTillaart commented 9 months ago

@NNGB-kor You can use address 0x2n where n == 0..7 and the library will work the same.

RobTillaart commented 8 months ago

Assuming this solved the problem, I close this issue. Feel free to reopen if needed.