/////// ISR test in C /////////////////////// ///////BRL4@cornell.edu : July 2006 ///////// ///////////////////////////////////////////// // system.h has peripheral base addresses, IRQ definitions, and cpu details #include "system.h" #include "stdio.h" // Next include has definition of alt_irq_register //#include "sys/alt_irq.h" //The next two includes are in syslib/DeviceDrivers[sopc_builder] //They have the macros for setting values in peripherals #include "altera_avalon_timer_regs.h" #include "altera_avalon_pio_regs.h" // Next include contains usleep(microseconds) #include //e.g. //usleep(5000000); is 5 seconds //I like these: #define begin { #define end } #define Nfreq 100 int main(void) begin int findex; //frequency index int freq; //current frequency int gain; // current gain int newAmp, oldAmp, newPhase, oldPhase; //assert reset of the DDA subsystem //IOWR_ALTERA_AVALON_PIO_DATA(CONTROL_BASE,0); while(1) begin freq = 300; oldAmp = -1; oldPhase = -1; for(findex=0; findex