Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Logic Circuit Testing Tool

0.00/5 (No votes)
6 Apr 2004 1  
The product of this project will give a tool in terms of software, capable of extracting a vigorous testing for a given digital module (which is a logical unit) under a mass production.

Introduction

The product of this project will give a tool in terms of software, capable of extracting a vigorous testing for a given digital module (which is a logical unit) under a mass production.

Today, we have lots of testing algorithms with us, efficient enough to give a reliable result with some bearable errors. But when we cannot afford even a single error in our product, we choose to perform a vigorous-testing on this product where all the possible input-output conditions are tested as per the specifications. In the scope of its software requirement specifications (SRS) document, we name the product as "logic circuit testing tool". This SRS explains the requirement and expectations of the system to be developed and its probable users.

Scope of the project

The logic circuit testing tool (LCTT), as developed, will derive a vigorous testing of a given circuit for a given input signal set (0 or 1) on its input pins. The system will create input patterns to be fed into the input lines of the circuit under test and captures the output from its output lines to create a truth table for the circuit. This communication between 'LCTT' software and the given circuit occurs through the 'LPT' port of the computer (D-25 printer port/Parallel Port).

Dependencies

  • Although the software will not be highly dependent on any type of computer-hardware. It will be capable to work on any PC-configuration higher than "386-intel", but the performance will be much faster on 'Pentium' configurations.
  • The software will first develop a database with a masterpiece that has already been assured to be a perfect one by manual testing. After that, the software compares the truth table for other pieces under test with the database. For any mismatch, the system reports for the faulty circuit.
  • The system will work only for the passive logic circuits, without any oscillators or power sources in them. The use of vibrators is also not involved.
  • The system treats the unit-under-test just as a black box and does not do anything inside it. It is concerned to the input and corresponding output relations only. Hence the two different circuits equivalent to each other in their I/O results will be treated equally. For example, if unit under test is working like an XOR gate, the system will not detect if it is a direct XOR-gate I.C. or is composed of NAND or NOR gates. The result will be based on end point truth tables only.

The product LCTT In brief

  • The product software interfaces with a masterpiece circuit (whose identical units are to be produced and tested), through the parallel port of computer to create a database truth table.
  • Then the other identical units are attached to the computer in prescribed manner on the parallel port and a new truth table is created for comparison with the database truth table.
  • For any mismatch, the unit is reported to be faulty.
  • The system software needs not to tell the cause or spot of the fault.
  • Separate modules for sequential and the non-sequential logic circuits.

User expectation/characteristics

  • The user of the system is expected to be trained to make proper connections as expected between the unit under test and the parallel port of the computer.
  • Any error in connection may lead to the failure of the system or faulty-results or even damage to the computer
  • A brief knowledge of parallel port of computer is desirable.
  • After making proper connections, the user is required to follow the instructions provided by the system itself.

The Connections

  • The input lines of the circuit under test are required to be connected to the output lines of the 'LPT' port of the computer (Pin numbers).
  • The output lines of the circuit under test are to be connected to the input lines of the parallel port of the system (Pin Numbers).

Logic Circuit Testing tool ( Program in C )

#include<stdio.h>

#include<dos.h>

#include<conio.h>

#include<math.h>


const LPTI=0x379;       //Parallel Input Port address 

const LPTO=0x378;    //Parallel Output Port address 


/*(if your comupter system has been configured with some other address for
parallel I/O ports, configure this software accordingly. You may check these
addresses from your cpntrol pannel).*/

int IL,OL;
char refdata[256],data[256];

void creatPanel()    
/*generates the front panel that is shown to the user on screan with
different informations on it every time the screen is refreshed.*/
{
    clrscr();
    textattr(10);
    gotoxy(1,2);
    cprintf("___________________________________________________________\n\r");
    gotoxy(10,3);
    textattr(20);
    cprintf("              Logic Circuit Testing Tool              \r\n");
    gotoxy(1,4);
    textattr(10);
    cprintf("--------------------------------------------------\n\r");
    gotoxy(35,25);
    cprintf("The tool is developed by Mr. Deepak Jain.");
}

//----------------------------------

/*The help screen generation for user in any case of query. here we may put
the documentation  relevant information for user to use the tool*/
//----------------------------------


