LED Projects

LED chasers,LED drivers,LED lamps,Automatic lighting systems etc

Microcontroller projects

Projects in PIC,AVR,MSP 430,ARM,Raspberry pi,Arduino etc

Coding

Coding in Microcontrollers,Arduino,MATLAB,LabView etc

Prototyping

Prototyping all kind of electronics and electrical projects

PCB Designing

PCB Dsesigning in Altium and Eagle Designer

Saturday, 26 November 2016

PIC16F877A


Here are some basic examples of pic programming in Hi-tech C with Proteus simulation


  Here you can use any pin for uart communication.go to suart.h and edit the following steps depend on our pins using
#define TxData RB0            /* Map TxData to pin */
#define RxData RB1                /* Map RxData to pin */
#define INIT_PORT TRISB0 = 0    /* set up I/O direction */
#define INIT_PORT1 TRISB2 = 1    /* set up I/O direction */ 

ABOUT US

ECworks is a freelancer site.We are doing freelance works in 

  • Electronics Circuit designing
  • Electronics and embedded projects and prototyping
  • Embedded programming in PIC,AVR,Arduino,ARM,MSP430,Raspberry pi etc
  • PCB designing in Altium,Eagle,Circuit wizard
  • Circuit simulation in Proteus and circuit wizard
  • MatLab
  • LabView
  • SketchUP designing etc

Tuesday, 15 November 2016

C program tutorials

1. How to start a new program in compiler Code Blocks

2. Difference between gets(),getch(),getche(),getchar() 

3. Pointers 

Pointers

Pointers are variables that contains the address of another variable.Pointers are declared as

<data type><*name of pointer>   => int *ptr
 
Example 1:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a=15;
    int *ptr=&a;
    printf("pointer value=%d",*ptr);
}
 
Here we declare two variables one is a and other is ptr.Here variable ptr contains the address of variable a.When print *ptr it will go to the address of a and print the value in the address of a,ie 15.


Difference between gets(),getch(),getche(),getchar()-c program tutorial

Here this tutorial explain the difference between input functions gets(),getch(),getche(),and getchar() in a c program.The compiler used is Code Blocks.





gets() used to read a string and getch(),getche(),getchr() are used to read character

gets() -       Reading or accepting a string from the user

getch() -      it do not displayed on the screen and do not wait for enter key

getche() -     it displayed on the screen and don't wait for the enter key

getchar() - it displayed on the screen and wait for the enter key

Thursday, 10 November 2016

Tutorials

 

How to start a new program in CODE BLOCKS


Tuesday, 8 November 2016

C Programs




sum of digits in a number

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int num,rem=0,sum=0;
    printf("enter number : ");
    scanf("%d",&num);
    while(num!=0)
    {
       rem=num%10;
       sum=sum+rem;
       num=num/10;
    }
    printf("sum of integer is : %d",sum);
    printf("\n");








odd or even

 #include <stdio.h>
#include <stdlib.h>

int main()
{
   int num=0;
   printf("enter the number :");
   scanf("%d",&num);
   num=num%2;
   if(num==0)
   {
     printf("number is even ");
   }
   else
   {
       printf("number is odd");
   }
}







day equivalents

 #include <stdio.h>
#include <stdlib.h>

int main()
{
    int total_days=0,b1=0,year=0,week=0,day=0;
    printf("enter days : ");
    scanf("%d",&total_days);
    year=total_days/365;
    b1=total_days-(year*365);
    week=b1/7;
    day=b1-(week*7);
    printf("years=%d,week=%d,days=%d \n",year,week,day);
}







binary to decimal

#include <stdio.h>
#include <stdlib.h>
int main()
{
   int num,rem=0,dec=0,base=1;
   printf("enter binary number : ");
   scanf("%d",&num);
   while(num>0)
   {
       rem=num%10;
       dec=dec+(rem*base);
       base=base*2;
       num=num/10;
   }
   printf("decimal number is : %d ",dec);
}



decimal to binary


 #include <stdio.h>
#include <stdlib.h>

int main()
{
   int num,rem=0,bin=0,base=1,dec;
   printf("enter decimal number : ");
   scanf("%d",&dec);
   while(dec!=0)
   {
       rem=dec%2;
       bin=bin+(rem*base);
       base=base*10;
       dec=dec/2;
   }
   printf("corresponding binary= %d\n",bin);

}





number of 1s

#include<stdio.h>
int main()
{
    int n,result,count=0;
    printf("enter the number : ");
    scanf("%d",&n);
     while (n)
    {
      n &= (n-1) ;
      count++;
    }
    printf("number of 1's in the number = %d\n",count);
}


Description

9 = 1001 so there is total 2 number of 1s in 9


position of 1s



#include <stdio.h>
#include <stdlib.h>

int main()
{
    int num=0,check=0,i=0;
    printf("enter the number=");
    scanf("%d",&num);
    printf("1's in\n");
    for( i=0;i<9;i++)
    {
      if(num&(0x80>>i))
       {

           printf("position %d\n",i+1);
       }
    }
}


Description
Here we enter the number 9 = 00001001 ( 8 bit binary equivalent of 9 ) . So here in this example from LSB to MSB 1's in the position 5 and 8.

Pointers 

sum of array

 #include <stdio.h>
#include <stdlib.h>
int main()
{
   int num[11],*ptr,sum=0,i;
   printf("enter 10 elements : \n");
   for(i=0;i<10;i++)
   {
         printf("element %d=",(i+1));
         scanf("%d",&num[i]);   // exit from scanf() only when press enter key
   }
   ptr=&num;
   for(i=0;i<10;i++)
   {
       sum=sum+*ptr;
       ptr++;
   }
   printf("sum of array elements = %d\n",sum);
}

 

swapping

#include <stdio.h>
#include <stdlib.h>
int main()
{
   int num1,num2;
   printf("enter first number:");
   scanf("%d",&num1);
   printf("enter second number:");
   scanf("%d",&num2);
   swap(&num1,&num2);
   printf("\nswapped result is\n");
   printf("first number=%d\n",num1);
   printf("second number=%d\n",num2);
}
int swap(int *ptr1,int *ptr2)
{
    int reg;
    reg=*ptr1;
    *ptr1=*ptr2;
    *ptr2=reg;
}

reverse

#include<stdio.h>
int main()
{
    int num,rem,rev=0;
    printf("enter the number : ");
    scanf("%d",&num);
    while(num>0)
    {
        rem=num%10;
        rev=rev*10+rem;
        num=num/10;
    }
    printf("The reverse of number = %d\n",rev);
}


length of a string

#include <stdio.h>
#include <stdlib.h>
int main()
{
   char str[20],length=0;
   printf("enter the string=");
   gets(str);
   length=string_length(&str);
   printf("length of string=%d",length);
   length=0;
}
string_length(char *ptr)
{
    int num=0;
    while(*ptr!='\0')
    {
        num++;
        ptr++;
    }
    return num;
}



 


Sunday, 6 November 2016

Videos

HOW TO MAKE AN LED FLASH LIGHT 

 

15 MODE LED CHASER

 

led propeller display  

 

How to simulate arduino in proteus



Top 10 Weird And funny Inventions in world 

 

Adjustable Timer Circuit using 555

 

How to add bluetooth device in Proteus simulator  

 

How to switch between 2 different voltages with out relay

 

Elementary circuit simulation_circuit wizard

 

RGB led+VB.Net+Microcontroller 

 

MEASURING INCLINATION ANGLE (ARDUI+MPU6050) 

 

CIRCUIT WIZARD-BEST SIMULATOR FOR BEGINNERS 

 

How to design a PCB in Eagle Cad - Simple & easy tutorial for beginners  


Altium Designer Tutorial:Simple and easy tutorial for beginners