-
Notifications
You must be signed in to change notification settings - Fork 49
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
MCP4151 instead of MCP4131 #28
Comments
Not as a drop-in replacement (that is, without Arduino code changes) . The reason it's not possible as a drop-in replacement is that 4151 has 257 tap values, while 4131 has only 129. So setting the 4131 maximum tap of value 128 would only set the 4151 tap to a half of its resistance range. On the other hand, it is possible to use 4151 if you also change the Arduino code and recalculate the tap value (multiply by 2) just before it is sent to the MCP chip via SPI transaction. BTW. I just checked mouser.de and digikey.de and there seems to be plenty of stock of mcp4131. |
If you look at aftb_mcp4131.h source code, function mcp4131_reg(...). The function parameters are 'address' and 'value'. What needs to be done is: If the address equals ADDR_WIPER then multiply the value by 2. do that on the start of the function. Also, when the 'read_reg' parameter is true then you have to divide the Wiper value read from the chip by 2 just before tha value is returned from the function (only when ADDR_WIPER address is specified). Thinking about it, the code could autodetect mcp4131 and mcp4151 by setting value of the tap/wiper to 200 during initialisation. If the value would be accepted by the chip (read value would also be 200) then it is mcp4151. The value multiplication/division could then be done conditionally based on the detected chip. |
thanks for your reply. yes Mouser and the other big player could deliver,
but with high shipping cost (single order).
The automatic chip detection inside the code is a quite nice idea 👍
ole00 ***@***.***> schrieb am Mo., 15. Mai 2023, 23:40:
… If you look at aftb_mcp4131.h source code, function mcp4131_reg(...). The
function parameters are 'address' and 'value'. What needs to be done is: If
the address equals ADDR_WIPER then multiply the value by 2. do that on the
start of the function. Also, when the 'read_reg' parameter is true then you
have to divide the Wiper value read from the chip by 2 just before tha
value is returned from the function (only when ADDR_WIPER address is
specified).
Thinking about it, the code could autodetect mcp4131 and mcp4151 by
setting value of the tap/wiper to 200. If the value would be accepted by
the chip (read value would also be 200) then it is mcp4151. The value
multiplication/division could then be done conditionally based on the
detected chip.
—
Reply to this email directly, view it on GitHub
<#28 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADTUG6YBQICBNI5ZCE4UVWTXGKPF5ANCNFSM6AAAAAAYCSHQGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Chip availability: you have a good point. Even if the parts are in stock today, there is no guarantee they will be available in 6 months as well. |
Great! i have finished my Board today and will test with the MCP4151 👍 |
YES, it works. 😃 |
Well done. I'm glad it works for you. |
is it possible, to change the MCP4131 with the 4151 because of availability?
It's hard to find these part here in germany. But the MCP4151 is available.
The text was updated successfully, but these errors were encountered: