Results 1 to 2 of 2

Thread: Logical Gates

  1. #1
    lingz89 is offline Member
    Join Date
    Aug 2009
    Posts
    1
    Rep Power
    0

    Default Logical Gates

    Hi, I'm struggling with the topic of logical gates so I hope someone can help me out.
    I'm having trouble with the following:
    - boolean expressions, De Morgan Law and expressing terms in NOR/NAND only.
    - designing circuits
    - implementing circuits with given inputs/outputs (4 bit adder?)

    An example of the question I'm struggling on would be:

    'Write boolean expressions and design a ciruit with three inputs and one output such that the output is 1 if and only if two or more inpurs are 1.'

    Help appreciated, I'm finding this topic so confusing.

  2. #2
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    little sample:
    Java Code:
    public static boolean andGate(boolean in1, boolean in2){
      if(in1 && in2) 
        return true;
      return false;
    }
    
    public static boolean orGate(boolean in1, boolean in2){
      if(in1 || in2) 
        return true;
      return false;
    }
    the int version would be:
    Java Code:
    public static int andGate(int in1, int in2){
      if(in1==1 && in2==1) 
        return 1;
      return 0;
    }
    
    public static int orGate(int in1, int in2){
      if(in1==1 || in2==1) 
        return 1;
      return 0;
    }
    Now you would do something similar for NOR/NAND using three inputs.
    check out wikipedia for the truth table, it'll help you out.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

Similar Threads

  1. Replies: 3
    Last Post: 03-08-2009, 01:51 AM
  2. Java + OOP + Logic Gates = HELP!
    By sev51 in forum New To Java
    Replies: 3
    Last Post: 01-26-2009, 08:42 PM
  3. Logical JDBC problem
    By nick2price in forum Advanced Java
    Replies: 3
    Last Post: 10-02-2008, 11:34 PM
  4. Listing Logical Drives
    By Juggler in forum New To Java
    Replies: 3
    Last Post: 08-10-2008, 07:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •