Discover how a calculator works - Complete electronics explained

  We have all used calculators. I have often wondered how these small hand-held devices perform such difficult tasks in seconds. So, I decided to explore and write in detail about how a calculator works. 


First, let us get some of our electronics basics clear for dummies like me. 


A pen, a grey calculator, and a notepad


Transistor

In a calculator, a transistor acts as a switch. 


How does a transistor act as a switch?


A transistor can operate in three regions - active, saturation, and cut-off region. 


Cut-off region: There is zero input and zero output voltage. The transistor is OFF. 


Saturation region: The input and output current is high. The transistor is ON. 


We use the transistor in cut-off mode and saturation mode to use it as a switch. 


In the active mode, the transistor acts as an amplifier, not a switch. 


We represent an ON transistor as ‘1’ as an ‘OFF’ transistor as ‘0’.


What happens when you try to do 2+2 in a calculator?


2 is a ‘decimal number’. It has a binary equivalent, ‘10’. We can represent all decimal numbers as ‘0s’ and ‘1s’. 


What happens when you press ‘2’ on a calculator?

Calculator understands only binary numbers (0’s and 1’s). So, the first transistor gets ON (1). The second transistor gets OFF (0). So, the calculator receives and input ‘10’ (the binary equivalent of 2). 


Electronics behind a calculator



What happens when you press ‘+’ on the calculator?

The calculator stores ‘10’ input into a register and accept the addition function. It is ready to receive new input. 


What happens when we press the ‘=’ key?

The calculator performs the addition and displays the output. But, there is lots more to it. Let us get into the details. 


Binary adders perform the calculations in calculators. Binary adders are of two types: Half-adder and full-adder. 

 

How does a half adder work?


Half adder circuit in electronics


A half-adder has two gates: AND gate and XOR gate.


AND gate


Both inputs have to be 1 for the output to be 1.

If at least one of the inputs is 0 then the output is 0. 


XOR gate


If both inputs are similar (both inputs are 0 or both inputs are 1) then the output of the XOR gate is 0. 

If the two inputs are different then the output of the XOR gate is 1.


Let us see how the half-adder circuit does simple additions.


Input A=0, B=0


S is the output of the XOR gate. Both inputs are similar so Sum (S)= 0.

C is the output of the AND gate. Both inputs are 0 so Carry (C) = 0.


It is correct because we add two zeroes to get a zero. And, there is no carry to add to the next number if we enter the third number for addition.


Input A=1, B=0


S is the output of the XOR gate. Both inputs are different so Sum (S) = 1.

C is the output of the AND gate. One input is 0 so Carry (C) = 0.


It is correct because we add zero and one to get a one. And, there is no carry to add to the next number if we enter the third number for addition.


Input A=1, B=1


S is the output of the XOR gate. Both inputs are similar so Sum (S) = 0.

C is the output of the AND gate. Both inputs are 1 so Carry (C) = 1.


It is correct because we add one-two times to get a two (10 in binary form). And, the unit's place digit is 0, and carry is 1 if the third number is added.


How does a full adder work?

A full adder is a bit more complicated than a half adder. Please be patient as I break down the concepts for you. 


Two half adders form a full adder circuit diagram


We have three inputs in a full adder. 


First half adder


Adds inputs A and B. 

There is a sum (S) and a carry (C-Out). 


Second half adder


Adds inputs  S (sum from first half adder) and C-in (the third input). 

It gives a sum (Sum) which is the final sum of the full adder. 

And, it gives a carry C-Out. 


OR gate


The input of the OR gate is C-Out from the two half adders. 


The function of the OR gate


If at least one input of the OR gate is 1, the output is 1. 

The output of an OR gate is 0 only if both inputs are 0.


So, the full adder will give an output of 1 if anyone or both of the C-Out becomes 1. 


We have seen how we can add one-bit numbers using full adders. What if we want to add a number of higher bits. Let us see how we would do it with pen and paper. 


Addition of binary numbers in calculator


To know more about binary additions, click here


Now notice how the full adders provide the sum and carry the C-Out of the first full adder as C-in in the next full adder.


6 full adder circuit to add a 6 bit number


The calculator can perform subtraction like it performs addition. It performs multiplication and division by repeated addition and subtraction.


The output display of calculator


The calculator has an LCD display. When the computer uses less number of pixels, the image looks grainy. For better image quality, the computer uses thousands of times more pixels.


A calculator shows a very less number of pixels. It uses a bunch of bars to display the numbers. Different combinations of bars show different numbers.


Grey calculator displaying numbers



Loved what you read? Read more


Email me at subarnacreative@gmail.com.







Comments

Popular posts from this blog

Diary -24th July

How to make clip art faces-Part 1: Pretty girl face with braided hair decorated with flowers

Object oriented programming in dart concepts