Essential Fundamentals of Programming

For understanding how computers work, let's first look at a block diagram. The CPU has 2 parts an ALU and a CU. Then there's a main memory, hard disk, then there's input device (keyboard, mouse) and then the output device (monitor, printer, speaker). The heart of the computer is the CPU, which The microprocessor. This processor has arithmetic logic unit and control unit. Arithmetic Logic Unit can perform logical units, such as addition, subtraction, multiplication, division, and modulus. There are other things connected for controlling all these things, or utilizing them, and we have a separate portion called control unit, to utilize other resources. 

The hard disk will contain files, either program files or data files. A notepad on the PC is a program file. Basically we click on some icon and the program will start, and somewhere we can find a program for notepad/etc. Inside notepad, typing something will save it as a text file. .data file will generate a file for a notepad. Audio and music files, video files are data files and any application file is a program files.

A program should be in main memory so CPU can execute it. CPU can execute the program by picking instructions line by line, bought inside by the main memory. If the program needs something from the monitor, then it can use the input device or output device. There is interactivity in the program that you can find out in the output device through the monitor. The input and output device both have a memory, with an input buffer and an output buffer. A program will dump everything in the output buffer, which will then appear in the screen. 

The program needs to bought into the main memory, and the CPU executes line-by-line and the program requires to interact with user, it uses input and output devices. 


Low voltage is taken as 0, and high voltage is taken as 1. Suppose you have a bulb. We treat the bulb as 1 if on and 0 if it off. I/C is integrated circuit, or known as a chip. We can pass some voltage through these chips. 8 binary bits are 1 byte, and all the bits are 0. There can be many combinations of bits (00000001, 10110011, etc.). Electronic circuitry and using voltages can get some communications, go or stop, open or close, etc. If you have 2 bulbs, you can have 4 combinations (00 01 10 11). So 2^n different possibilities based on n bulbs (but I'm sure that most of you already know that ;).

The computer system goes on binary number system with many different pins and each pins you can assume it's a bulb with many different commands. The same way the CPU was built up on messages that is low and high voltage that is high and off.  We are not comfortable with binary. Decimal number is just ∑ from i = 1 to n of digit * 2^i. There are predefined instructions that are logically designed to work on commands. We write the programs to the main memory in the form of binary. The computer works in the binary system based on the electronic signal. 

Decimal we have 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16. 

Binary we have 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111.

Octal we have 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20. 

and Hex we have 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10.



Comments

Popular Posts