Yenyulu Posted May 16, 2018 Share Posted May 16, 2018 Hello I bought one PmodAD5, and tried to change its output data rate. I know sample rate can be changed by mode register value;However, how can i make changes to highest value(4.8kHz) of mode register in code. Thanks. Link to comment Share on other sites More sharing options...
jpeyron Posted May 16, 2018 Share Posted May 16, 2018 Hi @Yenyulu, If you look at the AD5_WriteConfig in the PmodAD5.c it shows how to access the CONFIGURATION REGISTER along with how to set the 24-bit register. Here is the data sheet. The configuration register is 0x10(page 27 of data sheet). The mode register can be accessed in the same way the AD5_WriteConfig accesses the CONFIGURATION REGISTER along with setting the 24-bit register. The mode register is 0x01(page 24 of data sheet). Page 24, 25 and 26 discusses how to set the 24 bit register to get your desired output data rate along with other mode settings. On page 25 it shows that there is more than one way to set the output data rate to the 4.8 KHz based on how you set some of the other settings. As for the code you could make your own mode function that should be called in the begin function. Something like this: void AD5_WriteModeConfig(PmodAD5* InstancePtr) { u8 bytes[4]; bytes[0] = 0x01; //first byte is sent to the mode register which sets communication to //writing the next 3 bytes to the mode register //you will need to determine how you want the mode register set up. bytes[1] = 0x00; bytes[2] = 0x00; bytes[3] = 0x00; XSpi_Transfer(&InstancePtr->AD5Spi, bytes, bytes, 4); } thank you, Jon Link to comment Share on other sites More sharing options...
Yenyulu Posted May 28, 2018 Author Share Posted May 28, 2018 Hi @jpeyron Thanks for your reply. I still have some problem. I don't have the Pmod.c, so can u give the file? Thank u very much! And the exampIe code need to include Arduino.h and SPI.h, but i don't have those,too. By the way,I have try the method mentioned here. SetRegisterValue(AD7193_REG_MODE, 0x080001, 4, 1); I changed the registerMap[1] to 0x080001, and changed the registerSize[1] to 4. Is it the correct solution? Thank you~ Link to comment Share on other sites More sharing options...
jpeyron Posted May 29, 2018 Share Posted May 29, 2018 Hi @Yenyulu, I believe you should set the mode register as shown below using the AD7193 library. Here is a link to code using the AD7193 library for arduino that does not use arduino.h. SetRegisterValue(1, registerMap[1], 3,0 ); the last value you will need to determine what you want the mode register set to. thank you, Jon Link to comment Share on other sites More sharing options...
Question
Yenyulu
Hello
I bought one PmodAD5, and tried to change its output data rate.
I know sample rate can be changed by mode register value;However, how can i make changes to highest value(4.8kHz) of mode register in code.
Thanks.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.