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

TODO: excitation voltage range, settling time cycles #1

Open
mjmeli opened this issue Apr 9, 2017 · 4 comments
Open

TODO: excitation voltage range, settling time cycles #1

mjmeli opened this issue Apr 9, 2017 · 4 comments

Comments

@mjmeli
Copy link
Owner

mjmeli commented Apr 9, 2017

These need to be implemented. Anyone is welcome to contribute.

http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf

Excitation voltage range: Table 10 (pg. 23)

Settling time cycles: Table 13 (pg. 25)

@andrewbourhis
Copy link

Shouldn't it be a simple matter of the following:

`
#define CTRL_VOLT_RANGE1 (0b00000000)
#define CTRL_VOLT_RANGE2 (0b00000110)
#define CTRL_VOLT_RANGE3 (0b00000100)
#define CTRL_VOLT_RANGE4 (0b00000010)

/**

  • Set the excitation voltage range.

  • @param range The voltage range

  • @return Success or failure
    */
    bool AD5933::setExcitationVoltageRange(unsigned int range){
    byte val;
    if (!getByte(CTRL_REG1, &val))
    return false;

    // Clear out bits D9 and D10, which are the excitation voltage range bits
    val &= 0xF9;

    switch(range){
    case 1:
    val |= CTRL_VOLT_RANGE1;
    break;
    case 2:
    val |= CTRL_VOLT_RANGE2;
    break;
    case 3:
    val |= CTRL_VOLT_RANGE3;
    break;
    case 4:
    val |= CTRL_VOLT_RANGE4;
    break;
    default:
    return false;
    }
    return sendByte(CTRL_REG1,val);
    }`

@mjmeli
Copy link
Owner Author

mjmeli commented Sep 20, 2017

Probably, this wasn't used in our implementation that used this library and so it was simply never written. If you have written this and it works then feel free to do a PR.

@andrewbourhis
Copy link

Great, I'll be sure to do so when I am able to test it with hardware.

Thanks for posting this by the way, saved me some time!

@qaisarabbasr
Copy link

has anyone built all the code involving CN-0217 and all the ranges. kindly attach code as it would be very helpful.I have made the hardware but finding difficulties in code.
Thanks
qaisar

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

No branches or pull requests

3 participants