Code/C-Code/dspic.c
/*******************************************************
This function configures the dma module. 
Called from the main() function.
Value of each field of DMA registers is set here.
ADC interrupts the DMA to store sensor data in the 
DMA buffers allocated. 
*******************************************************/
This function configures the dma module.
Called from the main() function.
Value of each field of DMA registers is set here.
ADC interrupts the DMA to store sensor data in the
DMA buffers allocated.
This function configures the dma module . Called from the main () function . Value of each field of DMA registers is set here . ADC interrupts the DMA to store sensor data in the DMA buffers allocated .
void initdma(void)
{
	DMA0CONbits.SIZE  = 0; 					
	DMA0CONbits.DIR   = 0; 					
	DMA0CONbits.HALF  = 0;					
	DMA0CONbits.NULLW = 0; 					
	DMA0CONbits.AMODE = 0; 					
	DMA0CONbits.MODE  = 2; 					
	DMA0PAD 		  = (int)&ADC1BUF0;		
	DMA0CNT 		  = 63;   				
	DMA0REQ           = 13;					
	DMA0STA 		  = __builtin_dmaoffset(BufferA);	
	IFS0bits.DMA0IF   = 0; 					
	IEC0bits.DMA0IE   = 1; 					
	DMA0CONbits.CHEN  = 1; 					
}
void initdma ( void ) { DMA0CONbits . SIZE = 0 ; DMA0CONbits . DIR = 0 ; DMA0CONbits . HALF = 0 ; DMA0CONbits . NULLW = 0 ; DMA0CONbits . AMODE = 0 ; DMA0CONbits . MODE = 2 ; DMA0PAD = ( int ) & ADC1BUF0 ; DMA0CNT = 63 ; DMA0REQ = 13 ; DMA0STA = __builtin_dmaoffset ( BufferA ) ; IFS0bits . DMA0IF = 0 ; IEC0bits . DMA0IE = 1 ; DMA0CONbits . CHEN = 1 ; }
This function configures the dma module.
This function configures the dma module .
// Word transfer // ADC to DMA RAM // Initiate interrupt after all data moved // Normal operation // Configure DMA for Register indirect with post increment // Configure DMA for Continuous Ping-Pong mode // Address of ADC result data given to DMA. // Total DMA transfers to be 64 // Selecting ADC as the module to interrupt DMA engine // Allocating memory in DMA RAM // Clear the DMA interrupt flag bit // Set the DMA interrupt enable bit // DMA Channel Enable