Click here to Skip to main content
15,888,579 members
Articles / Programming Languages / C
Article

Logic Circuit Testing Tool

Rate me:
Please Sign up or sign in to vote.
1.07/5 (30 votes)
6 Apr 20044 min read 70.6K   19   12
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


Written By
Program Manager
India India

"DEEPAK" actually means an earthen lamp which is the light source for poor people in dark. "Deepak" also means the 'Light of Hope'.


Dr. Deepak Jain, is currently working with a leading (rated among top four) IT Outsourcing Company in India. He completed his Bachelor of Technology in Electronics and Communication Engineering from Institute of Engineering and Technology, Kanpur, India followed by Master of Technology in Computer Science and Engineering from C-DAC, Noida, India.


A Ph. D. in Information Systems, Dr. Jain is author of more than 30 research papers and articles published in different journals and editorials of National and International repute. Dr. Jain has also authored two books on Software Engineering Principles one of which is published with BPB Publications, one of the largest publishers in Asia and the other is published with Oxford University Press (Higher Education), one of the most reputed International publishers. He is writing many more titles for leading names in publishing.


Dr. Jain has worked for many software development projects for planning, development and management roles. Dr. Jain is a Life Associate Member of Computer Society of India and a member of ACM Special interest Group of Software Engineering.


Together with being an active academician and researcher Dr. Jain also maintains his contribution to social responsibilities. He is a member of Indian Red Cross Society and All India Crime Reformation Organization (AICRO) just to name his touches to social responsibilities.


Deepak lives in Delhi (capital of India) and People who loves him call him "Sanju", which is a symbol of naughtiness.


Comments and Discussions

 
GeneralPort protection Pin
cachimbu9-Feb-05 15:06
cachimbu9-Feb-05 15:06 
LPT ports are protected by NT-based Windows. Even so if TurboC runs on Windows NT/2000/XP/2003, the first time you try to access port 0x378 (using inport..) a dialog box will appear saying that "has executed an invalid operation". On Intel processors, the instruction to access ports (INx znd OUTx) are reserved for "Ring 0" code. TurboC is running under Windows in a "Virtual Machine", that runs in "Ring 3". Any attempt to execute Ring 0 instructions in ring 3 will cause a Processor Exception that Windows will catch and terminate the application.

You must use a kernel-mode (which is ring 0) driver in NT-based systems to permit access to the ports.

In the long run, switch to Windows and use USB or Firewire.



Ricardo
GeneralSPP-ISA Pin
Eguru21-Jan-05 23:26
Eguru21-Jan-05 23:26 
GeneralHmmm, it's growing better ;) Pin
Kochise6-Apr-04 20:48
Kochise6-Apr-04 20:48 
GeneralA Good Start Pin
Roger Wright19-Mar-04 14:21
professionalRoger Wright19-Mar-04 14:21 
GeneralGoto... Pin
Ray Hayes19-Mar-04 9:14
Ray Hayes19-Mar-04 9:14 
GeneralRe: Goto... Pin
RedZenBird7-Apr-04 5:21
RedZenBird7-Apr-04 5:21 
GeneralRe: Goto... Pin
WREY9-Apr-04 10:36
WREY9-Apr-04 10:36 
GeneralWhere do I start... Pin
Ryan Binns18-Mar-04 22:44
Ryan Binns18-Mar-04 22:44 
GeneralRe: Where do I start... Pin
Deepak Jain18-Mar-04 23:22
Deepak Jain18-Mar-04 23:22 
GeneralYou're a child, nothing really wrong ;) Pin
Kochise19-Mar-04 6:45
Kochise19-Mar-04 6:45 
GeneralRe: You're a child, nothing really wrong ;) Pin
Deepak Jain22-Mar-04 20:42
Deepak Jain22-Mar-04 20:42 
GeneralAnd you're about to get... Pin
Kochise23-Mar-04 3:30
Kochise23-Mar-04 3:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.