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

PIC18F4520 problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sven_1669



Joined: 28 Mar 2006
Posts: 5

View user's profile Send private message

PIC18F4520 problem
PostPosted: Tue Mar 28, 2006 4:24 pm     Reply with quote

I am building an mp3 player using the STA013 decoder chip. It requires you to send 2007 address-data pairs to configure it. I am using the PIC18F4520, and trying to send these pairs using an array. I am getting the "not enough RAM" error. Is there any other way to send the data without using an array? Any ideas would be helpful. [/b]
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 28, 2006 4:49 pm     Reply with quote

Store the array in ROM instead of RAM. Tell the compiler to do this
by using the "const" qualifier in your array declaration. See the
example below:
Code:

#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

int8 const STA013_UpdateData[] =
{
0x3a, 0x01, 0x2a, 0x04, 0x28, 0x00, 0x29, 0x00, 0x20, 0x00,
0x21, 0x00, 0x22, 0x00, 0x23, 0x00, 0x24, 0x00, 0x25, 0x00,
0x26, 0x00, 0x27, 0x00, 0x28, 0x01, 0x28, 0x02, 0x21, 0x8f,
0x28, 0x03, 0x21, 0x00, 0x28, 0x04, 0x28, 0x05, 0x28, 0x06,
0x28, 0x07, 0x28, 0x08, 0x28, 0x09, 0x28, 0x0a, 0x28, 0x0b
// etc.
};

//=================================
void main()
{
int16 i;    // Use 16-bit index
int8 value;

// Display the first ten bytes of the array.
for(i = 0; i < 10; i++)
   {
    value = STA013_UpdateData[i];
    printf("%x, ", value);
  }

while(1);
}
Guest








PostPosted: Tue Mar 28, 2006 8:15 pm     Reply with quote

thanks, works like a charm!!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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