Skip to content

DEFVALB defined address, reading hw register #1

@axa88

Description

@axa88

now i don't/haven't used this library but it appears to me that you have a few errors.

your defined address for DEFVALB is incorrect and should be 0x07 rather than DEFVALB = 0x06 which is actually the address of DEFVALA

Also attempting to read a single hw register, your r/w is setup for buffer 3 and then returning buffer 4?

    public static byte ReadRegister8(byte register)
    {
        // This function will read a single register, and return it
        WriteBuffer3[0] = (BaseAddR | (Address << 1)); // Send the MCP23S17 opcode, chip address, and read bit
        WriteBuffer3[1] = register;
        spi0.TransferFullDuplex(WriteBuffer3, ReadBuffer3);
        return ReadBuffer4[2];
        // convertToInt(readBuffer);                             // Return the constructed word, the format is 0x(register value)

}

HastPiControl/Hastarin.Devices.MCP23S17/MCP23S17.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions