SERVFORU

Counting the number of times pressed of Switch , C program in MPLAB X

In this program we are going to count the number of times a switch pressed,and displaying it on a LCD .. and each time the switch pressed a LED will lighted up.




First create a new project and add a c main file like in the  steps for  Blinking a LED using MPLAB X , PIC16F877A

Components 


1. PIC16F877A micro controller
2. animated LED  
3. A toggle switch
4.16x2 LCD display




Steps in the program

1. define the ports for easy usage 

Defines the control pins of LCD to the 0th,1st and 2nd pin of PORT D
    #define RS RD0
    #define RW RD1
   #define EN RD2
Defines the data port of the  LCD to PORT B
   #define DATA PORTC
Defines switch in the 0th pin of PORT C
   #define S RC0
Defines LED on the 3rd pin of PORT D
   #define L RD3
2. Function declarations .. here we declare 3 functions  and all the 3 functions is for LCD

void LCD_CMD(unsigned int value); //This function is pass the LCD commands
void LCD_DAT(unsigned int value); // this is for pass the DATA to the LCD which is to displayed 
void LCD_INIT(); //this to initialize the LCD
void delay(); // this is to delay the LCD commands 


3. next is main function .. in main function we make 
  •  PORT C as input where we have connected the switch
  •  PORT D as output where we have connected the LED and control pins of LCD
  • PORT B as outout where we have connected DATA pins of LCD
    TRISC  =0x0F;
    TRISD  =0x00;
    TRISB = 0x00;

4. The function LCD_INIT(); is called for initializing the LCD
5. Declared a variable called count, and initialized it to zero
   int count;
   count=0;
6.  we put the LED off 
7. now we are going for a infinite loop by 
    while(1)
    { 
     }
8. In the loop we are checking switch is ON or OFF condition
 if the switch is ON ; LED is on and count is incremented by 1 and display the value of count in LCD 

if the Switch is OFF it wait for the condition when the Switch is ON 

schematic diagram 



full Program
 ###################################################################################
    /*
 * File:   switchcount.c
 * Author: Ebin Ephrem
 
 */

#include<htc.h>
__CONFIG(0x193A);

C
#define RS RD0
#define RW RD1
#define EN RD2
#define DATA PORTB
#define S RC0
#define L RD3

void LCD_CMD(unsigned int value);
void LCD_DAT(unsigned int value);
void LCD_INIT();
void delay();



void main(void)
{
    TRISC  =0x0F;
    TRISD  =0x00;
    TRISB = 0x00;
LCD_INIT();
int count;
count=0;
L=0;

  while(1)
  {
if( S == 1)
       {
    while(S==1);
            L= ~L;
                     count = count+1;
              LCD_CMD(0x01);
        delay ();
    LCD_DAT('0' + (count % 10));
}
       }
 }

void LCD_INIT()
 {
    LCD_CMD(0x01);
    delay ();
    LCD_CMD(0x38);
    delay ();
    LCD_CMD(0x0F);
    delay ();
    LCD_CMD(0x06);
    delay ();
    LCD_CMD(0x0c);
    delay ();

    LCD_CMD(0x80);
    delay ();
}
void LCD_CMD(unsigned int  value)
{
    DATA =  value;
    RS=0;
    RW=0;
    EN=1;
    delay ();
    EN=0;
    delay ();
 }

void LCD_DAT(unsigned int value)
{
    DATA= value ;

    RS=1;
    RW=0;
    EN=1;
    delay ();
    EN=0;
    delay();

}

void delay(void)
{
    int counter = 0;
    for (counter = 0; counter<1000; counter++) {
        ;
    }
}





 

Remove the mask of passwords in any browser

If we use autofill settings there is a chance to forgot the password , your browser will always block the password box from passersby seeing it by using asterisks. To remove the mask and reveal your password, you just need to do a few things.


Follow the steps:



1. Right-click the password box and select "Inspect Element."This brings up the developer console

2.. On the line that starts with "input type=password

3. Right click and select Edit HTML

4. change the word "password" to "text" ( type="password"  to type="text")


 

Interfacing Keypad with PIC16F877A in C program using MPLAB X

This tutorial will show you how to read a 4x4 keypad input and write to an alphanumeric LCD interfaced to your PIC micro, it's pretty simple and straight forward.

