Shop OBEX P1 Docs P2 Docs Learn Events
Help with 4 digit BCD display — Parallax Forums

Help with 4 digit BCD display

Don MDon M Posts: 1,654
edited 2011-03-24 08:54 in Propeller 1
I am looking to connect to an existing display in a device that has 4 seven segment displays driven by one 7447 BCD driver chip. I looked in the OBEX for any objects already written to drive such but came up empty.

Don

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-03-23 06:57
    You might have to write the driver youself. You can find BCD (Binary coded decimal) encoding/decoding by checking out one of the RTC (real time clock) projects on the OBEX or Google.

    Looking at the data sheet for the 7447 BCD chip, if you want to output a 9 then
    D = 1
    C = 0
    B = 0
    A = 1

    Looks very easy. Do you have a specific programming question?
  • Don MDon M Posts: 1,654
    edited 2011-03-23 08:13
    Mike- Thanks for the reply. I understand how BCD works but just hoping there might already be a driver out there or in someone's "toolbox" that would save me from having to create one. :)

    I know that in order to multiplex all 4 digits that there needs to be a ring counter set up for the digit scan and then it needs to be synchronized to the BCD output.
  • Don MDon M Posts: 1,654
    edited 2011-03-23 10:03
    To be quite honest I don't know where to even start with this. :(
  • kwinnkwinn Posts: 8,697
    edited 2011-03-23 10:58
    Don M wrote: »
    To be quite honest I don't know where to even start with this. :(

    There are several ways to do this.
    You can dedicate 8 prop pins to do it directly. That is, output the bcd digit on 4 pins and the digit select on one of the other 4 pins.
    With 6 pins and some external hardware you could output bcd on 4 pins and the binary digit select on 2 pins.
    With an external shift register ( 74HC595 or similar ) and 3 pins you can shift out the bcd and digit select serially. A 74HC164 could do this with 2 pins but you might notice some flicker as each digit is shifted out.
  • JonnyMacJonnyMac Posts: 9,234
    edited 2011-03-23 11:48
    Does the device have eight connections? It seems like you'd need one each for the digit control plus four bits for the 7447. Assuming this is the case you could launch this method into its own cog (you need to provide a stack for it):
    pri out7447(pin, pntr) | idx, t
    
      outa[(pin+7)..pin] := %11110000                               ' clear 7447, digits off
      dira[(pin+7)..pin] := %11111111                               ' all outputs
    
      t := cnt
      repeat
        repeat idx from 0 to 3                                      ' loop through digits
          outa[(pin+3)..pin] := %0000                               ' blank columns
          outa[(pin+7)..(pin+4)] := byte[pntr][idx]                 ' update digit
          outa[(pin+3)..pin] := 1 << idx                            ' activate column
          waitcnt(t += (clkfreq / 1000))                            ' for 1ms
    

    You need to pass the address of a four-byte array that holds the digit values.
  • Don MDon M Posts: 1,654
    edited 2011-03-23 13:07
    Thanks JonnyMac. I''ll have a look at this.
  • Don MDon M Posts: 1,654
    edited 2011-03-23 17:49
    Here's what I am thinking of doing. I don't have to use the 7447. So I am going to try and connect the displays directly (through resistors and transistors) to the prop and use some code that was hown to me that I'll share later.

    The problem I have is that the display operates at approx 4 volts so I'll need to operate it at a higher voltage then what the prop can provide so I have attached some transistors.

    Attached is the schematic of what I'm thinking of doing. If anyone has any comments about this type of circuit and whether it'll work or not, please speak up.

    Thanks.

    LED Display.bmp
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-23 18:13
    Q1 through Q4 need to be wired with the emitter to the +5V. They'll sort of work the way you've drawn the circuit, but the emitter of the PNP transistors should be connected to the positive side of the power supply and the collector to the load.

    One advantage to using the 7447 is that the load on the Propeller's I/O pins is less if a lot of segments need to be on (like for 8). You could use driver transistors there (NPNs) too if you're not using the 7447.
  • Don MDon M Posts: 1,654
    edited 2011-03-23 18:50
    Mike.... Ooops. My mistake on the connections to the PNP transistors. But yes, I had also considered an NPN on the segments as well. The segments draw approx 10 -15 ma so if there was an 8 displayed it would tax the overall power capability of the prop. My intention now is to not use the 7447.


    LED Display.bmp
  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-23 22:07
    I forgot to remind you that you'll need base resistors for Q1 through Q4 and for the NPN transistors attached to them as well. You might consider using "high side" MOSFET drivers for the digit leads and MOSFETs for the segment drivers. That'll eliminate the need for the base resistors and reduce the amount of current the Propeller has to deal with. It used to be that there was a big cost differential for using MOSFETs for this sort of thing vs. bipolar switching transistors, but that differential is much less today.
  • JonnyMacJonnyMac Posts: 9,234
    edited 2011-03-24 08:54
    You'll also need pull-ups (to 5v) between the collectors of the NPN and the bases of the PNPs to ensure the column is disabled when you want it to be.
Sign In or Register to comment.