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

There is a small mistake in AD5933.cpp, line 29 #28

Open
wojiaodingsan opened this issue Apr 14, 2021 · 0 comments
Open

There is a small mistake in AD5933.cpp, line 29 #28

wojiaodingsan opened this issue Apr 14, 2021 · 0 comments

Comments

@wojiaodingsan
Copy link

The code in AD5933_Library--AD5933.cpp, Line 29:
tTempVal = (tTemp[0] % (12 * 16)) * 16 * 16 + tTemp[1];

I think the author want to extract the lower 5 digits in tTemp[0], which means the D4-D0 in 0x92. However if use tTemp[0] % (1216), it is possible to extract the D5-D7 digits. For example, if the tTemp[0] = 0100 0000, the tTemp[0] % (1216) = 0100 0000, more than lower 5 digits.
I think this might be better:
"tTempVal = (tTemp[0] % (4*16)) 1616 + tTemp[1]"
or
"tTempVal = (tTemp[0] & 0x1F)1616 + tTemp[1]".

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

1 participant