Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the example, resistance is set to half of the wanted value #2

Open
bennigraf opened this issue Jul 15, 2014 · 1 comment
Open

Comments

@bennigraf
Copy link

Hi there!

I just tried to use this library and got it basically working with a 4261 (two channel, 8 bit, 100kOhm). But when I run the example, instead of going from 0 to 100k in 20k-steps, it goes from 0 to 50k in 10k steps (half of the wanted values).

Except for creating the instance with 100k I have nothing else changed in the example.

Setting digitalPot.scale to 50 fixes the behaviour and outputs the wanted value (0 to 100k).

I also tried the "original" class (https://github.com/dreamcat4/Mcp4261) and with that it works as expected.

No urgent fix needed as I can work around that, I just wanted to file the bug report ;-). Thanks for your time!

Best,
Benni.

@dl111122
Copy link

It appears to me the problem is in line 54 of McpDigitalPot.h where it has
const static unsigned int resolution = resolution_7bit;
Some chips in this family have 128 bit (7bit) resolution, and some have 256 bit (8bit resolution).
The 4261 chip has 8 bit resolution. So changing that line to:
const static unsigned int resolution = resolution_8bit;
fixes the problem for the 4261 chip.

The comments says look at the 3rd digit of the model i.e. MCP4-N-
where if N=3 7bit volatile
if N=4 7bit non-volatile
if N=5 8bit volatile
if N=6 8bit non-volatile
For a 4261, N=6, means it should be 8bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants