tyty
electronics
Sunday, 30 March 2014
Saturday, 9 November 2013
c programming bacics.
STRUCTURE OF C PROGRAM
Documentation section
Header section /#include<stdio.h>,<math.h>
Main() function/main()
{
Declaration part/int,float,…a,b,c,d;
Executable part /scanf(“%d%d%d”,&a,&b,&c);
D=a/b;
Printf(“d=%d”,d);
}
DATA TYPE
Char –hold one character and occupies one byte of space(‘A’,’*’,’8’,)
Int - hold integral quantities. Occupies 2byte of space ( int p, q,r;)
Float –hold floating point number . Occupies 4byte of space(float avg,)
Double- hold double floating point number . Occupies 8byte of space(float side, width;)
KEY WORDS
Auto, extern ,size of, break , floatn , static ,case, for, struct ,char, goto, switch,
Const,it,typedef,continue,int,union,default,long,unsinged,do,register,Void ,double ,return ,volatile ,else ,short , while ,else ,enum, signed.
ESCAPE SEQUENCE
A black slash followed by such a special character is called an ESCAPE SEQUENCE
1. \a - bell
2. \b – back space
3. \t – horizontal tab
4. \v – vertical tab
5. \n – new line
6.\f – form feed
7.\r- carriage return
8. \”-double quote
9.\? - question mark
0.\o-null
OPERATORS IN C
Arithmetic operators
Addition +
Subtraction –
Multiplication *
Division /
Modules % - reminder of operana1 divided by operand2
1.1 Relational operators
Equal ==
Greater than >
Less than <
Greater than or equal to >=
Less than or equal to <=
Not equal !=
1.2 Logical operator
AND &&
OR ||
NOT !
1.3 Assignment operators
Identifier = expression;
Identifier - represent a variable(x=7,p=q;)
Expression - represent a constant(x=y=4)
1.4 Increment and Decrement operators
Increment (++)
Decrement (--)
1.5 Conditional operator
Expression1? Expression 2:Expression3
1.6 Bitwise operators
& AND
| OR
^ x or
~ 1’s complement
>> shift right
<< shift left
1.7 special operators
Comma operator
Size of operator
Pointer operator
Member selection operator
HEADER FILES
#include<stdio.h>
The imprortant library functions covered by stdio.h header file are;
gets()
getchar()
put()
putchar()
scanf()
print()
READING A CHARACTER
getchar()
getche()
getch()
getc()
INPUT/OUTPUT FUNCTIONS
scanf()
printf()
programming
1.program to print name;
#include<stdio.h>
main()
{
clrscr();
printf(“INTO MAN\n”);
printf(“nest (h)\n”);
getch();
}
DECISION MAKING
if
if(expression)
statement
1.2 if-else
If (expression)
statement -1
else
statement -2
1.3 nested if
If (expression-1)
If (expression-2)
Statement -1
else
statement -2
else
if (expression-3)
statement-3
else
statement-4
1.4 go to
switch
LOOP STRUCTURES
while loop
while(expression)
statement
do-while loop
do
statement;
while(expression);
for loop
for((expression-1;expression-2;expression-3; statement;
while loop
-loop continuations conditions is checked at the beginning
-if the loop condition fails statement will not be executed at all
Do-while
-continuation condition is checked at the end
-statement will be executed at least ones
GLOBAL AND LOCAL VARIABLES
variables which are declared before the beginning of a function is called is called global variables. variables which are declared inside a function is called is called local variables
FUNCTION CALL
Function-name(argument-list);
Category of functions
functions with argument and return value.
functions with argument and no return value.
functions with no argument and no return values.
passing arguments to functions
call by value
call by references
ARRAYS
The individual data items in an array a are called array elements
1.1 ONE-DIMENSIONAL ARRAYS
data –type array name [expression];
1.2 TWO-DIMENSIONAL ARRAYS
Type array –name [row_ size] [column _size];
MULTI DIMENSIONAL ARRAYS
Array whose elements are specified by three or more subscripts are called multi dimensional arrays.
Data-type array-name[expressions1] [expressions2]…[expression3]
DYNANIC ARRAYS
Allocate memory to array at run time know as dynamic memory allocations and the arrays created at run time is called dynamic arrays.
STRING ARRAYS
A String is a group of characters .string is stored in an array of characters.
Char string-name[size];
STRUCTURES
A structure is collection of data item or variables of different data –types that is referenced under the same name
Struct tag-name
{
Data-type member1;
Data-type member2;
…………………………….
……………………………..
Data-type member n;
};
Unions
A union is syntactically the same as a structure .union is a construct that allows different type of data items to share the same block of memory,
union tag –name
{
member1;
member2;
…………….
……………..
};
Pointers
The variables that holds the address of a data item is called pointer.
Data-type*ptVar;
Malloc ()
Malloc() function is one of the most commonly used functions which permit allocation of memory form the pool of free memory. This function reserves a block of memory of specified size and returns a pointer of type void.
Ptr=(cast-type*)malloc(byte-size);
Ptr is pointer of type cast-type.
Calloc()
Calloc function is used for requesting memory space at run time for storing derived data type such as arrays and structure. While malloc() function allocates a single block of strong space ,calloc() allocates multiple block of storage, each of same size, and then sets all bytes to zero
Ptr=(cast-type*)calloc(n,elem-size);
STREAM
A stream is a sequence of byte of data .A sequence of byte following in to a program is an input stream and a sequences of byte flowing out of a program is an output stream.
TYPES OF FILES
. Standard (stream oriented)I/O text files
. Standard (stream oriented)I/O binary files
. Standard (stream oriented)I/O files.
OPENING A DATA FILE
FILE*ptvar;
Ptvar=fopen(“file name”,”mode);
CLOSING A DATA FILE
fclose (ptvar);
fprintf()and fscanf()
These functions are formatted i/o functions used to input/output the formatted data items .These functions can also handle a group of mixed data simultaneously ,fprintf and fsacnf functions behaves exactly like printf and scanf functions except that they operate with disk fils.
fprintf ( fp” control string”, argument list);
fscanf ( fp” control string”, argument list);
Documentation section
Header section /#include<stdio.h>,<math.h>
Main() function/main()
{
Declaration part/int,float,…a,b,c,d;
Executable part /scanf(“%d%d%d”,&a,&b,&c);
D=a/b;
Printf(“d=%d”,d);
}
DATA TYPE
Char –hold one character and occupies one byte of space(‘A’,’*’,’8’,)
Int - hold integral quantities. Occupies 2byte of space ( int p, q,r;)
Float –hold floating point number . Occupies 4byte of space(float avg,)
Double- hold double floating point number . Occupies 8byte of space(float side, width;)
KEY WORDS
Auto, extern ,size of, break , floatn , static ,case, for, struct ,char, goto, switch,
Const,it,typedef,continue,int,union,default,long,unsinged,do,register,Void ,double ,return ,volatile ,else ,short , while ,else ,enum, signed.
ESCAPE SEQUENCE
A black slash followed by such a special character is called an ESCAPE SEQUENCE
1. \a - bell
2. \b – back space
3. \t – horizontal tab
4. \v – vertical tab
5. \n – new line
6.\f – form feed
7.\r- carriage return
8. \”-double quote
9.\? - question mark
0.\o-null
OPERATORS IN C
Arithmetic operators
Addition +
Subtraction –
Multiplication *
Division /
Modules % - reminder of operana1 divided by operand2
1.1 Relational operators
Equal ==
Greater than >
Less than <
Greater than or equal to >=
Less than or equal to <=
Not equal !=
1.2 Logical operator
AND &&
OR ||
NOT !
1.3 Assignment operators
Identifier = expression;
Identifier - represent a variable(x=7,p=q;)
Expression - represent a constant(x=y=4)
1.4 Increment and Decrement operators
Increment (++)
Decrement (--)
1.5 Conditional operator
Expression1? Expression 2:Expression3
1.6 Bitwise operators
& AND
| OR
^ x or
~ 1’s complement
>> shift right
<< shift left
1.7 special operators
Comma operator
Size of operator
Pointer operator
Member selection operator
HEADER FILES
#include<stdio.h>
The imprortant library functions covered by stdio.h header file are;
gets()
getchar()
put()
putchar()
scanf()
print()
READING A CHARACTER
getchar()
getche()
getch()
getc()
INPUT/OUTPUT FUNCTIONS
scanf()
printf()
programming
1.program to print name;
#include<stdio.h>
main()
{
clrscr();
printf(“INTO MAN\n”);
printf(“nest (h)\n”);
getch();
}
DECISION MAKING
if
if(expression)
statement
1.2 if-else
If (expression)
statement -1
else
statement -2
1.3 nested if
If (expression-1)
If (expression-2)
Statement -1
else
statement -2
else
if (expression-3)
statement-3
else
statement-4
1.4 go to
switch
LOOP STRUCTURES
while loop
while(expression)
statement
do-while loop
do
statement;
while(expression);
for loop
for((expression-1;expression-2;expression-3; statement;
while loop
-loop continuations conditions is checked at the beginning
-if the loop condition fails statement will not be executed at all
Do-while
-continuation condition is checked at the end
-statement will be executed at least ones
GLOBAL AND LOCAL VARIABLES
variables which are declared before the beginning of a function is called is called global variables. variables which are declared inside a function is called is called local variables
FUNCTION CALL
Function-name(argument-list);
Category of functions
functions with argument and return value.
functions with argument and no return value.
functions with no argument and no return values.
passing arguments to functions
call by value
call by references
ARRAYS
The individual data items in an array a are called array elements
1.1 ONE-DIMENSIONAL ARRAYS
data –type array name [expression];
1.2 TWO-DIMENSIONAL ARRAYS
Type array –name [row_ size] [column _size];
MULTI DIMENSIONAL ARRAYS
Array whose elements are specified by three or more subscripts are called multi dimensional arrays.
Data-type array-name[expressions1] [expressions2]…[expression3]
DYNANIC ARRAYS
Allocate memory to array at run time know as dynamic memory allocations and the arrays created at run time is called dynamic arrays.
STRING ARRAYS
A String is a group of characters .string is stored in an array of characters.
Char string-name[size];
STRUCTURES
A structure is collection of data item or variables of different data –types that is referenced under the same name
Struct tag-name
{
Data-type member1;
Data-type member2;
…………………………….
……………………………..
Data-type member n;
};
Unions
A union is syntactically the same as a structure .union is a construct that allows different type of data items to share the same block of memory,
union tag –name
{
member1;
member2;
…………….
……………..
};
Pointers
The variables that holds the address of a data item is called pointer.
Data-type*ptVar;
Malloc ()
Malloc() function is one of the most commonly used functions which permit allocation of memory form the pool of free memory. This function reserves a block of memory of specified size and returns a pointer of type void.
Ptr=(cast-type*)malloc(byte-size);
Ptr is pointer of type cast-type.
Calloc()
Calloc function is used for requesting memory space at run time for storing derived data type such as arrays and structure. While malloc() function allocates a single block of strong space ,calloc() allocates multiple block of storage, each of same size, and then sets all bytes to zero
Ptr=(cast-type*)calloc(n,elem-size);
STREAM
A stream is a sequence of byte of data .A sequence of byte following in to a program is an input stream and a sequences of byte flowing out of a program is an output stream.
TYPES OF FILES
. Standard (stream oriented)I/O text files
. Standard (stream oriented)I/O binary files
. Standard (stream oriented)I/O files.
OPENING A DATA FILE
FILE*ptvar;
Ptvar=fopen(“file name”,”mode);
CLOSING A DATA FILE
fclose (ptvar);
fprintf()and fscanf()
These functions are formatted i/o functions used to input/output the formatted data items .These functions can also handle a group of mixed data simultaneously ,fprintf and fsacnf functions behaves exactly like printf and scanf functions except that they operate with disk fils.
fprintf ( fp” control string”, argument list);
fscanf ( fp” control string”, argument list);
Computer Basics.
The word computer comes from the word compute which means to calculator so computer is normally considered to a calculating device, which perform arithmetic operations at enormous speed .It is a programmable machine. This means it can execute a programmed list of instructions and respond to new instructions that is given.
computer generations
ENIAC-Electronic Numerical Integrate and calculator.
EDVAC- Electronic Discrete variables automatic computer.
UNIVAC- Universal Automatic Computer.
BINAC- Binary Automatic Computer.
Functional block of computer
Input
Memory
Arithmetic And Logic
output
Control unit
Classifications of computer
Micro computer
Mini computer
Mainframe
Super computer
Mother Board
Mother board is the largest circuit board inside the computer .It contains the computer’s C.P.U (central processing unit), memory (RAM and ROM) and various support chips for C.P.U.
Motherboards divisions
Bus Based computers
Single Board Based Computer
Motherboard components
Processor Area
Memory Area (RAM and ROM)
Expansion Slot Area
Peripheral Area
PROCESSOR SOCKET ARCHITECTURE
SMT – Surface mounting Technology.
DIP -- Dual In-line pin.
PLLC -- Plastic Leadless chip cartridge.
LIFA -- Low insertion force Architecture.
ZIFA -- Zero Insertion Force Architecture.
Co-processor
Co-processor is a special purpose microprocessor used to speed up main processor by taking over some of the main processor work.
Most common type of co-processor are-
Math co-processor
Graphic co- processor
FLASH MEMORY
A new type of EEPROM (Electrically Erasable programmable Read Only memory) that can be erased and reprogrammed using the normal operating voltage found inside the pc is called flash memory.
PHYSICAL ORGANISATION OF MEMORY
SIPP – Single In line Pin Package.
DIPP -- Dual In line Pin Package.
SIMM – Single In line Memory Module.
RIMM – Rambus In line Memory Module.
EXPANSION SLOT AREA
ISA -- Industrial Standard Architecture.
EISA – Extended Industrial Standard Architecture.
MCA – Micro Channel Architecture.
VESA --Video Electronics Standard Association.
PCI -- Peripheral component Interconnect.
AGP—Accelerated Graphics Port .
USB—Universal Serial Bus.
AMR—Audio Modem Riser.
CNR—Communication Network Riser.
IEEE –Institute of Electrical and Electronic Engineers.
PERIPHERAL ARE
Peripheral refers to any external device connected to computer
Key board Interface
DIN – Deutsche Industrial Norm
5 pin connector
Ps/2 – personal system
6 pin connectors
It is a mini DIN
USB
Mouse interface
Ps/2
Serial -9 pin ,Dsaped,female,2row
USB
I/O ports
parallel port
No. of pins – 25
No. of rows- 2 row
Type- Female
Serial port
COM 1 – 25 PIN
COM2 - 9 PIN
FDD Connector(FLOPPY DISK DRIVE)
IDE Standard
34 pin
HDD connector (HARD DISK DRIVE)
IDE controller
IDE 1 (master slave)
IDE 2 (master slave)
IDE controller supports 2 device. Total 4 device support.
Display adaptor
15 pins
3 row
D shaped
Female connector
Game/Midi port
15 pin
2 row
D shape
Female connector
NIC-(Network Interfacing card)
RJ 45 connector is used
USB
IEEE
Bus Mastering
Bus mastering allow the peripheral devices to take the control of the bus form the cpu for a short time. Using this facility the devices can transmit or receive large blocks of data in a short burst modes.
Motherboard form factor
The form factor of mother board determines the specifications for its shape and size. It is the physical size and dimensions of the mother board.
AT-advanced technology
BABY AT
ATX
MICRO ATX
CD (Compact Disk)
A CD mode of
1.2 millimeter thick
Poly carbonate plastic used
Weight 15-200gram
DVD (DIGITAL VERSATILE DISC DIGITAL VIDEO DISC)
12 cm type is standard DVD
BLUE RAY DISC
The capacity of this type of disk is 25GB to 50GB for single layer and double layer disks respectively. These are once writable disks. It is suitable for back up/archival memory. Its data transfer rate is 72mbps.
BOOTING
This process of loading the operating system (OS) from devices into the computer’s memory is called booting of the computer’s memory is called “Booting Of the computer”
Booting 3 TYPEs
Local Booting – Floppy ,CD.
Normal Booting-Hard disk.
Remote Booting-network.
3 files are needed for booting
I/O
MS DOS
COMMAND.COM
ROM SHADOWING
The shadowing procedure copies the ROM into RAM and then assigns that ram the same address as the ROM originally used, disabling the actual ROM in the process. This makes the system seem as through it has ROM running at the same speed as RAM.
Duties of OS
I/o management
Memory management
File management
User management
PARTITION
primary dos partition
extended dos partition
Partitioning is basically done for having more than one operating system on the same drive and more than one logical drive when a disk is partitioned the partition program FDISK write a MBR(Master Best Record).
The FDISK program enables us to create two FAT partitions.
a primary DOS partitions.
an extended DOS partitions.
FORMATTING
TO use a floppy disk and only one formatting is required, where as a hard disk drive required a low level and high level formatting to make it useful for data storage.
A high level formatting is done on the hard disk to make the disk dos compatible by writing DBR, FATs and the empty root director entry information on the drive.
A low level formatting does the job of magnetically dividing the disk into tracks and sectors.
VIRUS
Computer virus is a self – replacing piece of computer code that can partially or fully attach to computer files or applications.
General Virus Type
Boot Sector Virus
File virus
Macro virus
Multiple virus
Polymorphic virus
Stealth virus
BIOS
BIOS is term that stands for basic input output system.
Basic functions of BIOS
INITIALIZATION.
POST [POWER ON SELF TEST]
BSL [BOOT STRAP LOADER]
INITIALIZATION
It initialise all the peripherals which is connected to the system.
POST
The POST test your computer processor , memory , chipset , video adapter, disk controller, disk drives, keyboard and other circular components. It is set of program loaded from the BIOS ROM during the system power on time. This system ensure that all major system components are present and are working properly. After POST process if everything is functioning properly then BIOS loads the operating.
POST- Error checking devices in motherboard.
ERROR
Fatal error
Non fatal error
Post sequences
Processor Test
Bios Rom Test
Timer 1 test
DMA channel 0 Test
Base 16K DRAM Test
CRT Controller Test
Mother board support Chip Test
RAM Test
Optional Rom test
Peripheral controller Test
BSL (BOOT STRAP LOADRE)
After the POST,BIOS contains a program called bootstrap loader.
Subscribe to:
Posts (Atom)