Friday, August 12, 2016

Today I made new friends

Today is a good day. I made some new friends. And the best part of the whole experience was that i don't made the cling on type friend. they are not even the friends. But its good to have a feeling for a while that you have friends. I lost lost contact with people very quickly. So, I can  say that they are new set of connections rather than saying friends.

Making friends is a very difficult task. 
Whatever!
Everyone moved on with their life except me. So, I have decided that i will MOVE ON!

Sunday, August 7, 2016

Ping Pong Game Using Pic16f877a

Code For the Program
Video:
Code:

#include
#define _XTAL_FREQ 16000000
#include "mylcd.h"
void menu(int x);
void animation();
void main()
{
TRISD=0xff; //make the portc higher nibble input and lower nibble as output pins
lcd_init(); //initialise the lcd
menu(1); //main menu is called from 1
while(1)
{
if(RD0)
{
__delay_ms(10);
menu(2);
}
}
}

void menu(int x)
{
if(x==1)
{
string("Hitting Game");
cmd(0xc0);
string("Press Start");
//main menu
}
else if(x==2)
{
//reserved for another menu
cmd(0x01);
__delay_ms(1);
cmd(0x80);
string("Player 1 Ready");
__delay_ms(2000);
animation();
}
else
{
//if nothing matchese show this
}
}

void animation()
{
while(1)
{
cmd(0x01);__delay_ms(1);
cmd(0x02);__delay_ms(1);
cmd(0x80);__delay_ms(1);
int i;
data('o');__delay_ms(250);
if(RD0)
{
for(i=0;i<=15;i++)
{
__delay_ms(5);
//cmd(0x01);__delay_ms(1);
cmd(0x1c);
__delay_ms(100);
}
}
if(RD1)
{
__delay_ms(5);
for(i=0;i<=15;i++)
{
//cmd(0x01);__delay_ms(1);
cmd(0x18);
__delay_ms(100);
}
}
}
}