+ Reply to Thread
Results 1 to 3 of 3

Thread: MC14489 7 segment display with multiple segments

  1. #1

    Default MC14489 7 segment display with multiple segments

    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.
    Last edited by ForumTools; 09-30-2010 at 06:55 AM. Reason: Forum Migration

  2. #2

    Default

    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
    Last edited by ForumTools; 09-30-2010 at 06:55 AM. Reason: Forum Migration

  3. #3

    Default

    Okay, got it to work.

    Here's my code:

    Code:
        CPU.writePin(enablePin,true);
        CPU.delay(10);
        CPU.writePin(serialDataPin,true);
        CPU.writePin(clockPin,false);
    
    
        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.writePin(enablePin,false);
        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.writePin(enablePin,true);
    
        CPU.delay(10);
    
    
        CPU.writePin(enablePin,false);
        CPU.shiftOut(serialDataPin, clockPin, 8, CPU.SHIFT_MSB, config<<8);
        CPU.writePin(enablePin,true);



    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.

    Karl
    Last edited by ForumTools; 09-30-2010 at 06:55 AM. Reason: Forum Migration

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts