This module is fairly simple, but maybe of use to someone. It’s my penultimate write-up of a project.
The X2 operator “*/” is used to gain an accurate ADC to voltage conversion with a small amount of program code and memory. There are some test results in the notes showing that the ADC is reasonably linear and accurate but the internal FVR (Fixed Voltage Reference) is not so great as a basis to calculate the PICAXE supply voltage. To compensate for this there’s an FVR calibration method included in the notes too.
There are just 3 macros:
The attached “Voltage_X2” file contains its own documentation and it should be renamed with a “.BASINC” extension when used, the master file is here .
I’m glad to help if you have any issues. Please also let me know if there’s any potential improvements.
The X2 operator “*/” is used to gain an accurate ADC to voltage conversion with a small amount of program code and memory. There are some test results in the notes showing that the ADC is reasonably linear and accurate but the internal FVR (Fixed Voltage Reference) is not so great as a basis to calculate the PICAXE supply voltage. To compensate for this there’s an FVR calibration method included in the notes too.
There are just 3 macros:
- GetVdd updates a word variable with the power supply voltage in mV.
- SetVdd(Val_mV) can be used instead of GetVdd for testing purposes, or if the power supply is accurately known and stable.
- VoltsByVdd(Var, Channel) updates a word variable, Var, with the voltage in mV from the specified ADC Channel number.
The attached “Voltage_X2” file contains its own documentation and it should be renamed with a “.BASINC” extension when used, the master file is here .
I’m glad to help if you have any issues. Please also let me know if there’s any potential improvements.