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.

TM4C1233H6PM: Time multiplexing

Part Number: TM4C1233H6PM

I am using tm4c123g and ds1307 to display time (hh:mm:ss) on sevensegments and date and day on lcd(16x2). Is there any way way to use same 8 pins for data of both (lcd and seven segment display..as they are to diplay different data). Can time multiplexing be used for that purpose? Tell me any idea or any way to do this...

  • Hello Muhammad

    You can use serial shift registers to move in the values so that the values can be retained without having to worry about refresh intervals and blinking.
  • I didnt got it..plz elaborate..I wanna.use same pins for lcd and seven segment but data would be different for both....
  • Hello Muhammad

    Why same pins, when there would be sufficient pins on the micro-controller to support both of them?
  • Hi,

    While it could be possible to do what you need, with care, there are some hardware considerations which should be taken into account. 

    First is the display type - common cathode or common anode - common cathode should be excluded since the maximum current drain into microcontroller pin will be >90ma, which largely exceed the pin specification. Even for common anode type, also the usual current of 15-25 mA needed to "see" the segment also exceed the pin specification of 8 mA. While you may force 15 mA into a pin, then the voltage levels will not be good -  giving you a, let's say, ~2.3V for either low or high (tested in lab, don't do it).

    Second, depends on colour of your 7 segment display - some new display with colour white or blue have LED with 3..3.6V drop, so you may need to use higher voltage than that used by the microcontroller, so another problem, the pin does not support more than VDD in output mode.

    As Amit suggested, only external hardware driven by SPI interface(schematics on Google). Take into account you need additional pins to multiplex the display units to reduce current consumption.

    But best, use only the LCD display you already have, no such problems. 

     

  • A third vote for not doing this. Yes it is probably possible but it would require a double handful of external logic. With only eight pins I think you'd also run into issues with the number of time periods needed.

    SPI would be a lot easier to set up and need fewer pins in the bargain. I wouldn't be surprised if it took fewer CPU resources and less external logic as well as less complex SW even if it was bit-banged.

    Robert
  • Tossing, "Caution to the wind" - this reporter, "Sides w/poster!"     (caution is also discarded by those "brave/unconscious enough - to fly/sail/drive w/this semi-skilled reporter)

    I'd recommend 8 pin data bus for the 2x16 - and you'll need 2 more GPIO (outputs) for RS & E.  (tie RW to Gnd)

    Those same 8 pins can (also) parallel connect to an 8 bit latch (573 or similar).  It is the output of that 8 bit latch which will drive the 7 segment display - and if that display is multiplexed - you may well need further current boosting.  And - should the 7 segment Led display (really) be multiplexed - you will have to limit LCD writes to the time reserved for, "Led inter-digit blanking" to prevent flicker upon the 7 segment Leds.

    Your desire to "save" one MCU Port comes at the price of added software & hardware complexity - it is noted that your RTC presents an (always delightful) I2C challenge to your mix.   (prepare NOT to sleep much if this project is "on deadline" - and you've "just" started...   (no one @ this forum is guilty of such sin... ... perhaps make that (few) here...)

    Key here is the recognition that the Lcd will ONLY SEE those 8 bits when the "E" pin is toggled!   And so too - the Led display will ONLY SEE the 8 bit latch output - when you toggle its clock pin.   (both of those toggle pins should be unique (different) MCU GPIO outputs.   Poster has (very) well titled his post, "Time Multiplexing" and while the data rate is (slower) than that of (most) time multiplexed systems - his idea was sound - and the method outlined herein should prove successful.

    In summary:

    • choose an 8 bit port to provide data to (both) 2x16 and to an external latch IC (dedicated to 7 segment display)
    • choose 2 GPIO as E & RS for the 2x16
    • choose 1 more GPIO as clock for the external latch IC
    • Your software presents data (uniquely) to either the 2x16 or to the latch (7 segment driver)
    • Unique presentation of data results (only) by the proper toggling of (either) E or latch_clock

    This has been done previously - I have photos - the 7 segment Leds provide a size & viewing "punch" which is lacking @ the 2x16.   (and the 2x16 provides the fine detail - for "up close" viewing - both may successfully coexist.)   As poster Petrei notes - I'd not recommend LED operation w/out the buffering latch - as presented - above...

    (Poster's "Green Verify tick" (may) keep the wolf from this reporter's door - bit longer...)

  • cb1 said:

    In summary:

    • choose an 8 bit port to provide data to (both) 2x16 and to an external latch IC (dedicated to 7 segment display)
    • choose 2 GPIO as E & RS for the 2x16
    • choose 1 more GPIO as clock for the external latch IC
    • Your software presents data (uniquely) to either the 2x16 or to the latch (7 segment driver)
    • Unique presentation of data results (only) by the proper toggling of (either) E or latch_clock

    I would "like" this twice if possible. Very well detailed answer, evidently from one who did face the challenges of the very same application and is willing to share the strategy!

  • Are you not going to need additional pins for the multiplexing?

    Robert
  • Hail Bruno,

    How delightful - your kindness is much appreciated.  

    In (another) lifetime I co-founded a Display firm - unique application solutions (similar to this one) enabled our rapid growth.   (we competed - primarily - via, "Providing a more complete, better thought, Display & Accessory solution - at a competitive price.)

    If/when you visit Chicago (and have access to "Air-Sickness bag") we'll fly (almost air-worthy cb1-twin) to WI for "special burgers" to (properly) reward your writing...

  • Greetings Robert,

    Additional pins (may) be required - yet the necessary (poster provided) details are few.

    There do exist "display driver ICs" which can accept (just) 8 bit data. In several cases (if I may "read your mind") 4 bits (of the 8) service the display of Hex Digits "0-F" and the remaining 4 may denote the "Digit Address" and the decimal point.  (i.e. 3 bits define 8 digits, 4th bit serves decimal point.)

    My past firm developed such "just so" the 8 bit parallel bus could, "Extend - and provide more "Bang for user's Buck."  (other devices may exist as well - yet as client's RTC is I2C (and he has several "helplines" (already) opened here, for that) I believe the description I've provided PROVES the feasibility of user's "Time Division Mux" approach... (that was the essence of my response)

  • cb1 said:

    There do exist "display driver ICs" which can accept (just) 8 bit data.

    True, I am assuming from the description that no display driver ICs are contemplated since then time multiplexing would not be necessary.

    And an IIC bus extender would also eliminate the need for multiplexing.

    cb1 said:
    In several cases (if I may "read your mind") 4 bits (of the 8) service the display of Hex Digits "0-F" and the remaining 4 may denote the "Digit Address" and the decimal point.  (i.e. 3 bits define 8 digits, 4th bit serves decimal point.)

    If it is raw multiplexing then you need 7 bits (one for each segment), the decimals are fixed for time display so they could be hardwired. Then 3 bits could select the digit with the help of a '138. Plus the appropriate control bits that gets you to a of maybe 14 or 15 pins?

    SPI would take 5.

    IIC for LEDs would take 2 plus 8 data and 2(?) control for the LCD. 10 additional if the IIC is already used.

    IIC for LCD and LEDs would be no additional pins if the IIC is already used, two additional if not. That does rely on being able to get something like 55 bits of I/O on IIC bus expanders. IIC's addressing requirements might trip you up there.

    Robert

  • Poster stated his requirement as "clock" - thus "raw mux'ing" may not be required. (even the "Hex" output to 7 segment is overkill.)

    The solution I developed sought "selective" decimal placement - thus we made that programmable. (i.e. scales & similar require decimal "mobility")

    I2C for both Lcd & 7 Segment (could) be the way to go - but for the dreadful difficulty in, "Getting it to work."

    I stand by my (counter) to the three "negative" views re: Time Div. Mux of Lcd & 7 Segment Led... Other approaches (may) succeed - yet all "stray" from poster's subject line - mine did not!
  • Actually the requirement was stated as multiplexing but I wouldn't stick to requiring that myself.

    The 7 segments do need to be individually controllable though, or you need a decoder/driver plus a latch. OTOH, if you add those you might as well use a couple of your 8 bits for addressing the latches and dispense with the multiplexing entirely. (8bits plus a couple of control lines)

    Robert
  • Robert Adsett72 said:
    The 7 segments do need to be individually controllable though, or you need a decoder/driver plus a latch.

    We may be "in sync" or somewhat apart here - recall we (really) did develop such an LED driver, device.   (small pin-count MCU)

    I can't quite parse, "7 segments do need to be individually controllable..."   My method translated 4 bit hex into the proper, 7 segment representations, for 0-9 & A-F.   If that's what is meant by "individually controlled - we did just that.   We made NO effort to enable single display bits - or other than the "normal, numeric, 7 segment outputs" - our marketing noted, "beyond that capability" as, "in the noise."

    Depending upon the physical (hardware) design of the 7 segment display (some were 4 digit based - w/just 7 Segments, 1 DP, and 4 (common) anodes or cathodes brought out - it would NOT be possible to, "dispense w/multiplexing entirely!"   The "general method" we chose enabled use w/"regular, single digit displays" or internally multiplexed ones.  (as just described)

    Again - poster's requirement is "much an open book" - more detail is needed.   (most always is needed - due to vendor's penchant for "Unguided Postings.")

  • cb1 said:
    I can't quite parse, "7 segments do need to be individually controllable..."

    You need to either control each segment, or you need to have a decoder to convert a number to the appropriate 7 segment pattern. You could extend that into alphanumerics but that is well beyond what the OP is needing.

    cb1 said:
    Depending upon the physical (hardware) design of the 7 segment display (some were 4 digit based - w/just 7 Segments, 1 DP, and 4 (common) anodes or cathodes brought out - it would NOT be possible to, "dispense w/multiplexing entirely!" 

    Mmm, quite right, I was not thinking of a multidigit LED with a compressed pinout but individual digits.

    Robert

  • Robert Adsett72 said:
    you need to have a decoder to convert a number to the appropriate 7 segment pattern.

    Bingo - our single, small 8 bit MCU did, "just that!"   Our design goal was to enable the display of "Longer Distance & More Impactful Data" (via larger, 7 Segment LED) while simultaneously providing (smaller, yet more comprehensive Alpha-Numeric data (via Character Lcd).   95% + of the time the LED was used for numeric display, only!

    That said - do keep mindful that simple, 7 Segment Displays - yield HORROR when tasked as Character Displays!   (can you say/spell UGLY?)   Character Displays were reserved for the LCD - which was positioned beneath the (larger) 4-8 digit LED display.   Again - they worked very well in unison.   (best features of each were exploited...)

    Keep in mind - many of our (and existing industry) clients - had (already) mastered & provisioned an 8 bit capability (plus strobes) for the Character LCD.   We saw an opportunity to simply "Piggyback upon that existing LCD capability" and ADD to our Sales by producing a, "7 Segment capable, More Visible, LED Display Driver" which employed those identical 8 bits.  (plus one added GPIO - which most had)

    One of our extra sales points was to, "Cycle" through multiple data selections - such that the LED held the measured value - and the Character Lcd described, "What was "on display."   The market "bought into this" - and the "David of Display Firms" lived for another day...

  • which transistor to use for multiplexing seven segment with tm4c123g. I m using bc547 but having problems. All digits display the same. I have bought two 3 digit seven segments and made their a,b,..f common. There is no flickering, blinking, brightness problems. but Results are not the way they should be. I have tested my program in lab on an expansion board especially made for tiva. so there is no problem in program.
  • My friend - you ARE welcome.

    Your report does not supply adequate detail to enable effective assistance.   (we helpers may "guess" - yet that eats our time/effort)

    From your writing - you seek to drive 6, 7 Segment Leds - is that correct?

    You note a transistor - but provide no detail as to its position w/in your circuit - nor its numbers - nor its driving.

    You (originally) wrote of the desire to, "Time Division Multiplex" - and not one word in that regard appears w/in your second (responding) post.   Has that desire changed/been withdrawn?   What's happened to your Character Lcd?   (2x16 iirc)   These are necessary facts - are they not?

    All digits displaying the same (as you state) indicates that:

    • you are not providing unique multiplexing to each digit (this is why we've asked for "number of common anode/cathode "digit switching" transistors - ONE cannot do the job)
    • As you've tested & verified via an (undetailed/described) expansion board - and we've no idea whatsoever of its design implementation - such info is of little (no) value
    • No problem in your program seems (somewhat) premature - any prototype proves challenging - not all faults - hardware or software - reveal dramatically - or quiickly!   (i.e. No problem YET!)

    More pertinent info IS required (a schematic - at minimum - seems obvious - does it not?   Your claim of, "especially made board" revealing, "No problem in program" confounds your "helper crue" here...  Describe that board as well - and why that special board does not lead to, "Results the way they should be!"

  • Thanks. Problem solved....and that desire is challenge of me to me. Thats not gone...keep helping...
  • Again - you originated here w/"Can time multiplexing be used for that purpose? Tell me any idea or any way to do this..."

    And that request was well answered - w/in multiple postings - yet escaped your (kind) "Verify Answer."   (such builds our Google Rating - which is required as "vendor trinkets" would (likely) be rejected by the, "Sellers of Manhattan Isle."   (Indians - NOT famed for negotiation prowess...)

    May I note that your, "Problem Solved" announcement provides,  "No fall-out benefit to others!"   That "sharing" is important - is it not?

    You noted, "one & only one" numeric image displaying upon ALL Six of your numeric digits.   I provided a troubleshooting check list - yet we're not told HOW you achieved your solution - and such would be of interest & use to those encountering this thread...   This thread provides no insight into your (claimed) successful resolution - which is counter to the openness of such a forum...

  • I was using bc547(npn transistor). They were displaying same digits bcz they were all were getting 1 in enable pin..I observed it by slowing down the multiplexing (by increasing the delay between enabling seven segments)..three of them were ON at one time and one was off. So I figured out that although it is common anode display segments but it would display at getting '1' not zero. I think that exception was due to npn transistor which in case of my lab launchpad expansion were pnp...so I wrote 1 for 0 in enables of seven segments.
  • Thank you. Some description has been provided - yet "your understanding" is not realizable to those here (your helpers) due to lack of a schematic or even simple block diagram.

    You've repeatedly mentioned just ONE (old, tired) transistor - yet 4 are required for mux'ing a 4 digit display - 6 for 6 digit - thus the reference to "just one" is confounding.

    Helpers are FAR from your set-up! The only link we have is your writing - and DETAIL (schematic, block diagram) ARE required to, "Ease,Speed & Enhance" the efforts of your helper crue... You'd do well to consider the "needs" of your helpers - who have NO access to your set-up, code or implementation...
  • Heh, I first read this as you advocating using a small micro a display peripheral.

    Robert

    Could be a good idea
  • Hello Robert,

    Poster notes, "Problem Solved!"

    Sometimes smart to, "Watch the magician's Off hand..."