7 Segmented Displays are pretty low tech and have been around for quite a while.They have a lot of wiring clutter with them..But still they are by far the most easiest(and cheapest) way to give out a (alpha)numerical output..I had interfaced 7segs with MSP430 a while back directly but owing to the low current capabilities of MSP430 the display wasn`t very good and clear . We were recently ‘taught’ about the BCD-7 segmented display in our semester..So i thought about interfacing the 7 segmented with the CD4511..This will save some precious pins and plus drive the 7 seg directly. The CD4511 IC can run from 3V Supply..So no power supply issues and the logic high(input) is about 2V which is also apt as on MSP430 we have this about 3.3V.

The datasheet is available  here

The only thing that was bad was the wiring clutter  has increased and there were (as always) a few loose connections.After a few minutes,I was up and running with the display.

The Fritzing Schematic is given below:

cd4511

Do everything according to the picture above for the code to run. If the Schematic is not clear..then refer to datasheet linked above.Everything has been done according to it..The LT(bar) and BI(bar) have been connected to +VCC and LE to ground.The display is powered from the ‘board’.

The connections (from the MSP430 end to CD4511) are:

P1.4 -D

P1.5-C

P1.6-B

P1.7-A

#define D BIT4
#define S BIT5
#define B BIT6
#define A BIT7

The code to drive the CD4511 “According” to the above config is:

void CD4511(int numb)
{
switch(numb){
				case 0:P1OUT&=~(B+A+S+D);
				break;
				case 1:P1OUT|=(A);
				       P1OUT&=~(B+S+D);
                break;
				case 2:P1OUT|=(B);
				       P1OUT&=~(A+S+D);
                break;
				case 3:P1OUT|=(A+B);
				       P1OUT&=~(S+D);
                break;
				case 4:P1OUT|=(S);
				       P1OUT&=~(A+D+B);
                break;
				case 5:P1OUT|=(A+S);
				       P1OUT&=~(B+D);
                break;
				case 6:P1OUT|=(S+B);
				       P1OUT&=~(A+D);
                break;
				case 7:P1OUT|=(S+B+A);
				       P1OUT&=~(D);
                break;
				case 8:P1OUT|=(D);
				       P1OUT&=~(B+S+A);
                break;
				case 9:P1OUT|=(A+D);
				       P1OUT&=~(B+S);
                break;
				default:P1OUT&=~(B+A+S+D);
				break;
}
}

Just to clarify :The code uses ‘S’ instead of ‘C’ because C was being used as an internal macro in the header file!

The video is down here..It first shows the simple counter..then the push to change count and then the Dice.
To get the complete source code..you can comment below..The comments are moderated so you email will not be leaked.
Thanks for passing by!
🙂
#Sorry for the bad cam! 😛

Advertisements

7 thoughts on “TI MSP430 Dice( and other experiments)

  1. can i learn from you how u write the program code for the 3rd method of your 7-segment which generate random numbers, thanks and hoping for you reply

    • Hi Alex,
      Sorry for the late reply!
      There are several ways to generate random numbers!
      In this particular one i used LFSR (you can search it on wikipedia..they have explained it pretty well)
      But you can use another ways also.. A good one is using a timer that runs over an over and since the button press is a random event the value of the timer count can be scaled down to converge to 6 using any mathematical operation like dividing to be the simplest!

      Hope your query gets answered!
      Regards,
      Rohit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s