Exemple #1
0
interrupt void decimate_isr(void){
	EALLOW;
	unsigned int value;
	//initADC();
	value = ADC_get();
	//DAC_set(value);

	if(SRAMaddress <= 0x2FFFFF & decimate == 4){
		*SRAMaddress = value;
		SRAMaddress++;
		decimate = 0;
	}
	else if(SRAMaddress > 0x2FFFFF){

		DINT;
		SRAMaddress = 0x280000;
		a = 1;
		changeFunctions();
		EINT;   // Enable Global interrupt INTM
		ERTM;   // Enable Global realtime interrupt DBGM
	}
	else{
		SRAMaddress++;
		decimate++;
	}


		CpuTimer1.InterruptCount++;
		EALLOW;





}
Exemple #2
0
interrupt void reverb_isr(void){
	unsigned long output;
	unsigned int value;
	unsigned int value2;

	value = ADC_get();

	//TODO: The value that SRAMaddress should be equal to is the address space + buffersize
	value2 = *SRAMaddress;
	output = (value + 0.5*value2)/2;
	*SRAMaddress = output;

	SRAMaddress++;

	//TODO: The value that SRAMaddress should be equal to is the address space + buffersize

	DAC_set((unsigned int)output);


	if(SRAMaddress > 0x260000+reverbBuffer){
		SRAMaddress = 0x260000;
	}









}
Exemple #3
0
interrupt void ADC_isr(void){
	EALLOW;
	unsigned int value;
	//initADC();
	value = ADC_get();
	//DAC_set(value);
	long justincase = SRAMaddress;

	if(SRAMaddress <= 0x29FFFF){
		*SRAMaddress = value;
		SRAMaddress++;
	}
	else{
		DINT;
		SRAMaddress = 0x260000;
		a = 1;
		changeFunctions();
		EINT;   // Enable Global interrupt INTM
		ERTM;   // Enable Global realtime interrupt DBGM
	}


	CpuTimer1.InterruptCount++;
	EALLOW;
}
Exemple #4
0
interrupt void interp_isr(void){

	EALLOW;
	unsigned int value;
	unsigned long test;
	//initADC();
	value = ADC_get();
	//DAC_set(value);

	if(SRAMaddress <= 0x27FFFF){
		*SRAMaddress = value;
		SRAMaddress++;

	}
	else{
		DINT;
		SRAMaddress = 0x260000;
		a = 1;

		//interpolateAlgorithm(*SRAMaddress);
		changeFunctions(samplingRate*1.5);

		EINT;   // Enable Global interrupt INTM
		ERTM;   // Enable Global realtime interrupt DBGM
	}


	CpuTimer1.InterruptCount++;
	EALLOW;



}
Exemple #5
0
interrupt void decimate_isr(void){
	EALLOW;
	unsigned int value;
	//initADC();
	value = ADC_get();
	//DAC_set(value);

	if(SRAMaddress <= 0x29FFFF & decimate == 4){
		*SRAMaddress = value;
		SRAMaddress++;
		decimate = 0;
	}
	else if(SRAMaddress > 0x29FFFF){

		DINT;
		SRAMaddress = 0x260000;
		a = 1;
		changeFunctions(samplingRate*2); //this value passed normally seems to be 4-5 times the sampling rate but woo signals
		EINT;   // Enable Global interrupt INTM
		ERTM;   // Enable Global realtime interrupt DBGM
	}
	else{

		decimate++;
	}


		CpuTimer1.InterruptCount++;
		EALLOW;





}
Exemple #6
0
interrupt void ADC_isr(void){
	EALLOW;
	unsigned int value;
	initADC();
	value = ADC_get();
	DAC_set(value);


	CpuTimer1.InterruptCount++;
	EALLOW;
}
Exemple #7
0
interrupt void sampleGet_ISR(void){
	unsigned int input = ADC_get();
	DAC_set(input);
	sampleBuffer[sampleCount] = (float)input;

	sampleCount++;
	if(sampleCount == FFT_SIZE){
		sampleCount = 0;
		sampleBufferFull = 1;
		DINT; //disables interrupts, if doesn't work can send to dummy interrupt vector
	}

}
Exemple #8
0
interrupt void monstermash_isr(void){
	EALLOW;
	unsigned int value;
	unsigned long temp;
	value = ADC_get();

	if(SRAMaddress <= 0x29FFFF & a == 0){
		*SRAMaddress = value;
		SRAMaddress++;

	}
	else if(SRAMaddress <= 0x29FFFF && a ==1){
		temp = *SRAMaddress;
		temp = temp+value;
		temp = temp/2;
		value = temp;
		//TODO:this is where attenuation would go
		*SRAMaddress = value;
		SRAMaddress++;
		if(SRAMaddress > 0x29FFFF){

			b = 1;

		}
	}
	else if(b == 1){
		DINT;
		SRAMaddress = 0x260000;
		changeFunctions(samplingRate);
		EINT;
		ERTM;
	}
	else{


		SRAMaddress = 0x260000;
		a = 1;

		string_push("press 4 when second sample is ready");
		int test = keypadScan();
		while(test != 4){
			test = keypadScan();
		}
		LCDclear();
		//changeFunctions();
		//EINT;   // Enable Global interrupt INTM
		//ERTM;   // Enable Global realtime interrupt DBGM

	}
}
Exemple #9
0
interrupt void ADC_isr(void){

	unsigned int value;
	initADC();
	value = ADC_get();
	DAC_set(value);
//	if (a == 1){
//		DAC_set(0xFFFF);
//		a = 0;
//	}
//	else{
//		DAC_set(0);
//		a = 1;
//	}
	CpuTimer1.InterruptCount++;
	EALLOW;
}
Exemple #10
0
void main(void) 
{
    ADC_init();
    
    while(1)
    {
        __delay_ms(10);
        if( ADC_get() == 1023 )
        {
            LED = 1;
        }
        else
        {
            LED = 0;
        }
        
    }
    return;
}
Exemple #11
0
interrupt void audioEcho_isr(void){
	unsigned long output;
	unsigned int value;

	value = ADC_get();


	unsigned int test2 = *SRAMaddress;
	*SRAMaddress = value;
	SRAMaddress++;

	output = (value+0.5*test2)/2;

	DAC_set((unsigned int)output);


	if(SRAMaddress > 0x260000+bufferLength){
		SRAMaddress = 0x260000;
	}



//
//	if(SRAMaddress < 0x260000+bufferLength){
//
//		SRAMaddress++;
//
//	}
//	else{
//
//		SRAMaddress = 0x260000;
//
//	}
//
//	*SRAMaddress = value;

}
Exemple #12
0
interrupt void test_ISR(void){
	unsigned int input = ADC_get();
	DAC_set(input);
}