Friday, 4 March 2016

Parts of Robot, I'm fitting all required components on this vehicle.




Mostly Used Components in Easy PC, Its very easy to use.


PCB of H-Bridge


PCB of Main Board of Robot on Easy PC, by Engr.Rashid Malik


Simulation of H-Bridge by Engr. Rashid Malik


PCB of main board of my Robot, how bad soldering I did.:))


Regulated Power Supply, during simulation only need to check the parameters of transformer.. if you need help then contact with me.


Simulation of Regulated Power Supply, as I required 5 and 12 volt in my "Fire Fighter Robot"


LCD Interfacing by Engr. Rashid Malik, Working on final year project.


Thursday, 25 February 2016

"LCD.C" by Engr Rashid Malik
If you want to use LCD in your project then use the following program of lcd.c interfacing with lcd



#define rRS PIN_B7      //4
#define renable PIN_B6  //6
//#define rRW PIN_B1   //5

#define  db4 PIN_B2//LCD pin 11
#define  db5 PIN_B5//LCD pin 12
#define  db6 PIN_B3//LCD pin 13
#define  db7 PIN_B4//LCD pin 14
int8 line[21]="Engr Rashid";
//int8 date,month,year,dow,hr,min,sec;
//int8 line2[21]="V1=1 V2=1 V3=0 V4=0 ";
   

////////////////////////////////////////////////////////////////////////////
////                             LCD.C                                  ////
////                 Driver for common LCD modules                      ////
////                                                                    ////
////  lcd_init()   Must be called before any other function.            ////
////                                                                    ////
////  lcd_putc(c)  Will display c on the next position of the LCD.      ////
////                     The following have special meaning:            ////
////                      \f  Clear display                             ////
////                      \n  Go to start of second line                ////
////                      \b  Move back one position                    ////
////                                                                    ////
////  lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1)     ////
////                                                                    ////
////  lcd_getc(x,y)   Returns character at position x,y on LCD          ////
////                                                                    ////
////        (C) Copyright 1996,1997 Custom Computer Services            ////
////                                                                    ////
////////////////////////////////////////////////////////////////////////////

void lcd_send_nibble( int8 val )
{
   if (val&1)  output_high(db4); else output_low(db4);
   if (val&2)  output_high(db5); else output_low(db5);
   if (val&4)  output_high(db6); else output_low(db6);
   if (val&8)  output_high(db7); else output_low(db7);
   delay_cycles(1);
   output_high(renable);
   delay_us(2);
   output_low(renable);
}
//=============================

void lcd_send_byte( int8 address, int8 n ) {

      output_low(rrs);
     delay_ms(1);
      if(address)output_high(rrs);else output_low(rrs);
      delay_cycles(1);
      //output_low(rrw);
      delay_cycles(1);
      output_low(renable);
      lcd_send_nibble(n >> 4);
      lcd_send_nibble(n & 0xf);
}

//=====================================
void lcd_init() {
    int8 i;
int8 CONST LCD_INIT_STRING[4] = {40,12,1,6};
    set_tris_b(0);
     output_low(rrs);
     //output_low(rrw);
     output_low(renable);
    delay_ms(5);
    for(i=1;i<=3;++i) {
       lcd_send_nibble(3);
       delay_ms(2);
    }
    lcd_send_nibble(2);
    for(i=0;i<=3;++i)
       lcd_send_byte(0,LCD_INIT_STRING[i]);
     
     
}
//===================================
void lcd_gotoxy(unsigned char Row,unsigned char Col)
{  
   if (Row==1) lcd_send_byte(0,0x80+Col-1);
   if (Row==2) lcd_send_byte(0,0xc0+Col-1);
   if (Row==3) lcd_send_byte(0,0x94+Col-1);
   if (Row==4) lcd_send_byte(0,0xd4+Col-1);
}
//!void lcd_putc( char c) {
//!   switch (c) {
//!     case '\f'   : lcd_send_byte(0,1);
//!                   delay_ms(2);
//!                                           break;
//!     case '\n'   : lcd_gotoxy(1,2);        break;
//!     case '\b'   : lcd_send_byte(0,0x10);  break;
//!     default     : lcd_send_byte(1,c);     break;
//!   }
//!}
void printlcd(void)
{
int8 i=0;

   do
   {
   lcd_send_byte(1,line[i]);
   i++;//delay_ms(50);
   }
   while(line[i]!='\0'); // '\0' is null point
}


//!char lcd_getc( byte x, byte y) {
//!   char value;
//!
//!    lcd_gotoxy(x,y);
//!    lcd.rs=1;
//!    value = lcd_read_byte();
//!    lcd.rs=0;
//!    return(value);
//!}
//!

