Simplified input diagram.
The embedded code size currently is close to 154 k-bytes (153981). It becomes a little tough to maintain and develop further. I have decided to develop a set of library functions to make it easier to develop code and test the unit. The following is an example of using TstAndResetVoltDiv() library function. This function takes care of verifying currently set input voltage dividers.
#include "MCP3911_EVB.h" #include "math.h" main { while(1){ switch( selection ) { case 1: case 2: //Set switch variable for the execute_function() rx_function = 13; //Starts measurement cycle and collects data samples. execute_function(); //Wait until all data is collected while (!buffer_full) {} /* * Function TstAndResetVoltDiv() is a library function. It is the first function called in the main() when * selection switch is set to 1 or 2. * This function runs continuously, it reads applied voltages witha previously selected voltage * dividers. * If the measured voltage is within the range, the previously selected divider values will be used * and displayCH0CH1() function will re-display the updated, more accurate, voltage readings. */ TstAndResetVoltDiv(cflag,rng_srch,c_smple_sum,current_sum_n,curre nt_sum_p,cal, CH1vsftSgn,CH1vshft,dividerCH1,vflag,v_smple_sum,volt age_sum_n,voltage_sum_p, CH0vsftSgn,CH0vshft,dividerCH0,buffer_full); Break; } }
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.