This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430G2553: printf a matrix of binary random numbers

Part Number: MSP430G2553


Tool/software: Code Composer Studio

Hi,

I would like to generate a matrix of binary random numbers and then display the matrix on the debug console. Here is the my code:

//RNG

#include "msp430G2553.h"
#include  <stdint.h>
#include  <stdlib.h>
#include  <stdio.h>


void main( void )
{
  WDTCTL   = (WDTPW | WDTHOLD);                       	// Stop watchdog timer

  BCSCTL1  = CALBC1_16MHZ;                             	// Set range to 16MHz
  DCOCTL   = CALDCO_16MHZ;                             	// Set DCO step and modulation to 16MHz

  TA0CCR0  = 400;                               		// Frequency 40kHz, 25us
  TA0CCTL1 = OUTMOD_7;                                	// Reset / set
  TA0CTL   = (TASSEL_2 | ID_0 | MC_1 | TACLR | TAIE); 	// SMCLK, divider 1, up-mode, clear, interrupt enabled

  _BIS_SR(GIE);                                  		// Enable global interrupts

  while( 1 );                                         	// Endless loop
}

// Timer0 A1 interrupt service routine
#pragma vector = TIMER0_A1_VECTOR
__interrupt void Timer0_A1_ISR( void )
{
	static uint8_t x = 4;
	static uint8_t y = 8;
	static uint8_t i = 0;
	static uint8_t p = 0;
	static uint8_t random = 0;
	static uint8_t randomNums [4][8] = {{0}};
	
	for ( i = 0; i < x; i++)
	{
	      // This loop is for the row
	     for ( p = 0; p < y; p++)
	     {
	              //randomize each element for the array.
	              random = rand() % 1;
	              randomNums[i][p] = random;

	              printf ("binary: %s\n",randomNums[i][p]);

	     }
	}
}

Using the above code, I get this error: "program will not fit into available memory". I have read the following guide describing how to use printf in CCSV 4 and 5:

http://processors.wiki.ti.com/index.php/Printf_support_for_MSP430_CCSTUDIO_compiler

However, I am using CCSV6.2 and the settings in properties are different than what is shown in the above link and I can not find a way to increase the heap memory size (I think that might be why I am getting the error).

Can you please help me resolve this issue.

Thank you very much!