Simple demo for exercising the board
Dependencies: MAX11300 MAX4822 OneWire Terminal ds3231 mbed
Diff: main.cpp
- Revision:
- 4:2a25a4e00541
- Parent:
- 2:0c0994f70fd2
- Child:
- 5:2fe6dd435618
--- a/main.cpp Sun Jul 31 05:19:21 2016 +0000 +++ b/main.cpp Sun Jul 31 22:00:57 2016 +0000 @@ -130,7 +130,6 @@ user_entry = term.get_int32("Please select an option above: ", 1, QUIT); - //get non-latching relay if((user_entry == 4) || (user_entry == 5)) { @@ -383,15 +382,19 @@ static uint16_t aio_20mA = 2592; uint16_t aii_4mA, aii_20mA; + term.cls(); + term.home(); + //cal aio term.printf("\nConnect DMM in series with AIO and AII.\n"); - term.printf("Use 'i' and 'd' keys to increase measurement to calibration value.\n"); - term.printf("Setting AIO to 4mA, enter 'q' when measurement = 4mA.\n"); + term.printf("AIO----(DMMM)----AII\n\n"); + term.printf("Use 'i' and 'd' keys to increase/decrease measurement to calibration value.\n\n"); + term.printf("Setting AIO calibration val to 4mA, enter 'q' when DMM measurement = 4mA.\n\n"); do { pixi.single_ended_dac_write(MAX11300::PORT8, aio_4mA); - user_entry = term.get_char("\n", 'd', 'q'); + user_entry = term.get_char("increase (i), decrease (d), quit (q) when DMM = 4mA: ", 'd', 'q'); if(user_entry == 'i') { @@ -403,7 +406,7 @@ } else if(user_entry == 'q') { - term.printf("Setting AIO to 20mA, enter 'q' when measurement = 20mA.\n"); + term.printf("\nSetting AIO calibration val to 20mA, enter 'q' when DMM measurement = 20mA.\n\n"); } else { @@ -415,7 +418,7 @@ do { pixi.single_ended_dac_write(MAX11300::PORT8, aio_20mA); - user_entry = term.get_char("\n", 'd', 'q'); + user_entry = term.get_char("increase (i), decrease (d), quit (q) when DMM = 20mA: ", 'd', 'q'); if(user_entry == 'i') { @@ -427,7 +430,7 @@ } else if(user_entry == 'q') { - term.printf("\nCalibration done\n\n"); + term.printf("\nExecuting AII Cal\n\n"); } else { @@ -439,17 +442,29 @@ slope_out = (((aio_20mA*1.0) - (aio_4mA*1.0))/16.0); offset_out = ((-1.0*slope_out*4.0) + aio_4mA); + uint8_t idx; //cal aii pixi.single_ended_dac_write(MAX11300::PORT8, aio_4mA); - wait(0.5); + for(idx = 0; idx < 10; idx++) + { + term.printf("AII 4mA input cal...\n"); + wait(1.0); + } pixi.single_ended_adc_read(MAX11300::PORT12, aii_4mA); - wait(0.5); + pixi.single_ended_dac_write(MAX11300::PORT8, aio_20mA); - wait(0.5); + for(idx = 0; idx < 10; idx++) + { + term.printf("AII 20mA input cal...\n"); + wait(1.0); + } pixi.single_ended_adc_read(MAX11300::PORT12, aii_20mA); slope_in = (16.0/((aii_20mA*1.0) - (aii_4mA*1.0))); offset_in = ((-1.0*slope_in*aii_4mA) + 4.0); + + term.printf("\nCal done.\n\n"); + wait(1.0); }