Theory of logic gates and how they work

Thread: Theory of logic gates and how they work

  1. grover2000's Avatar

    grover2000 said:

    Help Theory of logic gates and how they work

    Can anyone explain how logic gates are used in a computer?

    I understand how logic gates work, but cant relate it to how they work on a computer for example when the key is pressed how a computer would process that key press into an output on the screen using logic gates.

    Any help is greatly appreciated.

    Grover
     
  2. Teajunkie's Avatar

    Teajunkie said:

    Default Re: Theory of logic gates and how they work

    Magic!

    boolean logic. but what you should be asking is how does a CPU turn a key press into data or how does a CPU work!
    Last edited by Teajunkie; 15th November 2014 at 12:57 PM.
    My decal venture has taken over my dog tag business
    nice to be busy though.
    Instagram and twitter @mrteajunke.
     
  3. grover2000's Avatar

    grover2000 said:

    Default Re: Theory of logic gates and how they work

    Thank you for the correction, but is it possible for anyone to answer the modified suggested question or direct me to a resource?

    thanks in advance

    grover
     
  4. doughboy's Avatar

    doughboy said:

    Default Re: Theory of logic gates and how they work

    Google for alu basics. ALU is the arithmetic logic unit, and iirc it was the first thing we learnt about in digital engineering.
     
  5. blacksheep's Avatar

    blacksheep said:

    Default Re: Theory of logic gates and how they work

    Operating system does most of that, the cpu (and this is just a random guess without checking anything) would be assembly so basically that can only move data, and/or/not etc so you'll have the inputs from the keyboard get an ascii value which is displayed.
     
  6. dpSparhawk's Avatar

    dpSparhawk said:

    Default Re: Theory of logic gates and how they work

    [Only registered and activated users can see links. ]
     
  7. dpSparhawk's Avatar

    dpSparhawk said:

    Default Re: Theory of logic gates and how they work

    Plus some possible help on Logic Gates... [Only registered and activated users can see links. ]
     
  8. eXOBeX's Avatar

    eXOBeX said:

    Default Re: Theory of logic gates and how they work

    It's a tricky one to look at as one big "thing", it might help to break it into layers. "Top down design" is something I learned in college, and I suppose would sort of apply here as well (although we never had to design a circuit to print "hello world" on a screen, that's taking a BTEC computing course a bit far).

    You've got your high-level programming language that's doing all the "if this key is pressed, print this".

    That's been compiled into low-level machine code (assembly language) which will have a small set of commands that deal with things in much smaller steps. In this case wait until a key's pressed, grab the key code, print it (if it's printable) and wait for the key to be let go of before repeating the process:-
    Set data register 1 to address of start of display memory
    Rdkeystatus: Read data from keyboard status port into data register 2
    Compare data register 2 with xxx, where xxx has flags indicating key up, key down, etc. and jump to Rdkey if key down
    jump to Rdkeystatus
    rdkey: read data from keyboard data port into data register 2
    jump to WaitForLetGo if data register 2 less than 32 (in other words an unprintable character)
    copy data register 2 to address held in data register 1
    increment data register 1
    WaitForLetGo: Rdkeystatus: Read data from keyboard status port into data register 2
    Compare data register 2 with xxx, where xxx has flags indicating key up, key down, etc. and jump to WaitForLetGo if key down
    jump to Rdkeystatus
    That's very simplistic and doesn't deal with what happens when you run out of screen, but hopefully you get the picture.

    Now you get the nuts and bolts of these individual commands. If the processor receives an instruction code, depending on what the code is will depend on whether the processor needs to fetch the next one or two codes (containing the stuff it needs to work with, numbers to add for example) and what to do with it. That'll be microcode (Wikipedia has articles on it) that I know nothing about, that's what processor designers are for

    The next layer down from microcode will be the logic gates themselves, and below that the transistors that make up those gates.