I'm glad you managed to get it working.
The bit rate is the resolution or the number of bits the ADC uses to sample the voltage. The MCP3424 IC used on the ADC Pi Plus can support 12 bit, 14 bit, 16 bit and 18 bit modes. Basically the higher the bit rate the more accurate the reading will be but at the expense of taking longer to read each sample. You can find a more detailed description about the different bit rates in our knowledge base article. Due to the way the ADC Pi Plus is designed one of the bits is never used so the actual resolution in each mode is 11 bits, 13 bits, 15 bits and 17 bits but for setting the bit rate in the code use the values of 12, 14, 16 or 18.
In 18 bit mode the ADC can return 3.75 samples per second. In 16 bit mode the ADC returns 15 samples per second, 14 bit mode is 60 samples per second and 12 bit mode is 240 samples per second. When you take a reading using the readvoltage function the code will request a sample from the ADC and then wait in a while loop until the sample is ready. This can take anywhere from around 4ms in 12 bit mode to around 270ms for 18 bit mode and the code will hang until the sample is ready.
The gain value controls the internal programable gain amplifier. This basically multiplies the voltage at the input to increase the resolution and the accuracy of the reading. The gain amplifer supports four settings, 1, 2, 4 and 8 which are the multiplication factors for each mode. If you put 1V into the input when the gain is set to 1 the ADC would only use around a quarter of the sample space for the reading but if you set the gain to 4 the voltage is multiplied so 1V would be measured by the ADC as 4V which will take up four times as much sample space and therefore give you a reading which is 4 times more accurate.
When using the gain amplifier you have to make sure your input voltage does not exceed the limits of the ADC.
With a gain of 1 you can use a maximum voltage of 5V.
With a gain of 2 you can use a maximum voltage of 2.5V.
With a gain of 4 you can use a maximum voltage of 1.25V.
With a gain of 8 you can use a maximum voltage of 0.625V.
If you set the gain to 8 and then put 1V into the ADC this would be multiplied by the amplifier to 8V and would damage the ADC so you need to know what the maximum voltage your circuit will produce and then set the gain so the voltage will not exceed this.
When you change the gain the ADC library automatically compensates for the new setting so if you have the gain set to 4 and put 1V into the input the read_voltage() function will return 1V even though the ADC is actually measuring 4V internally.
The conversion parameter is for the conversion mode inside the ADC. The MCP3424 has two possible conversion modes, one-shot and continuous.
In one-shot mode the ADC will sit in a sleep state until it receives a command to take an ADC measurement, it will then wake up, take the measurement and then go back to sleep. In continuous conversion mode the ADC is awake all of the time and continuously samples the ADC channel which was last selected.
When the ADC is asleep it uses very little power but waking up takes a small amount of time so ADC measurements will take slightly longer than in continuous mode. As continuous conversion mode samples the same ADC channel repeatedly if you are only reading from a single channel using this mode can in some instances reduce the amount of time it takes to take a reading but at the expense of using a tiny bit more power.
The datasheet for the MCP3424 ADC has a more detailed description of how all of the features work and may be worth reading if you want a better understanding of what is going on inside the chip.
The ADC Pi library can only read from one input at a time and while it is doing this the program will wait for a reply so if your program needs to be doing something else at the same time the best way to get around this problem would be to use threading and have the ADC readings done in a seperate thread. Unforturnally I don't have any experience of using threading in C as most of the programming I do in C is on microcontrollers which don't have multithreading in the normal desktop OS sence so I am affraid this is something I can not help you with.
If you have any other questions about the library or the ADC Pi please let me know.