Jump to content
RobG

Serial to 7 Segment LED

Recommended Posts

Im sorry because of ignorance, but this seems like something like I could use a future project. I am having trouble difficulty understanding the code because I have no clue what hardware the Launchpad is talking to. Is there something else you are using to convert the serial output of the launchpad? Can anyone shed a light on this subject...

 

The reason I am interested is because I was planning on using a BCD to 7-segment decoder.

Share this post


Link to post
Share on other sites

The way this works is one MSP430 acts as a serial receiver and LED driver (keep in mind that due to MSP430's current limits, the display has to be very bright or you will have to use extra transistors.)

See here.

 

Also, there are some code improvements that I have to make, I will try to post them by the end of this week.

 

Which decoder? 74HC4511?

Share this post


Link to post
Share on other sites
Well I was using a really old one I had laying around, SN74LS47N. It's an old TI chip.

:lol::lol: Hehehohohaha!!! :lol::lol:

Ok, I've got to post a thread about what I did with an sn7447 (and an icm7218a) before I actually started messing with microC's, you guys are going to love it!

Share this post


Link to post
Share on other sites

Hey cris, if you want some more ideas for BCD, take a look at this thread I just put up.

 

(And I wasn't trying to derail your conversation, just trying to help. :) I was laughing only because that reminded me of my own tinkering, and how silly it seems now)

Share this post


Link to post
Share on other sites

Hello fellow 43oh'ers !

 

I have coded a similar thing myself just recently to replace a hard-to-get saa1064 I2C display driver chip. My objectives were therefore a bit different, namely I wanted a full functional replacement. Circuit simplicity is a pro, as it requires barely a handful of current limiting resistors, display and an USI capable MSP with at least 12 gpios available. The code can be found in google code repository (url will follow). Feedback is more than welcome, as I am new into micro-controller programming.

http://code.google.com/p/msp430-saa1064/

s.

Share this post


Link to post
Share on other sites

You can drive 4 7-segment LED displays plus a decimal point for one digit using 9 pins with a very simple circuit. This makes it possible to make a display with the 14 pin micro such as the one that comes with a launchpad (MSP430G2231 IIRC). The following description assumes that the segments are common cathode.

 

The secret is to use 2 npn transistors and 2 pnp transistors for the digit drivers. The segments can be driven directly by ports. No resistors in series with the segment driver pins are required, as the segment current is self-limiting to a reasonable value.

 

Each of the two digit driver port pins is used to drive one NPN as an emitter follower (collector connected to 3.3 volts), and one PNP as a common emitter (emitter connected to 3.3 volts).

 

Each driver port pin is connected to an NPN base, and from the driver pin to the base of the PNP via a resistor of about 2K. I used 2n3904 and 2n3906 xstrs with 1.3K base resistors which I think is lower than required. The resistors must be small enough for the PNPs to saturate when they are driving 2 segments.

 

I drive 2 segments at a time in order not to exceed the total current required by the micro. With an interrupt at 1 MSec, driving 2 segments at a time, for each of the 4 digits, means that there will be 16 cycles (taking 16 MSec). This is fast enough for no flicker and a display that is bright enough to read.

 

When the driver pin is high the digit connected to the NPN emitter is on. When the driver pin is low the digit connected to the PNP collector is on. When the pin is configured as an input neither digit is on. Repeat for the other 2 digits.

 

This works great for LEDs that need 2.0 or 2.1 Volts to turn on. I used MSQC4911C displays.

 

Because the emitter voltage of the NPN will be about 0.6 volts below VCC when it is on, and the PNP collector will be about 0.3 or 0.4 volts below VCC, the NPN digits will be slightly dimmer than the PNP digits. There are two ways to correct this:

 

1) Put a Schottky diode in series with the PNP collector. This will make the voltage that the digit driver sees about the same as for the NPN digit.

 

2) In the code driving all this, let the on-time for the NPN transistors be longer than for the PNP transistors. I select them so that the average is 1 MSec.

 

I have tried both methods with good results, and have tried it with 3.3 Volts instead of the normal launchpad voltage of 3.5 volts.

 

In order for the circuit to determine what segments to display, the one remaining I/O pin is configured to accept serial data with auto-baud, sort of like the LIN protocol, but simpler. Of course a 32KHz crystal is not installed as the pins are needed for the display, hence the need for auto-baud.

 

If you want one decimal point to be turned on, connect the cathode of the decimal to ground through a resistor, and connect the anode to the appropriate digit driver pin. The decimal LED will be on whenever the corresponding digit is on.

 

Once I get around to doing the documentation I will publish a project.

 

cheers,

g.

 

glen@worstell.com

 

PS - I've done this in two other ways:

 

1) Use 'Charlieplexing'. This can be done with 6 pins and no other parts, tho the display is not as bright. Only 30 segments can be driven this way, so it won't do a full 4*8.

 

Charlieplexing requires individual digits, not ones with common cathodes. As a compromise between brightness and flicker, I drove 20 segments with 1 MSec interrupts. If more than 20 segments are on, there will gradually be dimmer displays and some flicker if it stretches out to 30 segments. If fewer than 20 need to be on, just turn them off until 20 MSec have been used; this keeps the display at a constant brightness.

With random data about 20 segments or fewer will be on at a time, usually.

 

2) Use 2 common-anode digits and 2 common-cathode digits. A pair of CC-CA digits will have their digit drivers driven by one pin. When it is high the CC digit will be on, and when it is low the CA digit will be on. When it is an input neither will be on. No other parts are required. The only problem is that I can't find CC and CA digits that are matched in appearance and in on-voltage. I have a few that seem to be no longer available.

 

It is probably obvious, but the segments for the CC digit must be driven low to turn them on, and the CA segments must be driven high.

This is easily taken care of with the software. As the MSP430 has fairly symmetrical drivers there is not an issue with differing brightness.

 

If you use a 20 pin part such as the MSP430G2553, just use 4 NPN emitter followers as digit drivers. Again, no resistors are needed for the segments. You will use 12 pins; 4 for the digit drivers and 8 for the segment drivers (or 7 if you don't need a decimal point or a colon). You could probably do away with the emitter followers; just drive 2 segments at a time as described in the first part of this note.

 

g.

 

PPS - I 'invented' the NPN-PNP technique, but like so many inventions it is quite possible that someone else invented it first. :) Also note that the code I hope to publish uses the excellent naken_asm assembler, but the code could be easily modified for CCS, MSPGCC, or whatever. It could even be done in C if you don't like assembly language.

Share this post


Link to post
Share on other sites

Hi worstell,

 

Thank you very much. I have taken the liberty of implementing that idea into my code. What came out is an 8 digit display driver using the very same number of pins as the 4 digit version I had started with. It looks OK, if you don't care about the flickering of some segments that supposed to be off. It is apparent that making the nodes floating still results in residual currents floating in unwanted branches. This is justified by REALLY simplistic and minimalistic hardware. My code allows to manipulate duty cycle for both displays separately - as you suggest it is possible to compensate for the brightness differences between the CA and CC displays.

 

Szymon

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.


×
×
  • Create New...