First create a new project and add a c main file like in the  steps for  Blinking a LED using MPLAB X , PIC16F877A
Components
1.PIC16F877A micro controller
2. 4x4 matrix keypad

initial setup
 supply logic 0 (0V or GND) to all 4 keypad row wires or set the row pins as output
 Supply logic 1 (high voltage) to all 4 keypad coloum wires or set coloums  as input


Steps to read a key from the keypad 
1. Find the Row first, by selecting each row
2. scan the colum  which pressed key is
3 Find the key pressed ,the function findKey() is for this


4. If we have at least one key pressed, then return from keypadread()  will be non zero.






PROGRAM 
#######################################################################
    /*
 * File:   main.c
 * Author: Ebin Ephrem
 
 */


#include<htc.h>

#if defined(WDTE_OFF)
__CONFIG(WDTE_OFF & LVP_OFF);
#elif defined (WDTDIS)
__CONFIG(WDTDIS & LVPDIS);
#endif

char findKey(unsigned int a, unsigned int b);
char readKeyboard();

void main()
{  
   TRISB = 0xF0;

unsigned int re;   
 while(1)
    {
        re=0;
        re= readKeyboard();
    }
}
char readKeyboard()

{
 unsigned int i = 0;
 for(i=0;i<4;i++)
 {
  if(i == 0)
  PORTB = 1;
  else if(i == 1)
  PORTB = 2;
  else if(i == 2)
  PORTB = 4;
  else if(i == 3)
  PORTB = 8;

  if(RB4)
    return findKey(i,0);
  if(RB5)
   return findKey(i,1);
  if(RB6)
   return findKey(i,2);
  if(RB7)
   return findKey(i,3);
 }
 return ' ';
}
char findKey(unsigned int a, unsigned int b) //generating key character 
{

 if(b == 0)
 {
   if(a == 3)
    return '3';
   else if(a == 2)
    return '2';
   else if(a == 1)
    return '1';
   else if(a == 0)
    return '0';
 }
 else if(b == 1)
 {
   if(a == 3)
    return '8';
   else if(a == 2)
    return '7';
   else if(a == 1)
    return '6';
   else if(a == 0)
    return '5';
 }
 else if(b == 2)
 {
   if(a == 3)
    return 'b';
   else if(a == 2)
    return '8';
   else if(a == 1)
    return 'A';
   else if(a == 0)
    return '-';
 }
 else if(b == 3)
 {
   if(a == 3)
    return 'C';
   else if(a == 2)
    return 'U';
   else if(a == 1)
    return 'E';
   else if(a == 0)
    return 'F';
  }
}

######################################################################


you can modify the number of colums and rows for 3x4 keypad , and for the other keypads



 

Change and Customize Your Google Search Page

Most of us uses www.google.com for searching over internet .. Here is a method to change  image for  your google home page  And make the homepage customised
It's a simple enough feature that we've heard rumors of here and there: Just go to Google.com,Pick any image from Google's Public gallery, your Picasa web album photos, or upload any image from your desktop



For this do following steps ..

1. open your browser and go to picasaweb.google.com 

2. Log in to picasa with your Google ID and Password
3.You can select any albums and select upload in the top 


 4.A new window opens with Drag your Photo here ..or with select photo from your computer
    select the photo that you want to make the homepage image
5.Click OK ..

6.Now go to  www.google.com 
7.Select the link Change background Image in the bottom left corner
8.A new window will appear to select image for  your google home page. Select Your Picasa Web Photos or Your Recent Picks from the side tab on the window
9.Select the Picture that you want to make the google home page image .. 
The google page will load your image as home page .. and njoy... 
you can also set the popular images in the picasa web albums... 
 

Check your Android Device is vulnerable ? How to Make it Secure

