Comments (8)
Hi Joel (?),
Will try to have a look this evening, otherwise tomorrow.
I am from Netherlands, which time zone are you in?
(Helps with my planning)
from mcp23s17.
Hi Rob,
I am French in Normandy. using a chip select decoder is required in many design.
from mcp23s17.
Some observations and notes
- updated code tags in your 1st post for readability
- had a look at your library, think I understand the purpose from the code.
You want to give a number between 0..8 and depending on the number it sets the bits. - note that set_cs_low(7) is same as calling set_cs_high(uint8_t out)
Is this on purpose? - set_cs_high(uint8_t out) out parameter is not used.
- datasheet https://assets.nexperia.com/documents/data-sheet/74HC_HCT138.pdf
This chip you want to control.
Another observation is that you need to learn some bit math AND OR XOR etc.
This set_cs_high(uint8_t out) function would do the same.
void decode3to8::set_cs_low(uint8_t out)
{
if out > 7 return;
::digitalWrite(In2, out & 0x04);
::digitalWrite(In1, out & 0x02);
::digitalWrite(In0, out & 0x01);
}
In your .h file you use
#ifndef _74HC138_H_
#define _74HC138_H_
It is enough to place on the first line
#pragma once
from mcp23s17.
I try to modify the MCP23S17 with the addition of a chip selector between MCU and MCP23S17.
What are you trying to accomplish, in more detail?
- do you want to use 7 x MCP23S17 and select one with your library?
- something else?
from mcp23s17.
@joellecam
had a second look at the error message in your original question.
I modify the MCP23S17.cpp by this
MCP23S17::MCP23S17(uint8_t select, uint8_t address,__DECODE1ON8__ * decode3to8 = &dec3t8 , __SPI_CLASS__ * spi = &SPI )
{
_address = (address << 1);
_select = select;
_error = MCP23S17_OK;
_mySPI = spi;
_hwSPI = true;
_mydec3to8 = decode3to8 ;
}
should be
MCP23S17::MCP23S17(uint8_t select, uint8_t address,__DECODE1ON8__ * decode3to8, __SPI_CLASS__ * spi )
{
_address = (address << 1);
_select = select;
_error = MCP23S17_OK;
_mySPI = spi;
_hwSPI = true;
_mydec3to8 = decode3to8 ;
}
The default parameters should only be given in the .h file
from mcp23s17.
Hi Rob,
Thanks you very much. I have no error. I try the code in the next month after I receive the PCB
Best regards
Joël
from mcp23s17.
OK, I close the issue.
FYI, inspired by your library I decided to write my own and one for the 74HC154 too (4 to 16)
https://assets.nexperia.com/documents/data-sheet/74HC_HCT154.pdf
from mcp23s17.
just published the two libraries
There is also a 1 to 2 multiplexer in this range but that is left for the future.
If you have time, please give them (or the 138 only) a try.
Again thanks for the inspiration.
from mcp23s17.
Related Issues (20)
- Compilation for Arduino Nano 33 BLE fails HOT 6
- arduino-lint.yml workflow is not providing right status. HOT 1
- x16() functions don't work HOT 19
- No way to test for connection HOT 6
- Sharing a single select pin HOT 9
- Use of Interrupt Pins HOT 13
- Support for multiple Chips missing? HOT 13
- add keywords.txt
- Could I contact you with a help request for once? HOT 5
- MCP23S17 Daisy Chain On Common SPI Line HOT 13
- redo ESP32 SPI interface
- Arduino nano esp32 does not compile this library.
- remove hardware SPI end() begin() from library
- MCP.read(pin) always returns 1 HOT 11
- Is the hardware address correct? HOT 4
- ESP32-C3 and MCP23S17 HOT 30
- add parameter to begin() to make INPUT PULLUP conditional.
- Using interrupts HOT 54
- How to enable hardware SPI on ESP32-S3 for this MCP23S17 libary? HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcp23s17.