//*************************************** //*************************************** // // AVRLIB-DEMO // For avrlib and avrmini development board. // // // File: ad-midi.c // Author: max mathews // Date: oct 19, 2002 // // // //*************************************** //program reads atmel a2d, codes information as midi, and xmits midi //*************************************** #include #include #include "global.h" #include "uart.h" #include "midi.h" #include "timer.h" #include #include #include "rprintf.h" #include "lcd.h" #include "a2d.h" int main(void) { u08 i,j; //temp storage //initializations //MIDI STUFF uartInit(); midiInit(); timerInit(); // ATOD STUFF a2dInit(); a2dSetReference(0x01); sei(); // enable interrupts outb(DDRA, 0xF0); // set low 4 pins of Port A to input (for ADC) // and high 4 pins to output (for LCD) outb(PORTA, 0x0F); // set pull-ups to on //main while loop while(1) { timerPause(10); i = a2dConvert10bit(1)>>3; // read the a/d on PortA pin 1 j = a2dConvert10bit(2)>>3; // read the a/d on PortA pin 2 midiNoteOnOut(i, j, 1); } return 0; }