//SPI example using ADC0832 from National Semi //connect MOSI B.5 to DI on ADC0832 //connect MISO B.6 to DO on ADC0832 //connect SCLK B.7 to CLK on ADC0832 //connect B.4 to chip select on the ADC0832 #include #include #include #define begin { #define end } // bit handling macros for i/o registers #define READ(U, N) ((U) >> (N) & 1u) #define SET(U, N) ((void)((U) |= 1u << (N))) #define CLR(U, N) ((void)((U) &= ~(1u << (N)))) #define FLIP(U, N) ((void)((U) ^= 1u << (N))) uint8_t Ain, junk, ADC_cntl ; int main(void) begin DDRC = 0xff; // LEDs //set up i/o data direction //DDRB.4 = 1; //output chip select for DAC (notSYNC) //DDRB.5 = 1; //output MOSI to ADC //DDRB.6 = 0; //input MISO from ADC //DDRB.7 = 1; //output SCLK DDRB = (1<