• I got some new old stock (NOS) ICs, and before I used them and get puzzled why my circuitry does not behave as expected, I wanted to test them. It's a functional test, no timing test. Test is repeated as many times as specified. If at the end only the green LED (LED2) is on, then all tests were successful. If red LED (LED1) is on, then at least one test failed. If only the red LED is on, then all tests failed.

    The example here is the Motorola CMOS MC14512B - 8 Channel Data Selector.

    For details about the IC and the wiring see attached pictures. Codes and console output in second post.

    Edit 2023-03-28: This MC14512 got a versatile buddy in crime: Using Pico to test new old stock (NOS) IC - MC14599 - 8 Bit Addressable Latch


    3 Attachments

    • MC1415512wiring.png
    • MC14512_brief.png
    • picTestingMC14512_8ChannelDataSelector.jpg
  • Code for tester:

    The code uses a hybrid of declarative and procedural approach to perform the test. It uses the truth table to define a test 'matrix'. Each row defines the the inputs and encoded the expected output. The inputs to the IC to test are arranged/ encoded suitable to write to Espruino Pico pins by an array. Functions the use this data, apply the inputs as outputs, and do some additional iteration or variation of values. The results get written to the console. An output example is attached. Enhancements would be to power the IC and run the test on BTN1 press.

    Note the 'renaming' of the pico pins to drive the IC: the Pico 'are named' for the Chip to test - C w/ chip's pin function Name - to make it obvious what is going on in the code.

    // MC14512_8CH_SEL.js
    // 20230311ao
    //
    // Using pico to test NOS MC14512B 8-Channel Data Selector
    //
    
    var lon = true; // false; // true; // logging is on
    function log() { if (lon) { console.log.apply(console,arguments); } }
    
    // wire connections
    //  ic - pico
    var CX0=A0, CX1=A1, CX2=A2, CX3=A3, CX4=A4, CX5=A5, CX6=A6, CX7=A7
      , CDIS=B1, CINH=B10
      , CSA=B13, CSB=B14, CSC=B15
      , CZ=A10 
      , CX = [CX7, CX6, CX5, CX4, CX3, CX2, CX1, CX0]
      , CS = [CSC, CSB, CSA]
      , CC = [CINH, CDIS]
      ;
    
    function setPinModes() {
      // driving the chip controls
      pinMode(CINH,"output");
      pinMode(CDIS,"output");
      // driving the channel address lines
      pinMode(CSA,"output");
      pinMode(CSB,"output");
      pinMode(CSC,"output");
      // driving the 8 channel inputs
      pinMode(CX0,"output");
      pinMode(CX1,"output");
      pinMode(CX2,"output");
      pinMode(CX3,"output");
      pinMode(CX4,"output");
      pinMode(CX5,"output");
      pinMode(CX6,"output");
      pinMode(CX7,"output");
      // reading the chip output (preset)
      pinMode(CZ,"input");
    }
    
    // truth table (MSNib = channel #, LSNib = INH,DIS)
    var tt = 
    [[0x00,  1] // X0 - channels 0..7, inputs
    ,[0x10,  2]
    ,[0x20,  4]
    ,[0x30,  8]
    ,[0x40, 16]
    ,[0x50, 32]
    ,[0x60, 64]
    ,[0x70,128] // X7
    ,[0x02,  0] // 0 - inhibit
    ,[0x01, -1] // high imp - disable
    ,[0x03, -1] // high imp - disable
    ]
    ;
    
    function hex(v) { return ((v>15) ?
      hex(v>>4) : "")+"0123456789ABCDEF".charAt(v&15); } // hex...
    function hep(v,ds) { // hex, digits (w/ padding up to ds)
      return ("        "+hex(v)).substr(-ds); }
    function tvSplit(tv) { // split 
      return([tv[0]>>4, tv[0]&3, tv[1]]); }
    
    var tMax = 3 // test repetitions
      , tCnt = 0
      , passed, somePassed, someFailed
      ;
    
    var tester =
    { test: function() { // tester object (tool)
        log(++tCnt);
        for (var i=0; i<tt.length; i++) {
    //    log("["+hex(i)+"]");
          if (i<8) {         // --- channel X0..X7
            this.channel.apply(this,tvSplit(tt[i]));­
          } else if (i==8) { // --- 0 - inhibit
            this.inhibit.apply(this,tvSplit(tt[i]));­
          } else {           // --- high imp - disable ...
            this.disable.apply(this,tvSplit(tt[i]));­  // w/ inhibit 0|1
          }
        }
      }
    
    // test channel w/ channel select s, control, value
    , channel: function(s,c,v) {
        digitalWrite(CC,c);
        digitalWrite(CS,s);
        log("channel",hex(s),this.chkChan(1,v));­ 
        log("channel",hex(s),this.chkChan(0,v));­ 
      }
        
    , chkChan: function(b,v) {
        var va = ((b)?v:v^255)&255, n, p;
        digitalWrite(CX,va);
        pinMode(CZ, (b) ? "input_pulldown" : "input_pullup");
        n = digitalRead(CZ);
        passed &= (p = (n === b));
        return ((b)?"H ":"L ")+n+" "+hep(va,2)
          + ((p) ? " ok" : " FAILED");
      }
    
    // test inhibit on INH, (-DIS)
    , inhibit: function(s,c,v) {
        digitalWrite(CC,c);
        digitalWrite(CX,255);
        pinMode(CZ,"input_pullup");
        var p = true;
        for (var j=0;j<8;j++) {
          if (digitalRead(CZ)) {
            log("inhibit FAILED on channel ",j);
            p = false;
          }
        } if (p) log("inhibit ok");
        passed &= p;
      }
    
    // test disable on DIS
    , disable: function(s,c,v) {
        digitalWrite(CC,c);
        this.chkDis(c,255,0);
        this.chkDis(c,255,1);
        this.chkDis(c,  0,0);
        this.chkDis(c,  0,1);
      }
    
    , chkDis: function(c,v,r) {
        digitalWrite(CX,v);
        pinMode(CZ,(r)?"input_pullup":"input_pul­ldown");
        var p = true;
        for (var j=0;j<8;j++) {
          if (r !== digitalRead(CZ)) {
            log("disable w/ inhibit=",(c>>1)," val=",hep(v,2)
               ," FAILED on channel ",j);
            p = false;
          }
        } if (p) {
          log("disable w/ inhibit=",(c>>1)," val=",hep(v,2)," ok");
        }
        passed &= p;
      }
    
    }
    ;
    
    
    function onInit() {
      setPinModes();
      somePassed = false; someFailed = false;
      var tIId = setInterval(function() {
           LED1.reset(); LED2.reset();
           passed = true;
           tester.test();
           if (passed) {
             LED2.set(); somePassed = true;
           } else {
             LED1.set(); someFailed = true;
           }
           if (tCnt>=tMax) {
             clearInterval(tIId);
             if (somePassed) { LED2.set(); }
             if (someFailed) { LED1.set(); }
           }
        },750);
    }
    
    
    setTimeout(onInit,999); // dev only; remove before upload for save()
    

    Output:

    >
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v17 (c) 2021 G.Williams
    >
    1
    channel 0 H 1  1 ok
    channel 0 L 0 FE ok
    channel 1 H 1  2 ok
    channel 1 L 0 FD ok
    channel 2 H 1  4 ok
    channel 2 L 0 FB ok
    channel 3 H 1  8 ok
    channel 3 L 0 F7 ok
    channel 4 H 1 10 ok
    channel 4 L 0 EF ok
    channel 5 H 1 20 ok
    channel 5 L 0 DF ok
    channel 6 H 1 40 ok
    channel 6 L 0 BF ok
    channel 7 H 1 80 ok
    channel 7 L 0 7F 
    inhibit ok
    disable w/ inhibit= 0  val= FF  ok
    disable w/ inhibit= 0  val= FF  ok
    disable w/ inhibit= 0  val=  0  ok
    disable w/ inhibit= 0  val=  0  ok
    disable w/ inhibit= 1  val= FF  ok
    disable w/ inhibit= 1  val= FF  ok
    disable w/ inhibit= 1  val=  0  ok
    disable w/ inhibit= 1  val=  0  ok
    > 
    2
    channel 0 H 1  1 ok
    channel 0 L 0 FE ok
    channel 1 H 1  2 ok
    .....
    ...
    .
    
  • That's a really neat use of it! Thanks for posting the code up!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Using Pico to test new old stock (NOS) IC - MC14512 - 8 Channel Data Selector

Posted by Avatar for allObjects @allObjects

Actions