Shop OBEX P1 Docs P2 Docs Learn Events
7-segment Display Driver Help — Parallax Forums

7-segment Display Driver Help

mcfaddymcfaddy Posts: 3
edited 2011-04-09 13:19 in Propeller 1
Hello, I have an MC14489B display driver that I'm trying to use in conjunction with the propeller chip to run 4 7-segment displays. Also, I'm using the Spin language. The displays are for a game in which 2 players are involved and I'll have two pairs each counting up from 00 to 20 or so.

I'm new to this, so any help would be greatly appreciated. I've gone through the manual for the chip and while most of it is Greek to me, I can't seem to find any way to set the mode for it (at least, I think that's why nothing's lighting up). Basically, I can't find whether it needs a mode sent to it before sending the digits to illuminate and if it does, I wouldn't know what mode to send it for this particular application.

I've tried to find examples in BASIC online, but haven't found anything that I could decipher. If anyone has any sample code in Spin, that would be awesome.

The datasheet for the driver can be found here: http://html.alldatasheet.com/html-pdf/97949/MOTOROLA/MC14489B/322/1/MC14489B.html

I've also attached it MC14489B.pdf.

Also, I don't have any experience in using two digits to represent one number (i.e., counting from 9 to 10 or from 19 to 20). Any suggestions of how to use the propeller chip and Spin language to do this would also be a plus.

Thank you!

Comments

  • tonyp12tonyp12 Posts: 1,951
    edited 2011-04-04 19:09
    First you would need send 1byte (8 serial data bits) to configure the driver. 11000000 I think would set all banks to hexdecode
    After that you need to send 20 serial bits for data, first 4 bits are all 1's
    and the other 16 bits are 4bits for each digit
    If you want a 'A' send 1010
    Don't use bank1 for your 4 led digits as your not sending the whole 24bits of data.
    If 24bit is required, just send 4 more zeros.

    set enable pin to 0
    for i=1 to 20
    set serial pin to 0 or 1
    set clk pin to 1
    set clk pin to 0
    next i
    set enable pin to 1
  • Zap-oZap-o Posts: 452
    edited 2011-04-04 19:47
    I think that for you to get some help you’ll need to post a schematic. Its tough to see what’s going on unless you provide a diagram of how this IC/s are wired up to the 7 segment, driver, resistors and the propeller.
  • tonyp12tonyp12 Posts: 1,951
    edited 2011-04-04 20:17
    The IC he is using have built-in multiplexer and pretty much only one way to use it.

    But could not hurt just to make sure he got that part right.
    And that it's a 5volt device, and input are trigged at 3.85v if Vdd is 5.5v
    maybe powering with 5v through a diode to get 4.3v
    and it could still run and triggering it's input at 3.3would be close.
  • mcfaddymcfaddy Posts: 3
    edited 2011-04-05 13:48
    Thanks tonyp, I'll try that out.
  • Pence128Pence128 Posts: 20
    edited 2011-04-05 17:07
    The chip determines addressing (configuration or data register) by counting the number of clocks between /enable low and /enable high, so you need the full 24 bits. If the other outputs are unused, the other bits don't matter except for the most significant. When low, this dims the leds.

    For a cheap level shifter, connect your 3.3V output (propeller) to the emitter of an npn transistor, pull the base up to 3.3V, pull the collector up to 5V and connect the collector to your 5V input. Cavet: this only works if your 3.3V logic high output level is greater than about 2.8V.

    Make sure /enable is driven, it's used for synchronization and and data is latched on the rising edge.

    The least significant bit of the config register is standby/blank. Make sure it's set.

    If you're programming in assembly, check your timings. Minimum pulse width for clk (high or low) is
    125us. For an 80Mhz prop, that's 3 instructions.
  • kuronekokuroneko Posts: 3,623
    edited 2011-04-05 17:12
    Pence128 wrote: »
    Minimum pulse width for clk (high or low) is 125us. For an 80Mhz prop, that's 3 instructions.
    I don't know about you but 3 (normal) instructions come down as 3*4*12.5ns = 150ns. What am I missing here?
  • Pence128Pence128 Posts: 20
    edited 2011-04-05 18:44
    Two instructions is 100us which is too short. You can't have 2.5 instructions.
  • kuronekokuroneko Posts: 3,623
    edited 2011-04-05 20:34
    Pence128 wrote: »
    Two instructions is 100us which is too short. You can't have 2.5 instructions.
    Wrong on both accounts but I'm not going to argue.
  • kuronekokuroneko Posts: 3,623
    edited 2011-04-06 17:07
    Apologies for going slightly OT.

    @Pence128: I had a look at the data sheet and the clock cycle times are given in nano seconds (ns) which should explain my confusion about you using us which is commonly used for micro seconds. Anyway, generating a 4MHz clock isn't a problem. The setup and hold times are more of an issue in case you want to combine clock and data transmission at max clock speed. But I believe the way this chip is going to be used will not suffer from a slightly slower clock :)
  • mcfaddymcfaddy Posts: 3
    edited 2011-04-09 11:34
    So I've gone through and tried most of the suggestions and I'm still unable to get anything to actually display. Here's the code I'm using:

    CON
    _xinfreq=5_000_000
    _clkmode=xtal1+pll16x

    enable=16
    clk=17
    data=18

    PUB Main | value, config, i
    dira[enable..data]~~
    outa[enable]~
    config:=%0000_0001
    value:=%1001_0000_0000_0000_0000_1001
    repeat i from 7 to 0
    outa[data]:=config>>i
    outa[clk]~~
    outa[clk]~
    outa[enable]~~
    outa[enable]~
    repeat i from 23 to 0
    outa[data]:=value>>i
    outa[clk]~~
    outa[clk]~
    outa[enable]~~

    The way I understand your comments and the data sheet, this should output the digit '9'. I've got only one digit hooked up at the moment and I have triple checked wiring. I've got 5V powering the chip, and 3.3V from the prop chip for enable, clk, and data in.
    Again, I'm new to this (programming and ICs in general), so any specific comments on my code or an example of what the correct code should be (to display any single digit) would be greatly appreciated. Google has so far failed me on providing code examples in Spin (which is the only language I can use at the moment), so I'm relying on you guys for help.

    Thanks.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-04-09 13:19
    First, shouldn't "value" and "config" be declared as VARs?

    PE -- There are a lot of SPIN examples in the Propeller Manual and the PEK Labs book, too. Those are free downloads from Parallax.
    Also, http://propeller.wikispaces.com/
Sign In or Register to comment.