Friday 2 November 2012

C Programming Calendar Project


Name our project ECE246 is Calendar version 1.0. This calendar we make using TURBO C++, this is my project when i study basic programming.
1.Declare the data type and name
#include
void definition();

#define TRUE 1
#define FALSE 0
void main()
{
printf("**********WELCOME**********\n");
printf("************TO*************\n");
printf("********CALENDAR 1.0********\n");
definition();
}

void definition()
{
int year,odd_day,x,y,z,h,month,day;
int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
char *months[]=
{
" ",
"\n\n\nJanuary",
"\n\n\nFebruary",
"\n\n\nMarch",
"\n\n\nApril",
"\n\n\nMay",
"\n\n\nJune",
"\n\n\nJuly",
"\n\n\nAugust",
"\n\n\nSeptember",
"\n\n\nOctober",
"\n\n\nNovember",
"\n\n\nDecember"
};
2.Mathematic formula
How to Count the Odd Days:
1 ordinary year = 365 days = (52 weeks + 1 day). :. An ordinary year has 1 odd day. ii)1 leap year = 366 days = (52 weeks + 2 days). :. A leap year has 2 odd days. ii)100 years = 76 ordinary years + 24 leap years = [(76 x 52) weeks + 76 days) + [(24 x 52) weeks + 48 days] = 5200 weeks + 124 days = (5217 weeks + 5 days). :. 100 years contain 5 odd days. 200 years contain 10 and therefore 3 odd days. 300 years contain 15 and therefore 1 odd day. 400 years contain (20 + 1) and therefore 0 odd day. Similarly, each one of 800, 1200, 1600, 2000, etc. contains 0 odd days. Remark: (7n + m) odd days, where m < 7 is equivalent to m odd days. Thus, 8 odd days ≡ 1 odd day etc.

Thus with above condition we create a formula to be fit in our program:
x=(year/4-1); y=(year-x); z=2*x + y; odd_day=z%7;

However using the formula we create, there some error when the result is display. As display below for every leap year the first date for the first month is different. This happen because we using for loop to correct the first date of first month of every year.
for ( day = 1; day <= 1 + odd_day * 5; day++ )
{
printf(" ");
}



For full program download HERE

Shunt Motor




Basic diagram of shunt motor.

The shunt motor is different with the series motor in shunt motor the field winding is connected in parallel with the armature instead of in series. And from the basic of electrical theory a parallel circuit is often stated as a shunt. Based on the field winding that is placed in a parallel connection with the armature, it is called a shunt winding while the motor is called a shunt motor. Figure 1.0 and 1.2 shows a diagram of a shunt motor.



Shunt motor operating characteristic
In theory shunt motor has slightly different operating characteristics compare with series motor. A shunt motor cannot produce large current for starting like the series field. This is because its shunt field coil is made of fine wire. And this means that the shunt motor has very low starting torque, which requires that the shaft load be rather small.

When voltage is applied to the motor, the high resistance of the shunt coil will keeps the overall current flow to become low. The armature for the shunt motor operating system is similar to the series motor and it will only draw current to produce a magnetic field that is strong enough to cause the armature shaft and load to start turning. When the armature begins to turn, it will produce EMF. The EMF will cause the current in the armature to begin to diminish to a very small level. The amount of current the armature will draw is directly related to the size of the load when the motor reaches full speed. Since the load is generally small, the armature current will be small. When the motor is at its full rpm, its speed will remain fairly constant.
Speed of shunt motor
When the motor is at its full rpm, its speed will remain fairly constant. This is happen due to the load characteristics of the armature and shunt coil.

The shunt motor's speed can be controlled. The ability of the motor is to maintain a set rpm at high speed when the load is changes and it is due to the characteristic of the shunt field and armature. Since the armature begins to produce the back EMF as it is starts to rotate, it will use the back EMF to keeps its rpm at high speed. If we increases the load slightly and it will causes the armature shaft to become slow down, small back EMF will be produced. This will allow the difference between the back EMF and applied voltage to become larger, which will cause increasing its current. The extra current provides the motor with the extra torque which is required to regain its rpm when this load is increased slightly.
To control shunt motor's speed can be used in two different ways. Such as with varying the amount of current supplied to the shunt field and controlling the amount of current supplied to the armature. Controlling the current to the shunt field allows the rpm to be changed when the motor is at full rpm. Second way to control regulation of motor speed is by increasing or decreasing the voltage applied to the field.
Torque characteristic
The torque is increasing as the motor gains the speed due to the fact that the shunt motor's torque is directly proportional to the current. When the motor’s speed is at very low, the motor has very little torque. And after the motor is at full rpm, its torque is at its fullest potential. In fact, if the shunt field current is reduced slightly when the motor is at full rpm, the rpm will increase slightly and the motor's torque will also increase slightly.

Three-phase AC synchronous motors


