How to read analog converted value 18bit => 262143

I want to read analog value with 18 bit resolution . means 10v=262143. how can i read?

 

Ganesh Datt Joshi
Ganesh Datt Joshi
7
| 2 1 2
Asked on 11/15/16, 3:18 PM
0
vote
2121 Views

After trying a lot i did not get succes to get 18 bit resolution raw data. i got 4096 evertime.
kindly help if possible.

Ganesh Datt Joshi
on 12/23/16, 4:25 AM

Hi Ganesh, 

That's a good point, i have updated our github documentation as follows:

Please note that the output of the Indio.analogRead() in RAW mode is not of the type INTEGER, but FLOAT. The output range is fixed from 0 to 4096 for all resolutions, but only in 12-bit mode this returns integers; for higher resolution the measurements are floating point numbers.

So you can easily change the resolution setting without having to change your data handling as the range is independent of resolution. Just make sure to use FLOAT type to read your inputs.

Tom
Tom
5675
| 1 1 3
Answered on 11/18/16, 5:25 AM
0
vote

I NEVER GET 18 BIT RESOLUTION IN INDUSTRUINO ITS 12 BIT ANALOG.

Ganesh Datt Joshi
on 5/21/18, 3:39 AM

Hi, please note that when you set/change the resolution, you need to do that before setting the input mode of the channels, or repeat a line like 'Indio.analogReadMode(1, mA);' after you have changed the resolution. if not clear, send me an email and i send you example code

Tom
on 5/21/18, 5:48 AM

/* Indio Library, by Rustem Iskuzhin for Industruino - wwww.industruino.com This library enables communication with the Industruino IND.I/O Baseboard. The IND.I/O Baseboard has 8CH of 24V digital I/O (6.5-32V supported), 4CH 0-10V/4-20mA ADC, 2CH 0-10V/4-20mA DAC, RS485 transceiver. WARNING!: PLEASE BE VERY CAREFUL WHEN CONNECTING PERIPHERALS TO YOUR IND.I/O AND CONFIGURING THE DIRECTION OF THE I/O. THE FAILURE MODE OF A 24V SHORTED CONNECTION IS MUCH MORE SPECTACULAR THAN WHEN WORKING AT 5V. Please find the calibration data array inside the Indio.cpp library file, together with an explanation on how to perform the calibration. Library is preloaded with calibration data but characterisctics are board specific thus reading with standard cal. data might be off. */ #include #include #include #include static UC1701 lcd; float AudioVoltage, HandsfreeVoltage, CruiseVoltage, SupplyVoltage; //variables to hold your sensor data #define TxEnablePin 9 // INDUSTRUINO RS485 #define baud 115200 // tested 9600 to 115200 #define SlaveID 1 #define HOLDING_REGS_SIZE 8 unsigned int holdingRegs[HOLDING_REGS_SIZE]; void setup() { lcd.begin(); lcd.clear(); lcd.setCursor(1, 1); lcd.print("Yes Enterprises"); lcd.setCursor(1, 2); lcd.print("Resistance Meter"); analogWrite(13, 100); // LCD backlight modbus_configure(&Serial1, baud, SERIAL_8N1, SlaveID, TxEnablePin, HOLDING_REGS_SIZE, holdingRegs); modbus_update_comms(baud, SERIAL_8N2, SlaveID); Indio.setADCResolution(16); // Set the ADC resolution. Choices are 12bit@240SPS, 14bit@60SPS, 16bit@15SPS and 18bit@3.75SPS. Indio.analogReadMode(1, V10); // Set Analog-In CH1 to 10V mode (0-10V). Indio.analogReadMode(2, V10); // Indio.analogReadMode(3, V10); // Indio.analogReadMode(4, V10); // } void loop() { modbus_update(); AudioVoltage = Indio.analogRead(1); //Read Analog-In CH1 (output depending on selected mode) HandsfreeVoltage = Indio.analogRead(2); //Read Analog-In CH1 (output depending on selected mode) CruiseVoltage = Indio.analogRead(3); //Read Analog-In CH1 (output depending on selected mode) SupplyVoltage=Indio.analogRead(4)*2; //Read Analog-In CH1 (output depending on selected mode) //SupplyVoltage=11.5; unsigned int AudioResistance = Resistance(SupplyVoltage, (SupplyVoltage-AudioVoltage), 540.0); unsigned int HandsfreeResistance = Resistance(SupplyVoltage, (SupplyVoltage-HandsfreeVoltage), 540.0); unsigned int CruiseResistance = Resistance(SupplyVoltage, (SupplyVoltage-CruiseVoltage), 540.0); lcd.setCursor(1, 4); lcd.print((float)AudioResistance/10.0); lcd.setCursor(1, 5); lcd.print((float)HandsfreeResistance/10.0); lcd.setCursor(1, 6); lcd.print((float)CruiseResistance/10.0); lcd.setCursor(1, 7); lcd.print(SupplyVoltage); holdingRegs[0] = AudioResistance%255; // set register according to button on Slave holdingRegs[1] = AudioResistance/255; holdingRegs[2] = HandsfreeResistance%255; holdingRegs[3] = HandsfreeResistance/255; holdingRegs[4] = CruiseResistance%255; holdingRegs[5] = CruiseResistance/255; holdingRegs[6] = 6; holdingRegs[7] = 7; } unsigned int Resistance(float inputsupply, float AI_Volt, float fixedR) { float I = (inputsupply-AI_Volt)/fixedR; float R = (AI_Volt)/I; return (unsigned int)(R*10); }

Ganesh Datt Joshi
on 5/21/18, 6:16 AM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

29 follower(s)

Stats

Asked: 11/15/16, 3:18 PM
Seen: 2121 times
Last updated: 5/21/18, 5:54 AM