// adc.c //A simple voltmeter with the ADC operating in 10 bit mode with no interrupts, //coarse ADC accuracy, and no quiet mode. #include #include #include #include #include "hd44780.h" uint8_t i; uint16_t adc_result; char lcd_str_h[16]; //holds string to send to lcd char lcd_str_l[16]; //holds string to send to lcd div_t fp_adc_result, fp_low_result; //double fp_adc_result; /*******************************************************/ void spi_init(void){ /* Run this code before attempting to write to the LCD.*/ DDRF |= 0x08; //port F bit 3 is enable for LCD PORTF &= 0xF7; //port F bit 3 is initially low DDRB |= 0x07; //Turn on SS, MOSI, SCLK //see:$INSTALL_DIR/avr/include/avr/iom128.h for defs //Master mode, Clock=clk/2, Cycle half phase, Low polarity, MSB first SPCR=(1<