If connections to the rotor coils of a three-phase motor are taken out on slip-rings and fed a separate field current to create a continuous magnetic field (or if the rotor consists of a permanent magnet), the result is called a synchronous motor because the rotor will rotate synchronously with the rotating magnetic field produced by the polyphase electrical supply.
The synchronous motor can also be used as an alternator.
Nowadays, synchronous motors are frequently driven by transistorized variable-frequency drives. This greatly eases the problem of starting the massive rotor of a large synchronous motor. They may also be started as induction motors using a squirrel-cage winding that shares the common rotor: once the motor reaches synchronous speed, no current is induced in the squirrel-cage winding so it has little effect on the synchronous operation of the motor, aside from stabilizing the motor speed on load changes.
Synchronous motors are occasionally used as traction motors; the TGV may be the best-known example of such use.
One use for this type of motor is its use in a power factor correction scheme. They are referred to as synchronous condensers. This exploits a feature of the machine where it consumes power at a leading power factor when its rotor is over excited. It thus appears to the supply to be a capacitor, and could thus be used to correct the lagging power factor that is usually presented to the electric supply by inductive loads. The excitation is adjusted until a near unity power factor is obtained (often automatically). Machines used for this purpose are easily identified as they have no shaft extensions. Synchronous motors are valued in any case because their power factor is much better than that of induction motors, making them preferred for very high power applications.
Some of the largest AC motors are pumped-storage hydroelectricity generators that are operated as synchronous motors to pump water to a reservoir at a higher elevation for later use to generate electricity using the same machinery. Six 350-megawatt generators are installed in the Bath County Pumped Storage Station in Virginia, USA. When pumping, each unit can produce 563,400 horsepower (420 megawatts).

3 type of FUNCTION (c prgramming)

Below are 3 types of function that usually been use for create a program in programming lesson and i also provide the example of each function...ENjoy YA...
1. Functions with no arguments and no return values
/* Program to illustrate a function with no argument and no return values*/
#include

void statement1();
void starline();
void statement2();


int main()
{
statement1();
starline();
statement2();
starline();
return 0;
}
/*function to print a message*/
void statement1()
{
printf("\n Sample subprogram output\n");
}
void statement2()
{
printf("\n Sample subprogram output two\n");
}
void starline()
{
int a;
for (a=1;a<60;a++)
printf("%c",'*');
printf("\n");
}


2. Functions with arguments but no return values

/*Program to find the largest of two numbers using function*/

#include
void largest(int, int);
int main()
{
int a,b;
printf("Enter the two numbers");
scanf("%d%d",&a,&b);
largest(a,b);
return 0;
}
/*Function to find the largest of two numbers*/
void largest(int a, int b)
{
if(a>b)
printf("Largest element=%d",a);
else
printf("Largest element=%d",b);
}

3. Functions with arguments and return values
#include
float add(float,float);
double sub(double,double);
int main()
{
float x=12.0;
float y=9.0;
printf("%f\n",add(x,y));
printf("%lf\n",sub(x,y));
return 0;
}
float add(float a,float b)
{
return (a+b);
}
double sub(double p,double q)
{
return(p-q);
}

Image Sensor


Image Sensor:
A device that converts an optical image to an electric signal. There two types of image sensor, that is Couple-Charged Device (CCD) and Complementary metal-oxide-semiconductor (CMOS). Firstly, here is the basic operation of CCD type. when light strikes the chip it is held as a small electrical charge in each photo sensor. The charges are converted to voltage one pixel at a time as they are read from the chip. Additional circuitry in the camera converts the voltage into digital information. i prepare the video how it work below...


And below also video that explain comparison between CCD with CMOS


Touch Sensor

Resistive single-touch screens have been then workhorse of the touch screen market for 20 years. Until now, multi-touch capabilities were reserved for non-resistive touch technologies such as surface or projective capacitive and surface acoustic wave, etc. Resistive touch sensor responds to pressure on its surface.
There are 2 common type of touch sensor that is Resistive type and Capacitive type. in resistive type there are 2 configuration:
1. 4-wire type
2. 5-wire type
3. 8-wire type
here i explain a little bit about basic operation of 4-wire type.
A 4-wire resistive consists of 2-sheets of clear material with a transparent linearly resistive coating applied to one side of each. The two sheets are brought close to one-another with the coated sides facing one-another. Small spacer dots arranged in a grid pattern hold the two sheets apart when the sensor is at rest. A uniform, unidirectional voltage gradient is applied to the first sheet. When contact is made to the surface of the touchscreen, the two sheets are pressed together; the second sheet measures the voltage as distance along the first sheet, providing the X coordinate. When this contact coordinate has been acquired, the uniform voltage gradient is applied to the second sheet to ascertain the Y coordinate. The controller alternately drives the X and Y axes on the glass layer with a +5V current and reads the resulting voltage from the cover sheet. This operation occurs instantaneously, registering the exact touch location as contact is made.

Network Technologies


Below is the lists network technologies, their speeds, and uses. Older technologies no
longer widely used and not listed in the table include X.25, Frame Relay, ISDN, Token
Ring, FDDI, and ATM. The table is ordered from slowest to fastest maximum
bandwidth, although latency can affect the actual bandwidth of a particular network.