Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Allow full bank reads from IO expander #75

Closed
mattbue opened this issue Nov 12, 2021 · 4 comments
Closed

Allow full bank reads from IO expander #75

mattbue opened this issue Nov 12, 2021 · 4 comments
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@mattbue
Copy link

mattbue commented Nov 12, 2021

Hi all,

i'm using the Arduino Machine Control to capture signals from sensors on production machines and send them via USB/serial port to a PC where the data is logged. Usually only the 8 digital inputs are needed.
Since i want to get the signals every millisecond, i realized that reading the signals one by one using
digital_inputs.read(...)
takes too much time.
Instead i added methods to the ArduinoIOExpanderClass with which i can use TCA6424A::readAll(...) and TCA6424A::readBank(...).

I made some simple measurements by comparing the value comparing from micros() before and after running the "read" methods.
I also changed the I2C clock frequency.

1. Reading channel 0 to 7 one by one @100kHz: 3588 us
2. Reading channel 0 to 7 one by one @400kHz: 1337 us
3. Reading bank 0 @100kHz: 452 us
4. Reading bank 0 @400kHz: 169 us
5. Reading bank 0, 1 & 2 one by one @100kHz: 1345 us
6. Reading bank 0, 1 & 2 one by one @400kHz: 501 us
7. Reading all banks @100kHz: 653 us
8. Reading all banks @400kHz: 242 us

By running I2C at 400kHz and using the readBank(...) method I get all 8 bits of bank 0 within ~170 us which is sufficient for me.

Would it be possible to add such methods to ArduinoIOExpanderClass to have them available "out of the box"?

Best regards
matt

@per1234 per1234 changed the title Is there any reason why Allow full bank reads from IO expander Nov 12, 2021
@per1234 per1234 added the type: enhancement Proposed improvement label Nov 12, 2021
@pnndra
Copy link
Contributor

pnndra commented Nov 15, 2021

@mattbue i would suggest you open a PR with your changes.

@manchoz
Copy link
Collaborator

manchoz commented Jun 8, 2022

Hi @mattbue, please, check #86

@per1234 per1234 added topic: code Related to content of the project itself status: waiting for information More information must be provided before work can proceed labels Jun 23, 2022
@manchoz
Copy link
Collaborator

manchoz commented Jul 26, 2022

Hi @per1234, I think we can close this issue: feature has been implemented and tested and there is no feedback or activity.

@per1234
Copy link
Contributor

per1234 commented Jul 26, 2022

Thanks @manchoz! I'm closing this as resolved by #86

@per1234 per1234 closed this as completed Jul 26, 2022
@per1234 per1234 added conclusion: resolved Issue was resolved and removed status: waiting for information More information must be provided before work can proceed labels Jul 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants