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 CCS Technical Support

Out Of Memory

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



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

Out Of Memory
PostPosted: Wed Jun 09, 2010 7:55 am     Reply with quote

HI Guys I have to send about 150 I2c commands to a peripheral camera sensor but I have seemed to run out of ROM space....

Can any suggest something that may condense space the I2c commands are in this fastion:
Code:
//Command used to initiated a soft restart
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x12);
i2c_write(0x80);
i2c_stop();

delay_us(2);  // Bus Free time

//Setup Common control 8
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x13);
i2c_write(0x00);
i2c_stop();

delay_us(2); 

//Set (11110) to AEC[10:3] Automatic Exposure Control
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x10);
i2c_write(0x1E);
i2c_stop();

delay_us(2);

//Reserved
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x3B);
i2c_write(0x07);
i2c_stop();

delay_us(2); 
//Reserved
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x5B);
i2c_write(0x40);
i2c_stop();

delay_us(2); 

//Reserved
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x39);
i2c_write(0x07);
i2c_stop();

delay_us(2); 

//Reserved
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x53);
i2c_write(0x02);
i2c_stop();

delay_us(2); 

//Reseved
i2c_start();
i2c_write(OV5620_WRITE_ADDR);
i2c_write(0x54);
i2c_write(0x60);
i2c_stop();

delay_us(2); 


Thanks in advance

Jacques
_________________
"THE ONLY EASY DAY WAS YESTERDAY"
mskala



Joined: 06 Mar 2007
Posts: 100
Location: Massachusetts, USA

View user's profile Send private message

PostPosted: Wed Jun 09, 2010 8:55 am     Reply with quote

Create a subroutine for the write, you only even need 2 parameters.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Jun 09, 2010 10:08 am     Reply with quote

One thing that causes Out of Rom errors is if you have too much code in one function, including main(). The PIC's memory space is like a book. You have several pages in the book but your code(function) has to fit on each page and cannot carry over to the next page. I would imagine this is your problem. Try chopping your I2C commands into separate functions and then just call those functions in order to create the same effect.

Ronald
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

PostPosted: Wed Jun 09, 2010 2:44 pm     Reply with quote

thx i will give that a try
_________________
"THE ONLY EASY DAY WAS YESTERDAY"
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