• Hello friends,

    thank you for you suggestions.

    console.log("start");
    //595 Pinput:
    /*
     1 = 2
     2 = 3
     3 = 4
     4 = 5
     5 = 6
     6 = 7
     7 = 8 = Decimal Point/ DP
     8 = GND
     9 = carryover, to Next 595's SER/Pin 14
    
    10 = SCL/CLR Rest, not used, flushing 32bit each time.
    11 = Clock/SRCLK/SRCK, SPI1 SCK, Pin B3
    12 = RCK/RCLK/LATCH/, SPI SS,Pin B6 via 10KOhm to Ground = Data Out
    13 = Output Enable, GND
    14 = Data/SER/SIN, SPI1 MOSI, Pin B5
    15 = 1
    16 = VCC 3,3V 330Ohm
    */
    
    //SS Pin = B6
    
    var sport  = 0b00000001;
    var one    = 48;   // "00110000";
    var two    = 91;   // "01011001";
    var three  = 121;  // "01111001";
    var four   = 116;  // "01110100";
    var five   = 109;  // "01101101";
    var six    = 111;  // "01101111";
    var seven  = 56;   // "00111000";
    var eight  = 127;  // "01111111";
    var nine   = 125;  // "01111101";
    var zero   = 63;   // "00111111";
    
    var z = [zero,one,two,three,four,five,six,seven,­eight,nine];
    
    digitalWrite([B6,B7],0);         // SS Pin to 0
    digitalWrite([B7],1);
    
    
    SPI1.setup({ mosi:B5, sck:B3, baud:100000, order:'msb' }); //SPI Setup
    
    var out = 0; // current Segment
    var i   = 0; // Value to Display
    
    var i1=0, i2=0, i3=0, i4=0;
    
    
    setInterval(function(){
      i++;
      if (i>999)i=0;
    
      if (i>999){
        i1 = Math.floor(i/1000);
      } else {
        i1 = 0;
      }
    
      if (i>99){
        i2 = Math.floor(i/100) % 10;
      } else {
        i2 = 0;
      }
    
      if (i>9){
        i3 = Math.floor(i/10) % 10;
      } else {
        i3 = 0;
      }
    
      i4 = i % 10;
    
      //SPI1.write(buf_off,B6); //flush only needed when not writing to all four segements
      SPI1.write([ z[i4], z[i3],z[i2],z[i1] ],B6);
      //SPI1.write([ sport, sport, sport ], B6); //to debug a segement 
    
    },100);
    

    I have chained three additional 74HC595 s. The problem with that solution is, that i have no clue how to bring all this wires to a PCB breadboard.

    I think i will have to do it the multiplexing way to avoid all this new cables.


    2 Attachments

About

Avatar for werty1st @werty1st started