CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Is it possible to capture 64kbps of data (SOLVED)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 552
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Fri Sep 21, 2012 12:49 pm     Reply with quote

This is some of the code I found in CCS for DMA. Shouldn't it work? Note that I haven't tested any of it yet, but will that code work or it's *there* but not functional?
Code:

short DMA_SPI_IN_TRANSFERRED = false;
short DMA_SPI_OUT_TRANSFERRED = false;

// Allocate 1024 D-WORDS of DMA RAM for SPI IN Buffer A
#BANK_DMA
unsigned int DMA_SPI_IN_BUFFER_A[DMA_BUFFERSIZE];

// Allocate 1024 D-WORDS of DMA RAM for SPI OUT Buffer A
#BANK_DMA
unsigned int DMA_SPI_OUT_BUFFER_A[DMA_BUFFERSIZE];


// DMA Channel 0 interrupt routine (SPI IN)
#INT_DMA0
void DMA_IN_ISR( void )
{
   DMA_SPI_IN_TRANSFERRED = TRUE; 
}

// DMA Channel 0 interrupt routine (SPI OUT)
#INT_DMA1
void DMA_OUT_ISR( void )
{
   DMA_SPI_OUT_TRANSFERRED = TRUE;
   printf( "o" );
}

In the main file:

   DMA_SPI_IN_TRANSFERRED = false;
   DMA_SPI_OUT_TRANSFERRED = false;   

   setup_dma( 0, DMA_IN_SPI2, DMA_BYTE );
   setup_dma( 1, DMA_OUT_SPI2, DMA_BYTE );
         
   enable_interrupts( INT_DMA0 );
   enable_interrupts( INT_DMA1 );   

   enable_interrupts( INT_SPI2 );

   dma_start( 0, DMA_CONTINOUS, &DMA_SPI_IN_BUFFER_A[0] );
   dma_start( 1, DMA_CONTINOUS, &DMA_SPI_OUT_BUFFER_A[0] );

Ben
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Fri Sep 21, 2012 1:39 pm     Reply with quote

You are correct...

I was looking at DMA for a PIC18F which has a DMA transfer, but not the same controller as the PIC24's and just didn't think that far.

And the last time I looked for DMA was years ago when PCD came out and I didn't remember it being in there as PCD was so new.

(I could swear I typed it into the CCS help and got no results)

but there ya go.

Let us know how DMA functions in CCS work out for you. PCD is sometimes known to still have a few rough edges.

Cheers,

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group