void clrscr(void)
{
lcd_send_byte(0,1);
 delay_ms(2);
}
void print_time(int8 hr,int8 min,int8 sec)
{


lcd_send_byte(1,(hr/10)+48);
lcd_send_byte(1,(hr%10)+48);
lcd_send_byte(1,':');
lcd_send_byte(1,(min/10)+48);
lcd_send_byte(1,(min%10)+48);
lcd_send_byte(1,':');
lcd_send_byte(1,(sec/10)+48);
lcd_send_byte(1,(sec%10)+48);
lcd_send_byte(1,' ');

}
void print_val(int16 val)
{
lcd_send_byte(1,(val/100)+48);
val%=100;

lcd_send_byte(1,(val/10)+48);
lcd_send_byte(1,'.');
lcd_send_byte(1,(val%10)+48);

}

void print_val1(int16 val)
{
lcd_send_byte(1,(val/100)+48);
val%=100;

lcd_send_byte(1,(val/10)+48);
//lcd_send_byte(1,'.');
lcd_send_byte(1,(val%10)+48);

}


void space(int8 d)
{
while(d--)lcd_send_byte(1,' ');
}

//--------- display --------
void display(int16 u,int8 a,int16 v,int16 amp)
{
a%=100;v%=1000;amp%=100;
lcd_gotoxy(1,1);
lcd_send_byte(1,'U');
lcd_send_byte(1,'N');
lcd_send_byte(1,'I');
lcd_send_byte(1,'T');
lcd_send_byte(1,'S');
lcd_send_byte(1,' ');
lcd_send_byte(1,(u/10000)+48);u%=10000;
lcd_send_byte(1,(u/1000)+48);u%=1000;
lcd_send_byte(1,(u/100)+48);u%=100;
lcd_send_byte(1,(u/10)+48);
lcd_send_byte(1,(u%10)+48);
lcd_send_byte(1,'.');
lcd_send_byte(1,(a/10)+48);
lcd_send_byte(1,(a%10)+48);

lcd_gotoxy(2,1);
lcd_send_byte(1,'V');
lcd_send_byte(1,'O');
lcd_send_byte(1,'L');
lcd_send_byte(1,'T');
lcd_send_byte(1,'S');
lcd_send_byte(1,' ');

lcd_send_byte(1,(v/100)+48);v%=100;
lcd_send_byte(1,(v/10)+48);
lcd_send_byte(1,(v%10)+48);

lcd_gotoxy(2,14);
lcd_send_byte(1,'A');
lcd_send_byte(1,'M');
lcd_send_byte(1,'P');
lcd_send_byte(1,' ');

lcd_send_byte(1,(amp/10)+48);
lcd_send_byte(1,(amp%10)+48);
}

"Getkey.c" by Engr Rashid Malik
If you want to use key pad in your project then copy this "getkey.c" file and paste at that place where you did codding in CCS Compiler or pic compiler then you can use key pad.




#define  row1     PIN_C2
#define  row2     PIN_C3
#define  row3     PIN_D0
#define  row4     PIN_D1

#define  col1     PIN_D2
#define  col2     PIN_D3
#define  col3     PIN_C4
#define  col4     PIN_C5



int8 getkey(void)
{
   int8 val=100;
   output_low(row1);output_high(row2);output_high(row3);output_high(row4);
  // output_high(row5);output_high(row6);output_high(row7);output_high(row8);
 
   if(!input(col1))val=1;
   if(!input(col2))val=2;
   if(!input(col3))val=3;
   if(!input(col4))val=13;
   //if(!input(col9))val=17;
   
   output_high(row1);output_low(row2);output_high(row3);output_high(row4);
   //output_high(row5);output_high(row6);output_high(row7);output_high(row8);
 
   if(!input(col1))val=4;
   if(!input(col2))val=5;
   if(!input(col3))val=6;
   if(!input(col4))val=14;
   //if(!input(col9))val=18;
 
   output_high(row1);output_high(row2);output_low(row3);output_high(row4);
   //output_high(row5);output_high(row6);output_high(row7);output_high(row8);
 
   if(!input(col1))val=7;
   if(!input(col2))val=8;
   if(!input(col3))val=9;
   if(!input(col4))val=15;
   //if(!input(col9))val=19;
   
   output_high(row1);output_high(row2);output_high(row3);output_low(row4);
   //output_high(row5);output_high(row6);output_high(row7);output_high(row8);
 
   if(!input(col1))val=11;
   if(!input(col2))val=0;
   if(!input(col3))val=12;
   if(!input(col4))val=16;
   //if(!input(col9))val=20;
 
   if(val==100)return 255;
   else return val;
}
//===========