variable = HADIn2(channel combination)
|variable||Variable to store the result (Integer or Long type)|
|channel||Combination: AD channel combination code|
This command is for a differential A/D input. Two channels are paired up, and the A/D converter converts the difference between the two voltages.
|Channel combination code||+ Input||- Input|
#include "CB405RT" Do Debug Goxy,1,1,Dec5 Hadin2(0) Wait 500 Loop
For a more accurate measurement, one should start with a reliable power source. A Linear power source (e.g., using 7805, etc.) is better for A/D input than a switching power source circuit (e.g., using LM2576).
Also, when the A/D input pins are extended and exposed outside the board, a protection circuit (where additional chips such as the isolation circuit, etc. are involved) should be added to protect the core module from external noise.
Keep in mind that, especially when a voltage over 5V could be applied to the A/D input port, repairable damage can occur to the module