Jonno Posted May 17, 2022 Share Posted May 17, 2022 Hi all, I'm kind of new to VHDL programming. I was wondering if anyone knows how to convert the raw data output of the ADT7420 temperature sensor from the Nexys A7-100T development board. I pulled the TempSensorCtl and the TWICtl file from the Nexys A7 OOB demo into a new project to run the temperature sensor and after combing through the codes in the demo file I found out that the program outputs a 13 bit signed data. Can anyone please help? I'm trying to display the temperature data on the 7 segment digital displays. Thank you! Link to comment Share on other sites More sharing options...
artvvb Posted May 17, 2022 Share Posted May 17, 2022 Hi @Jonno, welcome to the forum! The Nexys A7 reference manual states, in referring to how to handle the ADT7420's temperature value register: Quote These two bytes form a two’s complement 16-bit integer. If the result is shifted to the right three bits and multiplied by 0.0625, the resulting signed floating point value will be a temperature reading in degrees Celsius. The TempSensorCtl file is already effectively performing the right shift by three, which discards some extra flag bits present in the temperature value registers. I'd first extract the sign bit, and convert the data to unsigned. The multiply by 0.0625 described could be performed by treating the unsigned data as fixed point, and shifting the point. Converting fixed point numbers to BCD is a little more complicated than unsigned integers to BCD. There's a good discussion of it here: https://electronics.stackexchange.com/questions/320416/how-to-break-multi-digit-number-into-separate-digits-in-vhdl Lastly, a seven segment display controller that can handle the sign bit and decimal point would be needed. Hope this helped, Arthur Link to comment Share on other sites More sharing options...
Jonno Posted May 18, 2022 Author Share Posted May 18, 2022 Thanks a lot! artvvb 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now