Tuesday 17 March 2015

Visual Basic Programming for Beginners: Declaring Variables and Assigning values (03)

Before proceeding, do read Visual Basic Programming for Beginners: Getting Started (02)
 Visual Basic Programming for Beginners: Declaring Variables and Assigning values (03)
In the previous post we have learned how to get started with VB in Visual Studio and we also created a "Hello World" Program. Hope that you are now familiar with Visual Studio environment and the Structure of a VB program.

So now its time to proceed forward in our journey of learning VB

Now we will learn how to declare variables and assign values to them.

Take a look at following code
x=7
y=x+3
Console.WriteLine(y)

Above code assigns "x" value "7" and "y" value "x+3", so its pretty easy to understand that Console.WriteLine(y) will display value "10"

Here "x" and "y" are variables which can be defined as A bucket in computer memory in which you can put values, overwrite existing values and also retrieve values.

Variables can be made to create different type of values like integer,character, string, decimal no.s and many more.

Declaring Variables(syntax):
Integer Type variable
Dim x As Integer
Dim y As Integer
"Dim" keyword is used to declare a variable i.e to provide dimensions to the variable in the computer memory
So now let's implement this in Visual Basic.

  • Program To add integer values

Module Module1
  Sub Main()
          Dim x As Integer
          Dim y As Integer
          x=7
          y=x+3
          Console.WriteLine(y)
          Console.ReadLine()
  End Sub
End Module

