void bp_adc_continuous_probe(void) { uint16_t measurement; MSG_ADC_VOLTMETER_MODE; MSG_ANY_KEY_TO_EXIT_PROMPT; MSG_ADC_VOLTAGE_PROBE_HEADER; bp_write_voltage(0); MSG_VOLTAGE_UNIT; /* Perform ADC probes until a character is sent to the serial port. */ while (!user_serial_ready_to_read()) { /* Turn the ADC on. */ AD1CON1bits.ADON = ON; /* Perform the measurement. */ measurement = bp_read_adc(BP_ADC_PROBE); /* Turn the ADC off. */ AD1CON1bits.ADON = OFF; /* Erase previous measurement. */ bp_write_string("\x08\x08\x08\x08\x08"); /* Print new measurement. */ bp_write_voltage(measurement); MSG_VOLTAGE_UNIT; } /* Flush the incoming serial buffer. */ user_serial_read_byte(); bpBR; }
void bp_adc_probe(void) { /* Turn the ADC on. */ AD1CON1bits.ADON = ON; /* Perform the measurement. */ bp_write_voltage(bp_read_adc(BP_ADC_PROBE)); /* Turn the ADC off. */ AD1CON1bits.ADON = OFF; }
void bp_adc_probe(void) { /* Turn the ADC on. */ bp_enable_adc(); /* Perform the measurement. */ bp_write_voltage(bp_read_adc(BP_ADC_PROBE)); /* Turn the ADC off. */ bp_disable_adc(); }
void perform_adc_test(unsigned int channel, unsigned int minimum_threshold, unsigned int maximum_threshold) { unsigned int measurement; user_serial_transmit_character('('); measurement = bp_read_adc(channel); bp_write_voltage(measurement); user_serial_transmit_character(')'); check_result( ((measurement > minimum_threshold) && (measurement < maximum_threshold)), true); }