Good afternoon, help with this question: ESP32-C3-DevkitC-02v1.1 board, an ADC is connected to it - BH45B1225v110 (data sheet can be found here - https://www.holtek.com/productdetail/-/vg/BH45B1225) i2c bus. I need to read the HIRCC register and set a value for it (enable it). But as I understand it, this requires an ADC control library, because. it uses a special syntax that the Arduino does not understand by default. ( The text on the screen is not related to the task, it is only an example of the syntax for reading ADC registers, but without libraries, arduino does not understand it):
the BH45B1225 appears to have an I2C interface
have a look at ESP32 I2C
try running the I2C scanner to see if the device is found
upload a schematic of your circuit
when uploading code upload the text (not an image) using code tags </> it makes it easy to read
You don't have to access internal ADC registers of the controller, as your code tries. Instead use I2C (Wire library) to communicate with the external ADC. Read in detail section "Functional Description" in the data sheet. It contains the register names and addresses which you can access, and what the register contents mean.
You may be better off with a different ADC that comes with an Arduino library and sample code.
the BH45B1225 datasheet gives the I2C address range as 0xA to 0xD0
your result could be 0xD0 shifted right 1 bit to 0x68
have a look at the BH45B1225 Software Library - see if there is code you could port to the Arduino otherwise you will have to write code yourself @DrDiettrich advice to change to an ADC supported by an Arduino Library sounds a good idea
Edit: I assume you have experience programming in C/C++ and have used microcontrollers?
sounds like you have been given an ESP32 connected to a BH45B1225 and told to get it working
if the BH45B1225 Software Library contains sample C/C++ code you can use that as a starting point to port to the ESP32 (check the copyright)
at a minimum you would need to change the I2C function calls used to access the the original microcontroller I2C interface to suit the Wire library for the ESP32
Some experience is required to understand the module data sheet. You can improve your experience by studying an existing Arduino solution, better than reading other sources that do not result in immediately usable code.
if your background is C# it may be worth doing a web search for C and C++ vers C# to get some idea of the differences between the languages
if you are new to microcontrollers and C/C++ get some experience with the Arduino IDE and try running and modifing some some of the example programs under File>Examples
e.g. attach an LED to the ESP32 modify the File>Examples>Blink to blink the LED ON/OFF (try different ESP32 GPIO pins)
if your target is to write code for the BH45B1225 I2C experiment with some I2C sensors
e.g. TMP102
you should then have some idea of the problems you will face porting the BH45B1225 to an ESP32
if there is sample BH45B1225 C/C++ source code even for a different microcontroller it can give you a starting point - low level I2C read and write functions tend to be similar