Close

Input Wiring and Coding

A project log for Multimeter +

Dual input 24 bit Multimeter with USB interface, single channel 10 bit USB oscilloscope, PWM out, 2 Ch Data-logger, R, C, Digital sniffer.

romanRoman 03/11/2016 at 00:030 Comments

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