Note: To make your program more understandable, make comments in your program
How to make comments in VB?
We can make comments in VB by the use of Single quote('), and VB supports only single line comments
It goes like this:
'This is a comment
'Compiler won't detect it
'Only single line comments are possible
'Every character after single quote counts in comment 

String Type variable
Dim myname As String
myname = "MAK"
alternate way
Dim myname As String = "MAK"
or
Dim myname = "MAK"

  • Program to print String On console

Module Module1
  Sub Main()
          Dim myname As String
          myname = "MAK"
          Console.WriteLine(myname)
          Console.ReadLine()
  End Sub
End Module

Generic Type variable
Generic datatype variables are those who can store data of any datatype
It goes like this
Dim x
And that's all, you have created a generic type variable "x" which can store any type of data

  • String Concatenation in Visual Basic
"&" act as a string concatenation operator in VB and program to use this is as follows
  
  • Program to concatenate two datatype as string
Module Module1
  Sub Main()
          Dim x As Integer = 7
          Dim myname As String = "MAK"
          Dim myfirstTry As String = x & myname
          Console.WriteLine(myfirstTry)
          Console.ReadLine()
  End Sub
End Module

Compile this code and check out the output, it is interesting.

Type Casting:

  • Integer To string
           Dim x As Integer = 7
           Dim myname As String = x.ToString()
             or
          Dim myname As String = CStr(x)
   
So stay tuned and keep coding and practicing till next post.   

Saturday 14 March 2015

Visual Basic Programming for Beginners: Getting Started (02)

Before proceeding, do read Visual Basic Programming for Beginners: Introduction (01)

Well, in the previous blog we have gone through how to get things ready to learn Visual Basic and why we should learn VB and its importance in today's world.

Now we will start working on visual studio and will try to get familiar with it's interface and will build our first VB program.

Step 1:
Open visual studio 2013 on your desktop
Step 2:
Click on File ->New ->Project
Step 3:
Under Templates, Select Visual Basic and then Console Application
Step 4:
Name your project and click "Ok"

Will now have a window like this:
VB1


Now in the code editor window, you will have default code like this:

Module Module1

Sub Main()


End Sub

End Module



The above is your default VB code which must be there to start with.
where
Module Module1 is your main container of code and
Sub Main() is a sub procedure

Remember that in VB

  • Single line of code means single statement unlike C,C++,C# etc where you end with a semicolon(;) 
  • Each module or a procedure is end with END Keyword as you can see in above code. 
Now, Hello World Program in VB

Our purpose is just to Print A line of string On Console String on Console Window.



Module Module1
Sub Main()
Console.WriteLine("Hello World")
Console.ReadLine()
End Sub
End Module

In the Above Example Console is a class in WriteLine() and ReadLine() are member functions of this class used to write and read from consloe input.
This was pretty good.
Now Press "START" button to start running your application.
Your output Will be Like this:
VB2

 In the above code, the work of  Console.WriteLine("Hello World") was to print "Hello World" On console screen and the work of Console.Readline()Is same as that that of getch() in C that is to hold the output screen until a character is enterd.

So,today we have made our first VB program and learned a basic about it.
Till next post get yourself familiar with Visual Studio Environment and Do goggle about
  • Solution Explorer
  • Open new project in visual studio
  • Open Existing Project in Visual Studio
  • Properties bar
  • Error List in Visual Studio
Till then keep practicing and coding in Visual Basic 

Friday 13 March 2015

Visual Basic Programming for Beginners: Introduction (01)

Welcome back readers....
From now on wards, your very appreciated blog "Let's Innovate" i.e http://makcs.blogspot.com will focus on Introduction to Visual Basic Programming.
Mean while you might also find other articles also but don't worry, the VB course will go on uninterrupted side-by-side.


For this series of module I'm going to use following things which you also need to have installed on your PC:

  • Windows 7 seven service pack 1(or above)
  • Visual Studio 2013
  • Interest to learn Visual Basic
If you have any problem with process listed above(regarding downloading, installing etc), please write to me on mywork78601@gmail.com

Why should I learn Visual Basic:

  • One of the commonly used programming language in today's scenario
  • Best and easy substitute of C#(C sharp)
  • Easy To Learn
  • No use of semicolons and curly braces(which makes programming complex)
  • Very Close to English language
  • Can be used standalone, with asp.net, to create console applications, web applications and many more
So I think above reasons a good enough to start with Visual Basic Programming.

Thing to be kept in mind:

  • Keep the IDE ready with you i.e Visual Studio
  • Best way to learn programming language is to practice by your own
  • Always type the code by your hands, don't just copy-paste
  • I'm just showing you the path, you have to walk on it
  • Don't keep quires, just comment them or mail it to me.
So, We will be meeting very soon to begin, till then get things ready.

You can download Visual studio 2013 free from here:
Click here

Till then keep coding...

Tuesday 3 March 2015

Industrial Automation With PLC and SCADA

Basics about PLC and SCADA



Today's world is focused on automation. Without automation any industry can merely run smoothly and give out desired output and production rate.Industrial automation is a great choice to go in for a bright future specially for electrical, electronics and communication, electronics and instrumentation and mechanical branches.


If want to know basics about PLC and SCADA quickly, then you are at right place. So without wasting any time let's begin.


PLCProgrammable Logic Controller  

 Normal branded PLC costs 20000-25000/-
Advanced version of PLC is called DMC.

Some Uses of Industrial Automation:
  • Oil and Gas industry
  • Power sector
  • Wind energy plants
  • Paper industry
  • Cement Industry
  • Steel plants
  • Plastic Industry
  • Bottle filling plant
  • Wafers packing plant
  • and many more
 Automation:
Automation is basically a delegation of human control function to control technical equipment
or
It is the use of control system to increase productivity.

Need of  Automation:
  • Time saving
  • Accuracy
  • Increase Productivity
Automation Tools:
  • Relay
  • Contactor
  • HMI: Human machine interface
  • SCADA
  • PLC
  • DCS: Distributed control System
Momentry Switch:

There are two types of momentry tools used in industrial automation:-
  1. NO switch: Normally open and green in color
  2. NC switch: Normally Closed and red in color
RELAY:

Relay is an electrical single phase switching device.
The power applied to its coil generates a magnetic field that operates the switch. The operating voltage of its coil may be different from the load voltage.
  • Single phase
  • DC motor
  • Light load
CONTACTOR:
It is same as RELAY but
  • Heavy load
  • 3 phase
  • multipole
  • single throw
  • operates in NO configuration
Drawbacks of Contactor and RELAY:
  • Bulky Panels
  • Complex wiring
  • Longer Project times
  • Difficult maintenance and trouble shooting
Circuit Breaker:
  1. MCB: Miniature Circuit Breaker.
    Two types
    1.Single Pole
    2.Double Pole
  2. MCCB: Molded Case Circuit Breaker.Used for 3 phase suply.
    Two types
    1.3 pole
    2. 4 pole
  3. ELCB: Earth Leakage Circuit breaker
    % pole for earth and neutral.
  4. OLR: Thermal Overload Relay
  5. MPCP: Motor protector Circuit protector
    Act as dual starter.
  6. VFD: Variable frequency drive.
    1.Control speed and torque
    2.varies frequencies and amplifies the AC waveform being delivered to the motor
    3. save money in electricity
    4.Soft start and stop
PLC:
Programmable Logic Controller
operates at 24 V DC supply
Contains EEPROM(Electrically Erasable Programmable Read Only Memory) 
major PLCs used
  • Allen Bradly(US)
  • Delta(China)
  • Siemens(Germany)
  • OMRON(Japan)
Types:
  1. Fixed PLC
  2. Modular PLC
Programming language used:
Ladder Diagram

Software used for programming:
  • RSLinx Classic (communication software between CPU and PLC)
  • RS Emulate 500
  • RS Losix micro (ladder program is made here)
SCADA:
Supervisory Control and Data acquisition system
Features:
  •  Dynamic Representation
  • Alarms
  • Recipe
  • Device Connectivity
  • and many more
Industrial Automation is a very vast field and PLC and SCADA are part of it and it holds a bright future and boom in  INDIA specially. 

[How to] Connect an android device [using MTP] on Linux [Ubuntu 14.04 LTS] 100% working

I recently moved to Linux[Ubuntu 14.04 ] from windows 8.1 because it hangs a lot on my lappy. Apart from the cool features of Ubuntu , one...