26 March 2012

Basic Structure of a C++ Program


Now that you have seen variable declaration, C++ expressions, and the basic math operators, let’s take a quick look at the basic  structure of a C++ program. All C++ programs must have a main  function. This is where the program begins.A  function is one or  more statements grouped together in a logical manner to accomplish some goal under a common name. The following is a basic C++ program.
                     int main()
                     {
                        return 0;
                     }

                Now, this program will not do much—in fact, it won’t do anything  useful at all. It is, however, a valid C++ program. It has a main  function that returns an integer value. The main function is where all C++ programs start. This is the starting point for your entire  program. All main functions are required by the ANSI (American  National Standards Institute) standards to return an integer. The integer is a 0 if the program executes fine, and a 1 if some problem is encountered. This was originally done because some operating  systems require any program to return a value telling the operating system that everything is OK. You will see a lot of Windows  programmers use a main function that returns a void like the following.

void main()

                This will work in some cases, but it is not technically correct.  This book endeavors to conform to the ANSI standards and use
return 0.

                The next thing to notice about our sample program is the  presence of brackets. These brackets are C++’s way of establishing borders around any block of code. (Incidentally, C, Java, and  JavaScript™ do the same thing. Learning it here will help you learn  other languages as well.). Every time you see an opening bracket,  {there must be a matching} closing bracket. You will see a lot more about this when we discuss loops, decision structures, and functions. For now, suffice it to say that brackets form borders around blocks of code.

                With all that said, let’s look at a program that has a few  statements.

                 int main()
                 {
                int j;
                          j = 5;
                          j++;
                          return 0;
                 }

                This simple program creates a variable named j, sets the value of that variable to 5, then increments that value by one. This is still  not a particularly exciting piece of code, but it does illustrate the basic structure of a C++ program. Three statements are executed, a 0 is returned to indicate that everything is OK, and there are brackets surrounding the main function. If you carefully examine this code, and follow this template in all your programming, then you will do well!

SUBSTRACTION WITH BORROW - Microprocessor


.DOSSEG
.MODEL SMALL
.STACK
.DATA
NUM1 DB 93H
NUM2 DB 94H
RES DB ?
.CODE
START:
MOV AX,@DATA
MOV DS,AX
MOV AX,0000H
MOV AL,NUM1
STB
SBB AL,NUM2
MOV RES,AL
INT 21H
END START
END

RES:
0E32:0008  FE

16-BIT MULTIPLICATION- Microprocessor


.DOSSEG
.MODEL SMALL
.STACK
.DATA
NUM1 DB 2222H
NUM2 DB 0011H
RES1 DW ?
RES2 DW?
.CODE
START:
MOV AX,@DATA
MOV DS,AX
MOV AX,0000H
MOV AX,NUM1
ADD BX,NUM2
MUL BX
MOV RES1,AX
MOV RES2,AX
INT 21H
END START
END


RES
OE32:000E   0002
0E32:0010     4442

8-BIT DIVSION - Microprocessor

.DOSSEG
.MODEL SMALL
.STACK
.DATA
NUM1 DB 58H
NUM2 DB 23H
QUO DB ?
REM DB ?
.CODE
START:
MOV AX,@DATA
MOV DS,AX
MOV AX,0000H
MOV AL,NUM1
DIV NUM2
MOV REM,AH
MOV QUO,AL
INT 21H
END START
END

RES:
DB QUO L1 1967:000A 02H
DB REM L1 1967:000B 12H

Microprocessor program - 8-BIT ADDITION

.DOSSEG
.MODEL SMALL
.STACK
.DATA
NUM1 DB 32H
NUM2 DB 43H
RES DB ?
.CODE
START:
MOV AX,@DATA
MOV DS,AX
MOV AX,0000H
MOV AL,NUM1
ADD AL,NUM2
MOV RES,AL
INT 21H
END START
END

RES
DB RES L1
1967;0006 75H

SOLAR BASED MOBILE CHARGER FOR RURAL AREAS


With the existing push in the direction of sustainable, clean sources of power, it is no surprise that solar power has become one of the most popular alternative energy sources. Free and available everywhere, the power of the sun can be employed to power everything like cel phones and MP3 player. The sun's energy is usually harvested through solar panels that are made up of photovoltaic cells. These cells can convert the sun's power into electricity that can be used for a number of purposes. For private use, a handheld solar hybrid charger can be employed to recharge little device for instance a MP3 player, a cell phone, or a camera.
A normal PN junction diode is used for unidirectional flow of charge current. The output of the solar panel depends on the intensity of the solar light. To regulate this voltage, LM317 is used. LM317 is an adjustable voltage regulator. The regulator circuit is designed to get a fixed voltage of 5V.
An alternative charger circuit is also provided to charge the mobile by house hold general purpose 230V in the absence of the sun light. This charge circuit uses regulated 5V, 750mA power supply. 7805 three terminal voltage regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac output of secondary of 230/18V step down transformer.

What is SCADA Technology


In this modern world of Industrialization and automation, energy plays a major role in the growth of any organization.  The utilization of energy plays an impacting and direct role in the growth of organizations like Visakhapatnam Steel Plant.

            In Vizag Steel Plant, there is a supervisory control and data acquisition system (SCADA) present for monitoring of energy networks which are present throughout the plant.  The objective of this proposed SCADA system is to monitor the energy usage and demands of various consumers of the plant and exercise effective control over their energy consumption optimum utilization of in-house energy resources.

            In this modern world of competition, the technology is changing very rapidly.  To compete with the changes and to  sustain the development, Visakhapatnam Steel Plant is going for up gradation of its existing SCADA system with the latest state of art – technology with the features like using high speed processors having cache – memory and using the powerful PLC’S(Programmable Logic Devices) controls.

            This project makes a brief study of existing “SCADA” system present in Visakhapatnam Steel Plant and the changes that are going to come to in the proposed SCADA system that is to be installed in the near future.