Problem Getting Program to Print Text

I am trying to clock data from an array out to three SIPO chips. I’ve had some problems getting things to come out right so I thought I should debug the output of the various functions. Unfortunately this has led me to some strange problems. For example when I leave the function “writeData” in the code, nothing in the entire program prints even though that particular function is never called, and when it was called it was called after some text should have printed. When I remove that the “writeData” function the program progresses a little more and prints some text, but the program still freezes after displaying “beginWriteBoard.”

I am relatively proficient in writing C code and cannot for the life of me figure what is causing these two problems. The only thing that I could think of is that the RAM is being filled up as when I remove print strings things sometimes work, but that does not seem reasonable since I am only using a small amount of it. Any and all help is appreciated.

Below is my code:


  • SIPO_LedBoard


//#define SER_DEBUG //Print debug text when reading from serial

#define SIPO1_OFF 0b0000000
#define SIPO2_OFF 0b0001110
#define SIPO3_OFF 0b1111111
#define TOGGLE_DELAY 1 // us to delay in toggle
#define MAX_LENGTH 34

int SIPO1 = 7; // Serial Input for SIPO 1
int SIPO2 = 6; // Serial Input for SIPO 2
int SIPO3 = 5; // Serial Input for SIPO 3
int STROBE = 4;
int OE = 3;
int CLOCK = 2; // Clock Pin
int LED_PIN = 13; //Pin that on board LED is attached

int playbackLength;

int allOnScreen[10] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};


int outputArray[MAX_LENGTH][10] = {
{ 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF, 0x3FF }

int delayArray[MAX_LENGTH] = { 5 };

void setup() // run once, when the sketch starts


pinMode(SIPO1, OUTPUT); // sets the digital pin as output
pinMode(SIPO2, OUTPUT); // sets the digital pin as output
pinMode(SIPO3, OUTPUT); // sets the digital pin as output
pinMode(OE, OUTPUT); // sets the digital pin as output
pinMode(STROBE, OUTPUT); // sets the digital pin as output
pinMode(CLOCK, OUTPUT); // sets the digital pin as output

digitalWrite(STROBE, LOW);
digitalWrite(OE, HIGH);
digitalWrite(CLOCK, HIGH);

digitalWrite(LED_PIN, LOW);

//writeData(SIPO1_OFF, SIPO2_OFF, SIPO3_OFF);

void loop() // run over and over again
int i,j;
char c;

for(i = 0; i < playbackLength; i++){
for(j = 0; j < delayArray*; j++){*
_ writeBoard(outputArray*);_

void writeBoard(int ledArray[10])
* int k;*

* int sipoTwo;*
* int sipoOne;*
* int sipoThree;*

* Serial.print("\r\nBegin writeBoard");*
* for(k = 0; k < 10; k++) {*
* Serial.println(k);*

* sipoOne = (1 << k);*
* sipoThree = ~(ledArray[9-k]);*
* sipoTwo = (sipoOne >> 7) | (sipoThree << 3);*
* sipoThree = sipoThree >> 3;*

* //writeData(sipoOne, sipoTwo, sipoThree);*
* //delay(1);*
* }*
* Serial.print("\r\nEnd writeBoard");*
#ifdef exclude
void writeData(int sipoOneIn, int sipoTwoIn, int sipoThreeIn)
* int m;*

* Serial.print("\r\nBegin writeData");*
* Serial.print("\r\nEnd writeData");*