Programming: ADC (Analog to Digital Converter) Establishing Multiple ADC Channels for Two Trimmers
Share
Two trimmers are connected to the ADC one on channel 1 and the other on channel 2. The pressure sensor is connected to channel 0. The two trimmers will be adjusting a low threshold and a high threshold for the pressure sensor and pin output function.
#include #include "MrLCD.h" #include int static volatile InchesOfHg, High, Low = 0; int main(void) { InitializeMrLCD(); Send_A_StringToMrLCDWithLocation(1, 1, "Inches of Hg:"); Send_A_StringToMrLCDWithLocation(1, 2, "H: L:"); DDRD |= 1< High) enoughVacuum = 1; if (InchesOfHg < Low) enoughVacuum = 0; if (enoughVacuum == 0 && bit_is_clear(PORTD, PIND0)) PORTD |= 1<