void help()
{
    clrscr();
    creatPanel();
    gotoxy(2,6);
    printf("The Help..");

    /*here you can give some helping tips for the user reference...!!*/

    getch();
}

//----------------------------------

/*Creation of the reference data with a good piece of the circuit whose
identical circuits are to be manufactured. The tool here sends I/P signals to
this circuit & captures the O/P and hence generates a truth table in its
database automatically.*/
//----------------------------------


void refDataCreatA()
{
int i;
int j=1;
char c;
start:    clrscr();
    creatPanel();
    textattr(15);
    gotoxy(2,6);
    cprintf("Place a pretested circuit as the Reference Circuit on the
parallel port \n\r & press 'Enter'\r\n");

/*Pre tested means already had been tested by manual means to retain the
confidence in the circuit The tool will be command to test the other circuits
w.r.t this circuit only.*/

    textattr(10);
    gotoxy(2,9);
    cprintf("For help in any confusion press 'H'.");
    c=getch();
    clrscr();
    creatPanel();
    if(c=='h'|| c=='H')
    {
        help();
        goto start;
    }
    textcolor(9);
    gotoxy(2,6);
    cprintf("Enter the number of Input Lines in the circuit: ");     

    //number of I/P lines in circuit


    scanf("%d",&IL);
    gotoxy(2,8);
    cprintf("\n\rEnter the number of Output Lines in the circuit: ");

        //number of I/P lines in circuit


    scanf("%d",&OL);
    for(i=0;i<IL;i++)
    j=j*2;
    gotoxy(2,10);
    for(i=0;i<j;i++)
    {
        outportb(LPTO,i);
        delay(2);
        refdata[i]=inportb(LPTI);
    }
}

//----------------------------------

/*Now the tool strats testing the other circuits. The tool will send input
signals to these circuits, one at a time and capture their output signal.
This output is compare with the reference data as prepared in the last step.
If the two matchs, the circuit is assumed to be a correct one, else an error
message is displayed*/
//----------------------------------



void startTest()
{
    int result=1;
    int i;
    int j=1;
    for(i=0;i<IL;i++)
    j=j*2;
    gotoxy(20,15);
    for(i=0;i<j;i++)
    {
        outportb(LPTO,i);
        delay(2);
        data[i]=inportb(LPTI);
        if(data[i]!=refdata[i])    //indicates an error.

        {
            result=0;
            break;
        }
    }
    if(result==0)
    {
        textattr(132);
        cprintf("ERROR:");
        textattr(4);
        cprintf(" The placed circuit is FAULTY...!!!");
        getch();
    }
    else
    {
        textattr(138);
        cprintf("The placed circuit is O.K.");
        getch();
    }
    textattr(9);
    gotoxy(17,22);
    cprintf("To test another circuit press any key...!!");
    gotoxy(17,23);
    cprintf("To Exit press 'Esc'");
}

//----------------------------------

/*The main program that integrates the process...!!*/
//----------------------------------


void main()
{
char c;
start1:    creatPanel();
    textattr(15);

    gotoxy(2,6);
    cprintf("Press 'A' for automatic generation of reference data.");
    gotoxy(2,9);
    textattr(10);
    cprintf("For help in any confusion press 'H'");
    c=getch();
    if(c=='h' || c== 'H')
    {    help(); goto start1;}
    else if(c=='A' || c=='a')
    refDataCreatA();
    else goto start1;
start2:    clrscr();
    creatPanel();
    textattr(73);
    gotoxy(2,6);
    cprintf("    The Reference Data has been created.    \n\r");
    textattr(2);
    gotoxy(2,8);
    cprintf("Replace the circuit with the other which is to be tested\n\r
& press Enter.\n\r");
    textcolor(10);
    cprintf("\nFor help in any confusion press 'H'.\n\r");
    c=getch();
    clrscr();
    creatPanel();
    if(c=='h'|| c=='H')
    {
        help();
        goto start2;
    }
    startTest();
    c=getch();
    if(c!=27)
    goto start2;        //Repeat the process.

}


The author has taken his best efforts in preparing this document. The author makes no representation or warranties with respect to the accuracy or completeness of this document & specifically disclaims any implied warranties of fitness of the content for any specific purpose. The author takes no responsibilities for the success of work or expected outcome with the rules stated herein. The author will not be responsible and liable for any (financial or any other) gain or loss or any commercial damages.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here