Shop OBEX P1 Docs P2 Docs Learn Events
MC14489 7 segment display with multiple segments — Parallax Forums

MC14489 7 segment display with multiple segments

joekarljoekarl Posts: 2
edited 2008-11-20 19:26 in General Discussion
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.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-11-20 09:46
    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 2008-11-20 19:26
    Okay, got it to work.

    Here's my 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
Sign In or Register to comment.