Forum Update - Announcement about May 10th, 2018 update and your password.

MC14489 7 segment display with multiple segments

joekarljoekarl Posts: 2
In the stampworks experiment book, there is an example (#31) showing how to hook up all 5 of the 7 segment displays on the PDB. I've duplicated the circuit using the MC14489 multiplexer. The code for this example is written in pbasic and I was wanting to write the code using java and the javelin stamp. Everything is coming together smoothly, however, the MC14489 requires a shiftOut to it of 24 bits. From what I've seen the java command for shiftOut can only send 16 bits. Is there a way to send 24 bits with the shiftOut command? Can I do it in too shiftOut commands? (each of 12 bits) Or if not, how can I duplicate this example using the javelin stamp.


  • 3 Comments sorted by Date Added Votes
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited November 2008 Vote Up0Vote Down
    Yes, you can use multiple shiftOut(), for example 3x 8bits, or 2x 12bits, or 1x16 + 1x8
    Just remember that if you use MSBFIRST, that you must leftshift the data
    so the first bit to send is in bit position 15.

    regards peter
  • joekarljoekarl Posts: 2
    edited November 2008 Vote Up0Vote Down
    Okay, got it to work.

    Here's my code:

        data1 = (int)displayControl;
        data1 = (data1 <<4) + (int)seg4;
        data2 = (int)seg3;
        data2 = (data2 <<4) + (int)seg2;
        data3 = (int)seg1;
        data3 = (data3 <<4) + (int)seg0;
        CPU.shiftOut(serialDataPin, clockPin, 8, CPU.SHIFT_MSB, data1<<8);
        CPU.shiftOut(serialDataPin, clockPin, 8, CPU.SHIFT_MSB, data2<<8);
        CPU.shiftOut(serialDataPin, clockPin, 8, CPU.SHIFT_MSB, data3<<8);
        CPU.shiftOut(serialDataPin, clockPin, 8, CPU.SHIFT_MSB, config<<8);

    Where seg0-seg4 are the segments on the display.
    config is 8 bits that control which segments are on and whether they're using special hex codes.

    Thanks for the help.

Sign In or Register to comment.