Now we heard that a serious security vulnerability was recently discovered that could wipe everything off of some Samsung phones. Although Samsung issued a patch for the Galaxy S III, it turns out it's not just Samsung devices that are affected. Here's how to find out if your Android device is vulnerable.


 Essentially, some phones support special dial codes called USSDs (e.g., dialing *#06# to display the phone's IMEI number). Through malicious links in a website, SMS, NFC beam or QR code, hackers can perform a factory reset on your phone, lock the SIM card, and more—without warning.





Steps to find the your Android device is vulnerable , and make it  secure by using an patch

1 . Go to the link 
 http://dylanreeve.com/phone.php on your phones browser

2.If your phone is vulnerable , you'll immediately see your phone's IMEI number pop up.

If you are vulnerable, you should look for the latest updates for your device.Usually you can go to Settings > About Phone > System Update to check for available updates 

Some browsers (most notably Opera) appear to offer some security by not handling the iframe injection code immediately.

Two apps have also been developed to protect against the vulnerability: Auto-reset blocker andTelStop.

Finally, as always, avoid clicking on any unknown links.




 

ANALOG TO DIGITAL CONVERTION using PIC16F877A and MPLABX


Many electrical signals around us are Analog in nature. That means a quantity varies directly with some other quantity. The first quantity is mostly voltage while that second quantity can be anything like temperature, pressure, light, force or acceleration.

The PIC16F877A has a built-in Analogue to Digital converter. What ADC does is basically convert an analogue voltage ranging from -Vref to +Vref (usually 0V to 5V) and converts it to a binary value. The ADC on the PIC16F877A has 10-bit resolution and this provides 1024 steps (2^10=1024) which is more than enough for normal applications.



Programming ADC in HI-TECH C for MPLAB

ADC is connect to the PIC CPU by 3 control register and 2 data register. The control registers are used to setup and give commands to the ADC. They also provides the status of ADC. The two data registers holds the 10 bit of converted data. Since each resister in PIC18 is of 8 bits therefore 2 registers are required to hold the 10bit data.
We will develop two functions to support ADC in our projects. One will help initialize the module and other will help us select any of the 13 channels and start the conversion. After the conversion is done it will return us the results.
I am not giving here the description of the control and data registers as they are very clearly explained in PIC18F4520's datasheet on page 223 to 225. I request you to download the datasheet and read the description so that you will have an Idea of what every bit in the registers do. As I told before, ADC is connected to the CPU via three control register and two data registers. The three control registers are :-
  • ADCON0 - Used to select analog input channel,start the conversion, check if the conversion is done and to switch on/off the module.(We use this in ADCRead() function.)

  • ADCON1 - Used to Select Voltage reference, and to configure ports as Analog of digital. (We leave these to defaults)

  • ADCON2 - Used to select ADC data format, Set acquisition time, ADC clock setup (We setup these in ADCInit() function)

First we configure the ADC to our needs in the ADCInit() function.
//Function to Initialise the ADC Module
void ADCInit()
{
   //We use default value for +/- Vref

   //VCFG0=0,VCFG1=0
   //That means +Vref = Vdd (5v) and -Vref=GEN

   //Port Configuration
   //We also use default value here too
   //All ANx channels are Analog

   /*
      ADCON2

      *ADC Result Right Justified.
      *Acquisition Time = 2TAD
      *Conversion Clock = 32 Tosc
   */

   ADCON2=0b10001010;
}

 


ADCRead function ...


//Function to Read given ADC channel (0-13)
unsigned int ADCRead(unsigned char ch)
{
   if(ch>13) return 0;  //Invalid Channel

   ADCON0=0x00;

   ADCON0=(ch<<2);   //Select ADC Channel

   ADON=1;  //switch on the adc module

   GODONE=1;  //Start conversion

   while(GODONE); //wait for the conversion to finish

   ADON=0;  //switch off adc

   return ADRES;
}




THE PROGRAM IS AVAILABLE ON GITHUB : https://github.com/ebine/
 

KINECT : New Generation use It creative in new ways.


Microsoft built Kinect to revolutionize the way you play games and how you experience entertainment. Along the way, people started using Kinect in creative new ways. From helping children with autism, to helping doctors in the operating room, people are taking Kinect beyond games. And that’s what we call the Kinect Effect.





Tedesys is using Kinect technology in an operating room in Spain to help doctors navigate MRIs and CAT scans with a wave of their hand. It approved by national government agencies,

Therapists at Lakeside Center for Autism are integrating Kinect’s full body play technology into their therapy sessions.
 Rehabilitation therapists are making Kinect an important part of the rehabilitation process for stroke and other brain injury patients at Royal Berkshire Hospital.
The Kinect could recognize moods such as frustration, by looking at body posture and adjust games to be easier, suggested researcher Ulf Schwekendiek at NYU-Poly.

Kinect Fitnect – Interactive Dressing Room


The concept of a virtual fitting room has reached a new pinnacle of success! The Kinect Fitnect is an interactive dressing room which has bolstered the features of the idea and is surely nearing practical and commercial use. This video by Adam Horvath showcases this interactive dressing room at work and how through countless developments, the concept is becoming more viable. In the video, the user is seen interacting with a NUI while standing in front of the Kinect. The user then commences to try out different clothing by picking them through the control panel. The clothes then surround the user through the Kinect’s body tracking. The user exhibit shadow and physics effect, making this, the most convincing display of an interactive dressing room.


Kinect Kiwibank Interactive Wall

Play games, browse the internet and get necessary information through our wall! The Kinect Kiwibank Interactive Wall is a multi-feature interactive wall which allows top of the line computing to its users. This video by Lumen Digital displays the firm’s dedication in creating useful setups that make use of the Kinect. In the video, a user is seen interacting with the projected interface on the wall. Hand gestures help users play on-board games, browse through the internet and also research on compelling information. This handy setup is indeed the very foundations of cloud computing and we may soon see ourselves accessing the world wide web through various walls around the city!

Float Hybrid Entertainment with John Gaeta
Award winning visual effects designer, John Gaeta, is on-board the Kinect development train! The Float Hybrid Entertainment is a company formed by Matrix and Speed Racer visual designer, John Gaeta in an effort to push the world of interactive entertainment! This video by the company introduces us to their company and the various videos inside their Youtube Page are spectacular products! Various games are featured by the FLOAT Hybrid Entertainment company such as the World Builder, Infiltrator and Sound Flower. Each game utilizes the Kinect plus great gameplay and visuals in order to create a new gaming experience. Aside from these, the company has also made it possible to network multiple Kinects at one time!  With a gifted visual effects designer heading a team of dedicated Kinect minds,Float Hybrid Entertainment will surely be a major player in the Kinect industry!

Kinect JediBot
Want to train your lightsaber skills to be a Jedi? The Kinect JediBot gives users the feel of a great lightsaber fight by attacking and defending itself against users. This creation by Ken Oslund and Tim Jenkins gives the saber-wielding robot both offensive and defensive capabilities thanks to the Kinect’s sensor. In the video, the user is seen defending itself from the JediBot’s attack patterns. As the JediBot detects impact, the JediBot commences to renew another attack pattern, giving the user the feel of training defensively. Another mode that the JediBot can do is to defend itself against the user’s attack by detecting the light saber stance and trajectory through the Kinect. This results to a veryintuitive lightsaber duel between robot and man. May the force be with the Kinect!\

Kinect Augmented Urban Model
Urban development gets a Kinect kick and the results are just amazing! The Kinect Augmented Urban Model allows users to simulate urban time lines via a top mounted Kinect and an interactive table. This video by Katja Knecht displays this smart Kinect program and how engineers or urban developers can properly calculate some building dynamics (in this case, building shadow effects). In the video the user places blocks on top of the lighted table and the Kinect is able to detect these blocks and their depth. By putting an analog clock on the table and clocking it, the time frame of the urban setup changes and the blocks then conjure shadows based on on the time displayed. Developers then can calculate if their buildings will ruin the aesthetic value of other buildings. With these programs and Kinect hacks, urban development will surely reach a new phase of efficiency.

Kinect MultiTouch Surface with Grasshopper (for Architects)
Architects may soon find themselves buying their own Kinect devices for their professional work! The Kinect MultiTouch Surface with Grasshopper is a Kinect setup built to serve the purpose of communicating and collaborating architect designs and algorithms. This video by Dan Belcher and Viswa Kumaragurubaran displays how the Kinect’s depth detection can help create touch surface for short-day plan communication. In the video the user is seen preparing  and selecting various elements by touching a display surface. With the Kinect mounted at the top, the accuracy of the interaction between the user and the screen is impeccable. Various data then can be configured and edited through touch thanks to the Kinect and the Grasshopper software. The website explains the program/setup best and architects would greatly benefit from this program. Have a look and see how the Kinect has the potential to change the way we build our civilization

Kinect Real Hacking using Metasploit
This puts the art of computer hacking into a whole new interesting ground. The Kinect Real Hacking using Virtual Environment allows users to bypass systems and important firewalls by actually destroying them in an in-game environment. This video by jeffbryner displays this very intriguing program and how gestures may soon replace coding when hacking a computer. In the video, the user is plunged into a virtual reality scenario using the Kinect to navigate around and metasploit to be the chief foundation of the program. The environment is actually a visual representation of the framework of another computer/program. Then, with a first person shooter environment, users can “destroy” objects which represent the other computer’s security. Doing so will result into the user having full control or hack of that computer. It definitely sounds like the movie “The Matrix”! Gesture-based real hacking will have hackers giggling in delight and online security personnel cringing with fear!

Kinect Turntable Scanner
This cheap and affordable setup brings 3d scanning to all Kinect users! The Kinect Turntable 3D Scanner is an ingenious setup with the Microsoft device that rotates the item and allows a full 3d image to be captured. This video by A.J. Jeromin displays how the turntable works and the features that a Kinect user can make once he has a full 3d image scan of his desired object. In the video, the setup is introduced and the light that illuminates the object. A shoe was placed inside the turntable box and as the box begins to rotate, the Kinect is in charge of capturing the object detail. The result is a fully detailed 3d scan of the shoe for various uses. Innovations such as these bring much desired technology to everybody!

Kinect 3d Object and People Scan
For Second Life and archaeological digs, the Kinect can create 3d representations of scanned items and folks! TheKinect 3d Object and People Scan gives users the technology to scan their objects and people and create a virtual 3d representation of them. This video by Chris Palmer showcases this Kinect setup and how the future of gaming and inventory can radically be changed by the Kinect. In the video people and objects, through a guided Kinect is able to capture a robust 3d image. Not only that, but also the depth and texture of the object is captured, giving a more detailed scan. The 3d images can be handy and in this case, scanned images of people can properly be imported to the game, Second Life. Another use is predicted on the archaeological digs, scanning ancient items/relics to be studied in 3d by historians miles away!

 Kinect Head Tracking
The throne of our brain has entered the list of detectable body parts by the Kinect! The Kinect Head Tracking is proof that even the head of the user can now be used to provide interactive commands to the computers and machines! This video by Sezer Karaoglu displays the Kinect Head Tracking at work. In the video, a circular gauge at the screen is seen, showing the head alignment of the user. As the user tilts his head, the bar shows the movement of the user’s head and the direction. We can see from this hack that the Kinect is now able to read the user’s head movement. With this additional way to control Kinect, we can see virtual reality simulations change their POVs just by tilting the head!
 

Hard Resets & Soft Resets for Your NOKIA ASHA PHONES

Nokia adds three new models to its Asha line, including the Asha 202, Asha 203 and Asha 302. All of them uses the new enhanced Series 40 system with Nokia Life services. The 202 and 203 are updates to the Asha 200 and 201.Asha 305, Asha 306 and Asha 311- All the three phones got large touchscreens and is based on S40 OS
 Nokia Asha phones are aimed at buyers who are looking to spend a small amount of money on a phone yet want all the basic features of a smartphone.

1.- Basic Reset or Soft Reset Nokia Asha 

This option restores the .ini files from the ROM.
Does not erase data (photos, videos, documents) or applications from a third party. Key Code *# 7780 # (click this combination of keys on the keyboard in the mobile)

2.- Total Reset or Hard Reset Nokia Asha 

This option restores the original operating system from the ROM.
Formats the C: partition and deletes all data including the memory card. Key Code *#7370# (click this combination of keys on the keyboard in the mobile)
or
for the phones which have keypad
Turn the Mobile off.
Press and Hold “*“+ “3” + Call Green Keys.
Turn on the device by pressing the on button.
Wait until the Nokia Asha logo appear.

3.- Restore Factory Original Settings Nokia Asha 

End all calls and connections.
Select Menu Settings and Rest. fact. sett. Settings only.
Enter the security code. The default lock code (security code) is 12345.
 
 
Support : Ebin EPhrem | Ebin Ephrem | #Gabbarism
Copyright © 2011. Services | Embedded Support | Reviews | Virtual Technologys - All Rights Reserved
Template Created by ebinephrem.com Published by Ebin Ephrem
Proudly powered by Blogger