Jump to content
Sign in to follow this  
ninisnanas

MSP430G2553 with 8x8 LED Booster Pack by Olimex

Recommended Posts

Hi, I am a newbie. I'm currently doing my final project for college. I use MSP430G2553 and 8x8 LED BoosterPack by Olimex.

I have been learning the example code in Energia (the one that produces sine wave and scrolling text) but I haven't figure out how to send data to the booster pack. I only succeed to control the buzzer via push button.

 

I have read the manual & schematic for the booster pack. I figured that I need to use three ports to control the LED; CLOCK, LATCH, and DATA ports. However, I couldn't understand the code part that sends data to the LED. I have been trying to light up a single LED in that 8x8 matrix but haven't succeeded, yet.

 

Could anyone give me advice or step-by-step tutorial on how to do it? I really am new to this world--it's been less than a month when I started to 'make friends' with micro controller. I have read the MSP430 manual and am able to control the LED & push button in the LaunchPad, but not the booster pack.

 

I am looking forward to hearing from any of you. This will be a great help. Thanks :)

 

Regards,

Nisrina Rahmah

Share this post


Link to post
Share on other sites

Looking at the schematic, I see that the LED BoosterPack is based on two 74x595 shift registers. The 16 outputs are wired to the rows (ROW1-8) and columns (R1-R8). To light a LED you need to set the respective row and column bits.

https://www.olimex.com/Products/MSP430/Booster/MSP430-LED8x8-B00STERPACK/resources/MSP430-LED-BOOSTERPACK-schematic.pdf

 

To get the bits into the shift register, you need to clock in all 16 bits (set data pin to the desired value, set clock pin high, set clock pin low, repeat 16 times), and then tell the registers to copy the bits to the outputs (set latch high, set latch pin low).

 

Energia comes with a special command shiftOut, that pushes 8 bits at once into a shift register. You will need to call it twice (once for the row and once for the column) to set all 16 bits of your BoosterPack.

http://energia.nu/ShiftOut.html

Share this post


Link to post
Share on other sites

@@chicken thank you for your answer! I have tried it. Unfortunately, after I uploaded the code, it still won't light up.

 

This is my code:

#define LATCH 6
#define CLOCK 7
#define DATA 14
#define DELAYTIME 10
#define PUSH_BUTTON 5

int buttonState = 0;

unsigned char image[8] = {
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00
};

void clearScreen() {
  for (int i = 0; i < 8; i++) {
    image[i] = 0x00;
  }
}

void sendData(unsigned short data) {
  for (unsigned short i = 0; i < 16; i++) {
      Serial.println(data, HEX);
      digitalWrite(DATA, data & ((unsigned short)1 << i) ? HIGH : LOW);
      delayMicroseconds(DELAYTIME);
      digitalWrite(CLOCK, HIGH);
      delayMicroseconds(DELAYTIME);
      digitalWrite(CLOCK, LOW);
  }
  delayMicroseconds(DELAYTIME);
  digitalWrite(LATCH, HIGH);
  delayMicroseconds(DELAYTIME);
  digitalWrite(LATCH, LOW);
}

void sendImage(unsigned char *img) {
  unsigned short data;
  for (int i = 0; i < 8; i++) {
    data = (1 << 8) << i;
    data |= *img++;
    sendData(data);
  }
}

void setup()
{
  // put your setup code here, to run once:
  //Serial.begin(9600);
  pinMode(CLOCK, OUTPUT);
  pinMode(DATA, OUTPUT);
  pinMode(LATCH, OUTPUT);
  pinMode(PUSH_BUTTON, INPUT_PULLUP);
  
  clearScreen();
}

void loop()
{
  // put your main code here, to run repeatedly:

  buttonState = digitalRead(PUSH_BUTTON);
  //Serial.println(buttonState, DEC);
 
  if(buttonState == LOW) {
    image[5] |= 1 << 5;
  }
  sendImage(image);
}

If I uncomment the code on line 47 & 61, the LED lights up and blinking (with some buzzing). When I comment it, it's no longer buzzing but it doesn't light up. I think I missed something there.

Share this post


Link to post
Share on other sites

If Serial.println is causing issues, you should also remove it in line 22.

 

From the schematic it looks like the Olimex BoosterPack uses the same pins for the LED display that the LaunchPad uses for serial communication (really bad practice on behalf of Olimex [:sad:]). You might also want to pull the TXD/RXD jumpers on the LaunchPad to avoid any conflicts.

Share this post


Link to post
Share on other sites

PS: What buzzer are you talking about? If you are using another BoosterPack at the same time, make sure to look at the pin-outs to ensure that you are not trying to use the same pins for two things at once.

Share this post


Link to post
Share on other sites

Sorry, I looked at the wrong schematic. This here is the right one:

post-9974-0-79205200-1394570245_thumb.png

 

So yes, the Buzzer and AIN are connected to the same lines that the Energia and LaunchPad reserve for serial output. So you can't use those together.

 

As for the 8x8 LED, make sure to use the correct pin designations. Not sure if 6, 7, 14 is the correct way to address pins in Energia. But from the pin map this looks fine.

http://43oh.com/2013/01/pins-maps-for-energia-supported-boards/

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...