<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Microscale Embedded (Blog)</title>
	<atom:link href="http://microscale-embedded.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://microscale-embedded.com/blog</link>
	<description>sowing the seeds to Africa&#039;s Digital Revolution</description>
	<lastBuildDate>Tue, 08 May 2012 08:36:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>FOUR DIGITS PASSWORD BASED COMBINATION LOCK</title>
		<link>http://microscale-embedded.com/blog/?p=189</link>
		<comments>http://microscale-embedded.com/blog/?p=189#comments</comments>
		<pubDate>Tue, 08 May 2012 08:26:02 +0000</pubDate>
		<dc:creator>Sunday O. Efeh</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[PIC Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=189</guid>
		<description><![CDATA[An electronic lock allows activation of an electric appliance only on entering the correct password. Here we present such an electronic locking system in which a PIC16F84A microcontroller plays the role of the processing unit. The MCU is interfaced with a 4×4 matrix keypad. Using this circuit, you can make any electrical appliance password- protected. [...]]]></description>
			<content:encoded><![CDATA[<p>An electronic lock allows activation of an electric appliance only on entering the correct password. Here we present such an electronic locking system in which a PIC16F84A microcontroller plays the role of the processing unit. The MCU is interfaced with a 4×4 matrix keypad. Using this circuit, you can make any electrical appliance password- protected. It can also be used as electronic door lock by interfacing the output of the circuit with an electrically actuated door lock. The system turns on the appliance on entering a four digit password set by the user. The heart of the project is a PIC16F84A microcontroller.</p>
<p>The job of the MCU in this project is to receive signals from the input device (keypad) and take corresponding actions. Whenever any key is pressed on the keypad, the software program in the MCU identifies the pressed key and accordingly turns on or turns off the appliance. A 4×4 matrix keypad is used to give commands and the password to the MCU. It consists of 16 keys (S2-S17) arranged in the form of a square matrix of four rows and four columns. Each key in the matrix is labeled according to the operation assigned to it. The connections from the pin-outs of the keypad to the MCU pins are shown in Fig. 1. Rows 1 through 4 are connected to pins RB3, RB2, RB1 and RB0 of Port B of the MCU, respectively.<br />
The key identification is done by identifying the row and the column to which the key belongs. Fig. 1 shows how the keypad is connected to Port B of the MCU. The lower nibble of Port B is declared as output pins (scan lines) and the upper nibble is declared as input pins (return lines).</p>
<p>Whenever a key is pressed, the up- per nibble pin (return line) of Port B, to which the column containing the key is connected, goes high. Thus the column is identified. Column identification is done using a switch-case block in the main program. On identifying the column. To identify the row, scan lines are made low one by one in sequence and status of the return line corresponding to the key is checked. If it becomes low, the key belongs to that scan line or row. After identifying the key, the correct key is generate and the returned by the Getkey_Pressed() function.<br />
To open the door, press the open button, enter the correct password, if correct the buzzer beeps three times and the door opens and closes, else beeps twice. to do download the circuit, click on the link below..</p>
<p><a href="http://microscale-embedded.com/blog/wp-content/uploads/2012/05/PASS_DOOOR.pdf">PASS_DOOOR</a>.click to download circuit.</p>
<pre>The software code is written with C language an compiled using Mikro C pro pic compiler.
Below is the C code.</pre>
<pre></pre>
<pre>/************************************************************************************
********************four digits password combination lock****************
************************************************************************************/
sbit Row0 at RB4_bit;
sbit Row1 at RB5_bit;
sbit Row2 at RB6_bit;
sbit Row3 at RB7_bit;

sbit MTR1 at RA4_bit;
sbit MTR0 at RA3_bit;
sbit Buzzer at RA2_bit;
sbit Status_Light at RA0_bit;
sbit Button at RA1_bit;

unsigned char  key_pressed;
bit key_flag;
bit Wait_Time;
unsigned char  Temp_Pass[5];
//unsigned char  Default_Pass[5]="0000";

unsigned char  KEYPAD at PORTB;
int count;
bit Default_State;
/************************************************************************************
********************this fuction gets the keypressed from the matrix keypad***********
************************************************************************************/
char Getkey_Pressed(void)
{
        key_flag=0;
        KEYPAD=0xFE;                                 //scan  col1
        if(!Row0 ||!Row1 || !Row2 || !Row3)
        {
        if(!Row0)key_pressed='1';                           // check for key pressed
        else if(!Row1)key_pressed='4';
        else if(!Row2)key_pressed='7';
        else if(!Row3)key_pressed='*';
        while(!Row0 ||!Row1 || !Row2 || !Row3) ;
        key_flag=1;
        }

        KEYPAD=0xFD;
        if(!Row0 ||!Row1 || !Row2 || !Row3)
        {
        if(!Row0)key_pressed='2';          //scan  col2
        else if(!Row1)key_pressed='5';          // check for key pressed
        else if(!Row2)key_pressed='8';
        else if(!Row3)key_pressed='0';
        while(!Row0 ||!Row1 || !Row2 || !Row3) ;
        key_flag=1;
        }

        KEYPAD=0xFB;                                                   //scan  col2
        if(!Row0 ||!Row1 || !Row2 || !Row3)
        {
        if(!Row0)key_pressed='3';
        else if(!Row1)key_pressed='6';        // check for key pressed
        else if(!Row2)key_pressed='9';
        else if(!Row3)key_pressed='#';
        while(!Row0 ||!Row1 || !Row2 || !Row3) ;
        key_flag=1;
        }

        KEYPAD=0xF7;                                                         //scan  col2
        if(!Row0 ||!Row1 || !Row2 || !Row3)
        {
        if(!Row0)key_pressed='A';
        else if(!Row1)key_pressed='B';           // check for key pressed
        else if(!Row2)key_pressed='C';
        else if(!Row3)key_pressed='D';
        while(!Row0 ||!Row1 || !Row2 || !Row3) ;
        key_flag=1;
        }
        return key_pressed;                        //return key pressed
}

void Beep(void)
{
   Buzzer=1;
   Delay_ms(800);
   Buzzer=0;
}
/************************************************************************************
********************this function opens and closes the door         ****************
************************************************************************************/
void Open_Close_Door(void)
{
        MTR0=1;
        MTR1=0;
        Delay_ms(2000);
        MTR0=0;
        MTR1=0;
        Delay_ms(3000);

        MTR0=0;
        MTR1=1;
        Delay_ms(2000);
        MTR0=0;
        MTR1=0;
        return;
}
/************************************************************************************
**********this fuction writes a byte to the internal EEPROM of the pic16f84 chip*****
************************************************************************************/
unsigned char EEPROM_Read(char adr)
{
   INTCON.GIE = 0;    //global interrupt enable
   EEADR=adr;
   EECON1.RD=1; // set the read bit
   INTCON.GIE = 1;    //global interrupt enable
   return(EEDATA);
}
 /************************************************************************************
******this fuction reads from a byte from the internal EEPROM of the pic16f84 chip*****
************************************************************************************/
void EEPROM_Write(unsigned char adr, unsigned char dat)
{
   INTCON.GIE = 0;    //global interrupt enable
   EEADR = adr;
   EEDATA = dat;

   EECON1.WREN = 1;  // write enable
   EECON2 = 0x55; // protection sequence
   EECON2 = 0xaa;

   EECON1.WR = 1;  // begin programming sequnce
   Delay_ms(20);
   EECON1.WREN = 0;  // disable write enable
   INTCON.GIE = 1;    //global interrupt enable
   return;
}

/************************************************************************************
******this fuction matches the user entered password and the admin set password*****
************************************************************************************/
int Match_Password(unsigned char *Admin,unsigned char Chr )
{
        int pas;
        unsigned char Rx_key;
        unsigned char  temp[5];

        pas=0;
        for(pas=0;pas&lt;4;pas++) temp[pas]='';
        pas=0;
        Rx_key='';

        temp[pas]=Chr;

        pas=1;

        do
                {
                Rx_key=Getkey_Pressed();
                if(key_flag!=0)
                {

                if(Rx_key!='*'&amp;&amp;Rx_key!='#'&amp;&amp;pas&lt;4)
                {
                temp[pas]=Rx_key;
                pas=pas+1;
                Status_Light=1;
                Delay_ms(500);
                Status_Light=0;
                }
                }
         }while(Rx_key!='#'|| pas&lt;4);

                 if(strncmp(Admin,temp,4)==0)//
                         return 1;

                else
                        return 0;
}
/************************************************************************************
*                        finger print and pass word based attendance system                                                *
************************************************************************************/
 int Set_Password(unsigned char *Admin )
 {
      int pas,ii;
        unsigned char Rx_key;
        unsigned char  temp[10];

        pas=0;
        for(pas=0;pas&lt;4;pas++) temp[pas]='';
        pas=0;
        Rx_key='';

        do
                {
                Rx_key=Getkey_Pressed();
                if(key_flag!=0)
                {

                if(Rx_key!='*'&amp;&amp;Rx_key!='#'&amp;&amp;pas&lt;4)
                {
                temp[pas]=Rx_key;
                pas=pas+1;
                Status_Light=1;
                Delay_ms(500);
                Status_Light=0;
                }
                }
         }while(Rx_key!='#'|| pas&lt;4);

         do
                {
                Rx_key=Getkey_Pressed();
                if(key_flag!=0)
                {

                if(Rx_key!='*'&amp;&amp;Rx_key!='#'&amp;&amp;pas&lt;8)
                {
                temp[pas]=Rx_key;
                pas=pas+1;
                Status_Light=1;
                Delay_ms(500);
                Status_Light=0;
                }
                }
         }while(Rx_key!='#'|| pas&lt;8);

                 if(strncmp(Admin,temp,4)==0)//
                       {
                         for(ii = 0; ii &lt; 4; ii++)             // Fill data buffer
                         EEPROM_Write(0x00+ii,temp[ii+4]);           // Write data to address 0x80+ii

                         for(ii = 0; ii &lt; 4; ii++)           // Read 4 bytes block from address 0x80
                         Temp_Pass[ii]= EEPROM_Read(0x00+ii);        //   into temp storage;

                         return 1;
                       }
                else
                        return 0;
 }
 /*********************************************************************************
 * *********************body of main program***************************************
************************************************************************************/
void main (void)
{
     int ii;
    char Rx_Key;

    TRISB=0xF0;
    TRISA=0x02;
    Status_Light=0;
    MTR0=0;
    MTR1=0;

    /**********************************************************************************
      *********this fuction writes a default password to the EEPROM********************
      *****This is a manufacturer's function call and must be at program start up..****
      ****Note***this fuction must be evoked once and only once during the product's*****
      *                            life cycle...                                      *
      *********************************************************************************/
      if(!Button)
      {
       Delay_ms(200);
       if(!Button){
                  Delay_ms(3000);
                   if(!Button)
                    {
                   for(ii = 0; ii &lt; 4; ii++)             // Fill data buffer
                    EEPROM_Write(0x00+ii,'0');           // Write data to address 0x80+ii
                    }
                   }
      }

    for(ii = 0; ii &lt; 4; ii++)           // Read 4 bytes block from address 0x00
    Temp_Pass[ii]= EEPROM_Read(0x00+ii);        //   into temp storage;

while(1)                    //do this forever
    {
      if(!Button)            //check if the Button is pressed
      {
                   do
                   {
                   Rx_Key=Getkey_Pressed();    //get first character from keypad
                             }while(key_flag==0);  //do this untill a Button is pressed
                   if(key_flag!=0)
                        {
                        if(Rx_Key=='*')      //check if user intends to change the password
                         {
                            if(Set_Password(Temp_Pass))     // check if user old password is correct and save new password
                               {
                                    Beep();
                                    Beep();
                                    Beep();
                               }
                               else Beep();    //else wrong password

                         }
                         else
                         {
                          Status_Light=1;
                          Delay_ms(500);
                          Status_Light=0;
                             if(Match_Password(Temp_Pass,Rx_Key))  //check if user password entered is correct
                               {
                                   Beep();
                                   Beep();
                                   Beep();
                                   Open_Close_Door();    //open and close door
                               }
                               else Beep();        //else wrong password

                         }
                         key_flag=0;
                        }
    }
    }
}</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=189</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build your own Calculator using PIC16F887, 16x2LCD and 4&#215;4 keypad</title>
		<link>http://microscale-embedded.com/blog/?p=184</link>
		<comments>http://microscale-embedded.com/blog/?p=184#comments</comments>
		<pubDate>Thu, 15 Dec 2011 12:33:11 +0000</pubDate>
		<dc:creator>Jude Ozioko</dc:creator>
				<category><![CDATA[PIC Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=184</guid>
		<description><![CDATA[This is a simple calculator project.  You can use it to do your simple calculations such as addition, subtraction, multiplication and division. The hardware design is very simple: just interface your 16x2LCD and 4&#215;4 keypad to the microcontroller. All the components used are available here: www.microscale-embedded.com &#160; The source code is shown below: #include "main.h" [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/12/Calculator1.jpg"><img class="alignnone size-medium wp-image-185" src="http://microscale-embedded.com/blog/wp-content/uploads/2011/12/Calculator1-300x227.jpg" alt="Calculator Circuit" width="300" height="227" /></a></p>
<p>This is a simple calculator project.  You can use it to do your simple calculations such as addition, subtraction, multiplication and division. The hardware design is very simple: just interface your 16x2LCD and 4&#215;4 keypad to the microcontroller.</p>
<p>All the components used are available here: www.microscale-embedded.com</p>
<p>&nbsp;</p>
<p>The source code is shown below:</p>
<pre>#include "main.h"
#include "lcd.c"
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
char row = 0xef;
char col;
char Read_keypad()
{
   byte scancode;
   while(1)
   {
      if((row &amp; 0xf0) != 0xf0) //check if we're not done shifting 4 places
         row &lt;&lt;= 1; //continue, shift left by one bit
      else
         row = 0xef;//done shifting, so reset to initial value

      output_C(row);
      col = input_A();
      col &amp;= 0x0f;//clear upper 4 bits of colunm
      scancode = col | (row &amp; 0xf0);//clear lower 4 bits of row and combine with
                               //upper 4 bits of colunm to form the scan code
      switch(scancode)
      {
         case 0x7D: return '0';    // note that the scancode is formed by
         case 0xBE: return '9';    // combining the row code and the column code
         case 0xBD: return '0';    // rows and columns are coded as follows;
         case 0xBB: return '+';    //    0  -&gt;  E
         case 0xDE: return '5';    //    1  -&gt;  D
         case 0xDD: return '6';    //    2  -&gt;  B
         case 0xDB: return '7';    //    3  -&gt;  7
         case 0xEE: return '1';    //
         case 0xED: return '2';    // so for key '0' for example, which is on
         case 0xEB: return '3';    // row 3 and column 1 the scancode will be:
         case 0x7E: return '.';    //      7D
         case 0x7B: return '*';
         case 0x77: return '+';
         case 0xB7: return '4';
         case 0xD7: return '8';
         case 0xE7: return '/';
      }
   }
}

void main()
{
double display = 0;//stores the value to be displayed on the screen
   double operand1, operand2;//store the operands to be used for the next operation
   char operation;//next operation to be performed
   char key;// stores the key pressed
   double digit;//stores key in numeric format

   int dp = 0; //indicates when the decimal point has been pressed

   lcd_init();
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
lcd_init();
   // TODO: USER CODE!!
while(1)
   {
      lcd_gotoxy(1,1);
      printf(lcd_putc,"%15.0f", display);
      key = Read_keypad();
      delay_ms(100);//delay for key-debounce, change the interval to tune performance
      if(key &gt;= '0' &amp;&amp; key &lt;= '9')
      {
         digit = atof(&amp;key);
         if(dp == 0)
         {
            if(operand1 &lt; 10000000)
               operand1 = operand1 * 10 + digit;
            display = operand1;
         }
         else
           display = display * 10 + digit;//todo fix this
      }
      else if(key == '.')
      {
      }
      else
      {
         switch(operation)
         {
            case '+': display = operand2 + operand1; break;
            case '-': display = operand2 - operand1; break;
            case '*': display = operand2 * operand1; break;
            case '/': display = operand2 / operand1; break;
            case '=':
         }
         operation = key;
         operand2 = display;
         operand1 = 0;
      }
   }

}</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=184</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>8051 base digital clock and calender using DS1302</title>
		<link>http://microscale-embedded.com/blog/?p=166</link>
		<comments>http://microscale-embedded.com/blog/?p=166#comments</comments>
		<pubDate>Mon, 28 Nov 2011 12:44:39 +0000</pubDate>
		<dc:creator>Sunday O. Efeh</dc:creator>
				<category><![CDATA[8051 Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=166</guid>
		<description><![CDATA[This is a simple digital clock with calendar project using stc90c52rc micro-controller and 16&#215;2 LCD display. The timing is based on the real time clock chip DS1302. Components lists 1.         STC90C52RC 2.        16X2 GRAPHIC LCD 3.        DS3102 4.        XTAL.  11.0592MHz. 5.        4.7K Ohms Resistor                (3 nos.) 6.        10K Ohms Resistor  (1 nos.) 7.        7805 [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left"><em>This is a simple digital clock with calendar project using stc90c52rc micro-controller and 16&#215;2 LCD display.</em><br />
<em> The timing is based on the real time clock chip DS1302.</em></p>
<p style="text-align: center"><img src="image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYoAAACkCAIAAAAGzf61AAAIv0lEQVR4nO3dUZabOBBAUa1pVpCvWRfrmZX4c5bATmY+nCYCIQGiSlUFj3NPjuN0MDjtl4LG3ek/FhYWFpdLst4AFhYWlv3ld57m+V8AcII8AXCKPAFwijwBcIo8AXCKPAFwijwBcIo8AXCKPAFwijwBcIo8AXCKPAFwijwBcIo8AXCKPKFfSun763cpb5tvIUIjT+iX1stMniCKPAFwijyhXzk35febbx6iI08AnCJPAJwiTwCcIk/oN6X0EuZP9TuRJ/SbUvp8/nk88mSFPKFfnqf0uIU8mSNP6Det8/TX389BnjwgT+hHnqCKPKEfeYIq8oR+5AmqyBP6kSeoIk/oR56gijyhH3mCKvKEfuQJqsgT+pEnqCJP6Ddx1Tg0kSf0myrvuUvrbJm/ae4m8mSFPKHfpTzVOnW1ZYcfU1thdzTJkxXypCutP7PTsz7Ra3najYV4nq5mqDtV5MkKedK1nMhYfmu+SYLO5OnSNHSmGuTpPcgT+onkyT/yZIU8qZusv9PjoQfvmvlThDvIk7y0/mye3I8Y+csvSfwEzWWF+ZprL/Lax+x+/JkPPrx9ZqvgAXkS0/i/91Oc7PguSrlJP4+YL+U9ywaIjwxlCNLeCr8RnLIglrdra15W2P6L5e18S3a3Cn6QJ3XhpqfvcnOX5+LF387T5i/WPr5WlnaeNveTpyjIk7rxedrMSuXUthncxF+iZQjm+mFUe9jp+ODD22e2Ch6QJ3UhpifZg7urz89yO/3av31pJYcr7H4UDEae1IXI07K194/srqrFQiQc5Ck08qTO/OAuZdcx7h7f2U5P5Ak15ElYOX1EnJ5GDlDkCTXkSUxtBpnqFxYknXKVp8Z356l0dGFB+nVB9/NGnlBDntSFm56WXy/pfp2TJ9SQJ3Uezj3t3nN/esp3kzxBHHlSF256On/uSeR1Tp5QQ57UmU9Pu/PUZ33uqW/XyBNUkSd1IaanSwd3y66RJ6giT+pC5GnZ2sNT4+QJw5AndeYHd92nxnd3hzxhGPIkbzN6hJue2ufFyROGIU9iajPIlE0unxPf2VpjelruL+9kejL/zEENeVIXa3o6RJ4wDHlSR54Gr/Bw5eQpCvKkLlCe2medfn8MecIo5EmdVZ52TzmVv2V6Mv8MQQ15UhdietpVuywzkPwfgjyFQ57UhcjTd1PT0TWZc7TpafeByFMU5Emdk4O7/P5UvOfuqdPT7iRFnqIgT+rCTU9zc4CKOz0NfhTcR57UmeQpn492x6j89kump8NJCt6QJzG10WOqvN9tWbxNT9+tqu5m/Omp9ujwhjyJqc0gU2WEUW1TWk9P7Uesbbb5jDN4koI35EnSMhDld04O5qNL09P89HNPiII8qZsqF0OqOpye8s2Y6jEqkScMQ57ETCml+sGdZ3+O5n5+TWMP7pbnkDwhR57UmUxPV/N0fndUa0KekCNPYnbnpml9atzPwd3H62WZy/NJnkCe1E3+xqXa9JQs3tRy5oHwTuRJnUmeDqen/Lar6Wl3ksI7kSd1EaenxgDFmWwMQ57UeZieyonpc+Lc0+7ukCcMQ57UBZqeziBPGIY8qSNPQB/ypC5cngafe6JrqCFP6qbix9vVzgFJ2ZxsSuvrQssNMJye+CIdGsiTmNoJ5hDTk8mpcS4jQBt5ElYeFoXI04Ud5OAOo5AnMe3pqXE0t3sRwB21Kwk+lffW2F5YQJ5QQ57kbQYoJ9NT2lt2p6fGefGZPGEg8iSme3oSz9AmSZs8lX/E9ASfyJOw78s+vyfc9DTbfbdMIEeexFyanvQGqHJMS8WFBRtBp6elocuumX8OQBZ5kudzemoozz2FmJ42k6D5vzvEkSd1g6en3UmqPKBrH9w1+MkTHo88iWkf3HkW9OCu8YQfMv9swRnkSVh5oBEiT+VeVHfQLk+b57b7ic33l6NCz8iTmPb05OHg7lO5psH/9HQ4luY7WO7j5h6mqijIk7Dyf2NX01NaL7vTUzkArv7U08Hd/ekJnpEnMa6mp7R3Urw2YphPT4euTk/tp5c8RUGehJWjR8TpqbWDbr4dHdPT45EnMZempzEl2iTps3eFgfn0dOcJJ0/PRp7UuZqe7r9cyROGIU/qyJO3J5Y8RUGe1DUO+py4tDvkCcOQJ135mfLl9nL2Zz76Kr5DtnnKn6upOJtWnlYjT6GRJ1zTyJOe2tz3WV8kcRgm8hQLecI14hPTpTe15L/l4O7xyBOuUZ2S+i7LzI/pOLh7EvKEfqrTU3n/Nz3Lb6Wmp0StvCJP6OdhejozNKX1lbG1tTFVeUOeYKz7S4Gce3o88gRj5Ak15AnG7lxI1ThMazPfa5xBnmCsO0/LmfL83HbKFvNdw03kCcZsL0OHZ+QJxsgTasgTjDXypMd8r3EGeYKx8RMTeYqCPMHYsImJqSoc8gRj46NQe0Ty5A15gjHyhBryBGPmB3Qc9LlFnvA6V6cn8mSFPOF1yFMU5AmvQ56iIE94HfIUBXnC65CnKMgTXoc8RUGeIMz/V+LJUxTkCZK+r2TnhSJPUZAnSLK6lDH9LPOJn7xCnqIgT5Bn8D6VLEzk6THIE+T5fz3vTnnkyRvyBHnjX89T748/IE+ekSfIG/M23U19zvz8qAXTUwjkCZHUSnFmeqoNUIcrJ09WyBMiaZdi+eKd7MrJkxXyhEhUS0GevCFPiIQ8vQp5QiTVghSL5MrJkxHyhEgaeZrX145Lrpw8GSFPiISDu1chT4jkzoUF3SsnT1bIEyLRuCzz8G3M5MkKeUIkqpdlXn1QaCNPiET1ssy+B4Ue8oRITEpBnqyQJ0RCnl6FPCES8vQq5AmRkKdXIU+I5Ewp8mvHRc6Ukycr5AmRnMzTvH4X3oAHhQbyhEg4uHsV8oRIzpRC/PpM8mSFPCESke87vvngM9/X3HzH34k84Wn03t2CwcgTHkjqpDhskScATpEnAE6RJwBOkScATpEnAE6RJwBOrfLEwsLC4m0hTywsLE6X/wEj9TNKEv4YQgAAAABJRU5ErkJggg==" alt="" /></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: 90%;text-align: left"><strong><em><span style="font-family: 'Agency FB','sans-serif'">Components lists</span></em></strong></p>
<p class="MsoListParagraphCxSpFirst" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>1.<span style="font: 7pt 'Times New Roman'">         </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">STC90C52RC</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>2.<span style="font: 7pt 'Times New Roman'">        </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">16X2 GRAPHIC LCD</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>3.<span style="font: 7pt 'Times New Roman'">        </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">DS3102</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>4.<span style="font: 7pt 'Times New Roman'">        </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">XTAL.<span>  </span>11.0592MHz.</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>5.<span style="font: 7pt 'Times New Roman'">        </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">4.7K Ohms Resistor <span>               </span>(3 nos.)</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>6.<span style="font: 7pt 'Times New Roman'">        </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">10K Ohms Resistor<span>  </span>(1 nos.)</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>7.<span style="font: 7pt 'Times New Roman'">        </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">7805 <span>                                       </span>(1 nos.)</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;text-indent: -18pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>8.<span style="font: 7pt 'Times New Roman'">        </span></span></span></em><em><span style="font-family: 'Agency FB','sans-serif'">9V battery</span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"> </span></em></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"> </span></em></p>
<p class="MsoListParagraphCxSpLast" style="margin-bottom: 0.0001pt;line-height: 90%;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">C sources codes below</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif'"> </span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/***********************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((&lt;digital clock and calender using 8051 mcu&gt;)))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">#include</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: #a31515">&lt;LIB_STC_MCU.h&gt;</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">#include</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: #a31515">&lt;intrins.h&gt;</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">#include</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: #a31515">&lt;Lib_Delay.c&gt;</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">#include</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: #a31515">&lt;stdio.h&gt;</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">#include</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: #a31515">&lt;RTC_C51.c&gt;</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">#include</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: #a31515">&lt;lcd_4.h&gt;</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/**************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">((((((((((((((((((((&lt;this sets the time on the ds1302&gt;)))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">***************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_time(<span style="color: blue">void</span>)<span>                 </span><span>  </span><span style="color: green">//</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>Set_Seconds(0);<span>                     </span> <span style="color: green">//initialise seconds to 00</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>Set_Minutes(any value btwn 00 to 59);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>Set_Hour(any value btwn 00 to 23);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>Set_Date(any value btwn 01 to 31) ;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>Set_Month(any value btwn 01 to 12);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>Set_Day(any value btwn 01 to 07);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>Set_Year(any value btwn 01 to 99);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/****************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((&lt;displays current time and date on lcd&gt;)))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">*****************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Display(<span style="color: blue">void</span>)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span><span> </span><span>               </span>Read_Time();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Lcd_Cursor(1,1);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>printf(<span style="color: #a31515">&#8220;%d:%d:%d %s&#8221;</span>,hours,minutes,seconds,*day[week_days-1]);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Lcd_Cursor(2,1);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>printf(<span style="color: #a31515">&#8220;Date: %d/%d/20%d &#8220;</span>,date,month,year);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Delay_ms(1000);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((&lt;body of main program&gt;)))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">*************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> main(<span style="color: blue">void</span>)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Lcd_Init();<span>  </span><span>                              </span><span>   </span><span style="color: green">//initialises lcd</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>DEVICE=LCD;<span>             </span><span>                       </span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Lcd_Cmd(_LCD_CLEAR);<span>            </span><span style="color: green">//clear lcd screen at default</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Delay_ms(500);<span>                                      </span> <span style="color: green">//wait awhile</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Rtc_Start();<span>                                             </span> <span style="color: green">//start time clock</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Set_time(); <span>                                             </span><span style="color: green">//set time</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: green"> </span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span><span style="color: blue">while</span>(1)<span>    </span><span style="color: green">//loop forever</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                </span>Display();<span>   </span><span style="color: green">//display current time and date</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;the end&gt;)))))))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">*************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green"> </span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green"> </span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/******************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;RTC_C51.c&gt;)))))))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">*******************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">sbit SCLK =P0^5;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">sbit DATA=P0^4;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">sbit RST=P0^3;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">int</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> a;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> clk_write(<span style="color: blue">unsigned</span> <span style="color: blue">char</span>);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">unsigned</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: blue">char</span> clk_read(<span style="color: blue">void</span>);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> RST_toggle (<span style="color: blue">void</span>);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> clkburst(<span style="color: blue">void</span>);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"> </span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">int</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> idata seconds, minutes, hours,week_days, date, month, year; <span style="color: green">// Global date/time variables</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">unsigned</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: blue">char</span> idata *day[7]={<span style="color: #a31515">&#8220;Sun.&#8221;</span>,<span style="color: #a31515">&#8220;Mon.&#8221;</span>,<span style="color: #a31515">&#8220;Tue.&#8221;</span>,<span style="color: #a31515">&#8220;Wed.&#8221;</span>,<span style="color: #a31515">&#8220;Thu.&#8221;</span>,<span style="color: #a31515">&#8220;Fri.&#8221;</span>,<span style="color: #a31515">&#8220;Sat.&#8221;</span>};</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;CE latch&gt;)))))))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">**************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> RST_toggle (<span style="color: blue">void</span>)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>   </span>RST = 0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>   </span><span style="color: blue">for</span>(a=0;a&lt;10;a++);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>   </span>RST = 1;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;writes a byte to rtc&gt;)))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">*************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> clk_write(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> dat)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span><span style="color: blue">char</span> x;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span><span style="color: blue">for</span>(x=0;x&lt;8;x++)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span>{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span><span style="color: blue">if</span>(dat &amp; 0&#215;01)<span>                        </span><span style="color: green">//put bit on data pin</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>DATA = 1;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span><span style="color: blue">else</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>DATA = 0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>SCLK = 1;<span>                                </span><span style="color: green">//toggle clock to latch bit</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                                                </span><span style="color: blue">for</span>(a=0;a&lt;10;a++);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>SCLK = 0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>dat &gt;&gt;= 1;<span>                        </span><span style="color: green">//move next bit into place</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span>}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*********************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;reads a byte from rtc&gt;))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">**********************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">unsigned</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> <span style="color: blue">char</span> clk_read(<span style="color: blue">void</span>)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span><span style="color: blue">char</span> x;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span><span style="color: blue">unsigned</span> <span style="color: blue">char</span> dat,tmpdat;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span>dat = 0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span>DATA = 1;<span>                                </span><span style="color: green">//make DATA input</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span><span style="color: blue">for</span>(x=0;x&lt;8;x++)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span>{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span><span style="color: blue">if</span>(DATA)<span>                                </span><span style="color: green">//read a bi</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                        </span>tmpdat |= 1;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span><span style="color: blue">else</span> tmpdat |= 0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>               </span><span> </span>tmpdat &lt;&lt;= 7;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>dat &gt;&gt;= 1;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>dat |= tmpdat;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>SCLK = 1;<span>                                </span><span style="color: green">//toggle clock to latch bit</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                                                                </span><span style="color: blue">for</span>(a=0;a&lt;10;a++);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>                </span>SCLK = 0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span>}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span>DATA= 0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>        </span><span style="color: blue">return</span>(dat);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/**********************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;reads rtc time and date&gt;))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">***********************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Read_Time() </span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>RST = 1;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>clk_write(0&#215;81);<span>    </span>seconds =clk_read(); RST_toggle ();<span>   </span><span style="color: green">// Read seconds byte</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>clk_write(0&#215;83);<span>    </span>minutes = clk_read();<span>    </span>RST_toggle ();<span>    </span><span style="color: green">// Read minutes byte</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>clk_write(0&#215;85);<span>    </span>hours = clk_read();<span>      </span>RST_toggle ();<span>   </span><span style="color: green">// Read hours byte</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>clk_write(0&#215;87);<span>    </span>date = clk_read();<span>       </span>RST_toggle ();<span>   </span><span style="color: green">// Read year/day byte</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>clk_write(0&#215;89);<span>    </span>month = clk_read();<span>      </span>RST_toggle (); <span style="color: green">// Read weekday/month byte</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>clk_write(0x8d);<span>    </span>year<span>  </span>=clk_read();<span>       </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>  </span>clk_write(0x8b);<span>    </span>week_days<span>  </span>=clk_read();<span>  </span>RST = 0;<span>        </span><span style="color: green">// Issue stop signal</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif';color: green"> </span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>     </span>seconds<span>  </span>=<span>  </span>((seconds &amp; 0xF0) &gt;&gt; 4)*10 + (seconds &amp; 0x0F);<span>  </span><span style="color: green">// Transform seconds</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>     </span>minutes<span>  </span>=<span>  </span>((minutes &amp; 0xF0) &gt;&gt; 4)*10 + (minutes &amp; 0x0F);<span>  </span><span style="color: green">// Transform months</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>     </span>hours<span>    </span>=<span>  </span>((hours &amp; 0xF0)<span>  </span>&gt;&gt; 4)*10<span>  </span>+ (hours &amp; 0x0F);<span>    </span><span style="color: green">// Transform hours</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>     </span>date<span>      </span>=<span>  </span>((date &amp; 0&#215;30) &gt;&gt; 4)*10<span>    </span>+ (date &amp; 0x0F);<span>       </span><span style="color: green">// Transform day</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>     </span>week_days =<span>  </span>((week_days &amp; 0&#215;30) &gt;&gt; 4)*10<span>    </span>+ (week_days &amp; 0x0F);<span>       </span><span style="color: green">// Transform day</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>     </span>month<span>    </span>=<span>  </span>((month &amp; 0&#215;10)<span>  </span>&gt;&gt; 4)*10 + (month &amp; 0x0F);<span>     </span><span style="color: green">// Transform month</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>     </span>year<span>  </span>=<span>  </span>((year &amp; 0xF0) &gt;&gt; 4)*10 + (year &amp; 0x0F);<span>           </span><span style="color: green">// Transform year</span></span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/***************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;sets seconds&gt;)))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">***************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_Seconds(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> Sec)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0&#215;80);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(((Sec/10)&lt;&lt;4 | (Sec%10)));</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST=0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/**************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;sets minutes&gt;)))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">**************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_Minutes(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> mins)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0&#215;82);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(((mins/10)&lt;&lt;4 | (mins%10)));</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST=0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;sets the hour&gt;))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">************************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_Hour(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> hr)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0&#215;84);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(((hr/10)&lt;&lt;4 | (hr%10)));</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST=0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*******************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;sets the day of month&gt;))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">********************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_Date(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> date)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0&#215;86);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(((date/10)&lt;&lt;4 | (date%10)));</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST=0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*********************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;sets the month&gt;)))))))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">**********************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_Month(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> month)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0&#215;88);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(((month/10)&lt;&lt;4 | (month%10)));</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST=0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*******************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;sets day of the week&gt;)))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">********************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_Day(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> Day)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0x8A);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(((Day/10)&lt;&lt;4 | (Day%10)));</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST=0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*******************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;sets the rtc year&gt;))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">********************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Set_Year(<span style="color: blue">unsigned</span> <span style="color: blue">char</span> year)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0x8C);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(((year/10)&lt;&lt;4 | (year%10)));</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST=0;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/*******************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;stars rtc clock&gt;))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">********************************************************************/</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif';color: blue">void</span></em><em><span style="font-family: 'Agency FB','sans-serif'"> Rtc_Start(<span style="color: blue">void</span>)</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">{</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>RST_toggle ();</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span>clk_write(0&#215;00);</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'"><span>    </span><span style="color: blue">return</span>;</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: left"><em><span style="font-family: 'Agency FB','sans-serif'">}</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">/**********************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: normal;text-align: center"><em><span style="font-family: 'Agency FB','sans-serif';color: green">(((((((((((((((((((((((((((((((((((((&lt;the end&gt;)))))))))))))))))))))))))))))))))))))))))</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;line-height: 90%;text-align: center"><em><span style="line-height: 90%;font-family: 'Agency FB','sans-serif';color: green">***********************************************************************/</span></em><em></em></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=166</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LM35 temperature Datalogger</title>
		<link>http://microscale-embedded.com/blog/?p=164</link>
		<comments>http://microscale-embedded.com/blog/?p=164#comments</comments>
		<pubDate>Mon, 28 Nov 2011 12:27:40 +0000</pubDate>
		<dc:creator>Jude Ozioko</dc:creator>
				<category><![CDATA[PIC Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=164</guid>
		<description><![CDATA[Temperature datalogger is a good choice of project for beginners who just stepped into the world of microcontrollers because it provides an opportunity to learn using sensors to measure the real world signals that are analog in nature.LM35 is a precision centigrade temperature sensor that converts the surrounding temperature to a proportional analog voltage. It [...]]]></description>
			<content:encoded><![CDATA[<pre>Temperature datalogger is a good choice of project for beginners
who just stepped into the world of microcontrollers because it provides
an opportunity to learn using sensors to measure the real world signals
that are analog in nature.LM35 is a precision centigrade temperature sensor
that converts the surrounding temperature to a proportional analog voltage.
It has a range of -55 degree centigrade to +150 degree centigrade and an
accuracy of +/- 0.5 degree centigrade. The output voltage is 10mV/degree
Centigrade.
The output from the sensor is connected to one of the ADC channel inputs of
the PIC16F887 microcontroller to derive the equivalent temperature value
in digital format.

The computed temperature is displayed in a 16x2 character LCD and also send
to the serial port for further usage. Note, you can use hyperterminal or
CCS siow.exe terminal window to text the serial section.</pre>
<pre>The circuit is here:</pre>
<pre><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/11/temp_logger.docx">temp_logger</a></pre>
<pre>List of components used:</pre>
<pre>Components     quantity</pre>
<pre>PIC16F887         1</pre>
<pre>MAX232            1</pre>
<pre>16x2 LCD          1</pre>
<pre>LM35              1</pre>
<pre>100nF Capacitor   4</pre>
<pre>DB9 Connector     1</pre>
<pre>You can buy all these components at www.microscale-embedded.com</pre>
<pre>The source code is below:</pre>
<pre>#include &lt;16f887.h&gt;
#device ADC=10
#use delay(clock=4000000)
#fuses XT, NOWDT, NOPROTECT, NOLVP
#use RS232(baud = 9600, xmit = PIN_C6, rcv = PIN_C7)

#include &lt;lcd.c&gt;

void main(void)
{
       int16 temp_adc;
       float temp;

        setup_adc(ADC_CLOCK_DIV_8);
        setup_adc_ports(sAN0);
        set_adc_channel(0); //read analog input from channel 0

        lcd_init();

        printf ( lcd_putc, "Temperature is\n" );	//print to lcd
        printf ("Temperature is\n\r" );				//print to serial com

        while(true)
          {
            delay_ms(10);
            temp_adc = read_adc();
            temp = 5.00*temp_adc*100.00/1023.00; // = temp_adc*0.48828125;
         //  temp = temp_adc*0.48828125;
         lcd_gotoxy(5,2);
         printf ( lcd_putc,"%5.1f", (float)temp);
         lcd_putc(223);		//this number 223 will display the degree sign
         lcd_putc('C');

         printf ("%5.1f", (float)temp);
         putc(223);
         putc('C');
         printf ("\n\r");
         delay_ms(5000);
        }
}</pre>
<pre></pre>
<pre></pre>
<pre></pre>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=164</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PIC16F887 Digital Clock with Calendar</title>
		<link>http://microscale-embedded.com/blog/?p=157</link>
		<comments>http://microscale-embedded.com/blog/?p=157#comments</comments>
		<pubDate>Fri, 25 Nov 2011 11:41:47 +0000</pubDate>
		<dc:creator>Jude Ozioko</dc:creator>
				<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=157</guid>
		<description><![CDATA[digital clock with calendar This is a simple digital clock with calendar project using Microchip’s PIC16F887 microcontroller and 16x2 LCD display. The project will display the current date and time on the LCD. The software used were MPLAB IDE and CCS C Compiler. List of Components used: Components Quantity PIC16F887 1 16x2LCD 1 4MHz Crytal [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/11/digital-clock.docx">digital clock with calendar</a></p>
<pre>This is a simple digital clock with calendar project using Microchip’s
PIC16F887 microcontroller and 16x2 LCD display.
The project will display the current date and time on the LCD.
The software used were MPLAB IDE and CCS C Compiler.</pre>
<pre>
List of Components used:

Components	Quantity
PIC16F887 	    1
16x2LCD		    1
4MHz Crytal	    1
22pF Capacitor	    2
10K resistor	    1
7805		    1 

You can get these components at www.microscale-embedded.com

The source code is shown below</pre>
<pre>#include &lt;16F887.h&gt;
#use delay(clock=20000000)
#fuses XT,NOWDT,NOLVP
#use rs232(baud=9600,xmit =PIN_C6, rcv = PIN_C7)
#include "lcd.c"

//RTC variables
#define XTAL_FREQUENCY  4000000
#define TIMER1_FREQUENCY (XTAL_FREQUENCY / 4) // 1 clock tick = 1 instr. cycle = crystal frequency / 4
int32 Ticker;
int8 Seconds=0; 

int8 Year=11,Month=11,Days=25,Hours=8,Minutes=35; 

// Test whether a given year is a leap year.
#define IS_LEAP(year) (year%4 == 0) 

//    Initialize RTC
void Initialize_RTC(void)
{
  Ticker = TIMER1_FREQUENCY;                  // initialize clock counter to number of clocks per second
  setup_timer_1( T1_INTERNAL | T1_DIV_BY_1 ); // initialize 16-bit Timer1 to interrupt
                                              // exactly every 65536 clock cycles
                                              // (about 76 times per second)
  enable_interrupts( INT_TIMER1 );            // Start RTC
} 

#int_TIMER1
void TIMER1_isr()
{
  Ticker -= 65536;                        // Decrement ticker by clocks per interrupt
  if ( Ticker &lt; 65536 )                   // If second has expired
  {  Ticker += TIMER1_FREQUENCY;          //   Increment ticker by clocks per second
     seconds++;                           //   Increment number of seconds
  } 

  if(Seconds == 60) {Minutes++; Seconds=0;
    if(Minutes == 60) {Hours++; Minutes=0;
      if(Hours == 24) {Days++; Hours=0;
        if (  (Days == 29 &amp;&amp; Month==2 &amp;&amp; !IS_LEAP(Year))
           || (Days == 30 &amp;&amp; Month==2)
           || (Days == 31 &amp;&amp; (Month==4 || Month==6 || Month==9 || Month==11 ))
           || (Days == 32)
           ) {Month++;Days=0;}
        if(Month == 13) {Year++; Month=0;}
  }}}
} 

void main()
{
  int8 prev_second;
  Initialize_RTC();
  enable_interrupts( GLOBAL );
   lcd_init();
  // loop forever
  while(true)
  {
    if (seconds != prev_second)
    {
      prev_second = seconds;
      lcd_gotoxy(2,1);
      printf(lcd_putc,"Date:");
      lcd_gotoxy(7,1);
      printf(lcd_putc," %d:%d:%d \r\n",Days,Month,Year);

      lcd_gotoxy(2,2);
      printf(lcd_putc,"Time:");
      lcd_gotoxy(7,2);
      printf(lcd_putc," %d:%d:%d \r\n",Hours,Minutes,seconds);
    }
  }
}
</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=157</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finger print based security system</title>
		<link>http://microscale-embedded.com/blog/?p=143</link>
		<comments>http://microscale-embedded.com/blog/?p=143#comments</comments>
		<pubDate>Thu, 24 Nov 2011 11:12:15 +0000</pubDate>
		<dc:creator>Sunday O. Efeh</dc:creator>
				<category><![CDATA[8051 Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=143</guid>
		<description><![CDATA[Project name: Finger print based security system These project utilize fingerprint recognition technology to allow access to only those whose fingerprints you choose. It contains all the necessary electronics to allow you to store, delete, and verify fingerprints with just the touch of a button. Stored fingerprints are retained even in the event of complete [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Project name: Finger print based security system</strong></em></p>
<p><em>These project utilize fingerprint recognition technology to allow access to only those whose fingerprints you choose. It contains all the necessary electronics to allow you to store, delete, and verify fingerprints with just the touch of a button. Stored fingerprints are retained even in the event of complete power failure or battery drain. These eliminates the need for keeping track of keys or remembering a combination password, or PIN. It can only be opened when an authorized user is present, since there are no keys or combinations to be copied or stolen, or locks that can be picked.</em></p>
<p><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/11/fingerprint.png"><img class="alignleft size-full wp-image-161" title="fingerprint" src="http://microscale-embedded.com/blog/wp-content/uploads/2011/11/fingerprint.png" alt="" width="243" height="245" /></a></p>
<p><em>In this project the fingerprint module FPM10A is used. It can store up to 100 finger prints on its own memory. It can be controlled through its serial port.</em></p>
<p><em>The microcontroller STC90LE58AD interacts with the module. You can add a fingerprint, Delete a fingerprint and identify the fingerprint.</em></p>
<p style="text-align: center;"><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/11/circuit.png"><img class="size-medium wp-image-162 aligncenter" style="border-style: initial; border-color: initial;" title="circuit" src="http://microscale-embedded.com/blog/wp-content/uploads/2011/11/circuit-300x208.png" alt="" width="300" height="208" /></a></p>
<div><span style="color: #0000ee;"><span style="text-decoration: underline;"><br />
</span></span><em>To add a fingerprint, just show the finger on the module and press the ADD key. Now the microcontroller will send the ADD command to the module and the module will add it into the memory.</em></p>
<p><em>To delete the finger follow the same as above.</em></p>
<p><em>To identify the finger, press the Identify button and if the finger matches then the Relay is complemented. Also the fingerprint ID is displayed over the LCD display.</em></p>
<p><em>**All necessary materials and components are readily available at www.microscale-embedded</em></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><em>FPM10A</em></p>
<p><em>1．Pin Definition</em></p>
<p><em>SD-FPM10A uses 1.0mm FPC socket which has 5 pins. The pin definition is as follows:</em></p>
<p><em>1 is VCC    It’s between 3.6V and 5.5V</em></p>
<p><em>2 is GND</em></p>
<p><em>3 is TXD     serial port sending</em></p>
<p><em>4 is RXD     serial port receiving.</em></p>
<p><em>5 is NC      floating</em></p>
<p><em><strong>Components list</strong></em></p>
<ol>
<li><em>STC90LE58AD</em></li>
<li><em>11.0592MHZ XTAL</em></li>
<li><em>FINGER PRINT MODULE (FPM10A)</em></li>
<li><em>220V-12V TRANSFORMER</em></li>
<li><em>LM317</em></li>
<li><em>7812 VOLTAGE REGULATOR</em></li>
<li><em>2 K RESISTORS (X2NOS.)</em></li>
<li><em>1K RESISTOR (1NOS.)</em></li>
<li><em>10K RESISTOR (3 NOS.)</em></li>
<li><em>330 OHMS RESISTOR (1NOS.)</em></li>
<li><em>670 OHMS RESISTOR (1 NOS.)</em></li>
<li><em>2N2222 TRANSISTOR (2 NOS.)</em></li>
<li><em>BUZZER</em></li>
<li><em>12V DC RELAY</em></li>
<li><em>PUSH BUTTON SWITCH (3 NOS.)</em></li>
</ol>
<p>&nbsp;</p>
<p><em>*****C source codes below****</em></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: 'Agency FB','sans-serif';" lang="EN-US">/********************************************************************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: 'Agency FB','sans-serif';" lang="EN-US">*************************FINGER PRINT MODULE CONTOLLER*****************************</span></em></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"><em><span style="font-family: 'Agency FB','sans-serif';" lang="EN-US">**********************************************************************************/</span></em></p>
<p><em>#include &lt;LIB_STC_MCU.h &gt;</em></p>
<p><em>#include &lt;stdio.h&gt;</em></p>
<p><em>#include &lt;LIB_FPM10A.h&gt;</em></p>
<p><em>#include&#8221;Lib_Delay.c&#8221;</em></p>
<p><em>#include &lt;lcd_4.h&gt;</em></p>
<p><em>#include &lt;Lib_Uart.h&gt;</em></p>
<p><em>#include &lt;intrins.h&gt;</em></p>
<p><em>#include &lt;string.h&gt;</em></p>
<p><em>#define ON 1</em></p>
<p><em>#define OFF 0</em></p>
<p><em>sbit SAVE =P1^0;                     //save button</em></p>
<p><em>sbit DELETE =P1^1;                    //delete button</em></p>
<p><em>sbit MATCH =P1^2;                   //button to identify finger print</em></p>
<p><em>sbit BUZZER =P3^6;</em></p>
<p><em>sbit LOAD =P3^5;</em></p>
<p><em>void Store_Number_Fingerprint(void)</em></p>
<p><em>{</em></p>
<p><em>BUZZER=OFF;</em></p>
<p><em>FINGERPRINT_Cmd_vfypwd();            //enable pasword handshaing with module</em></p>
<p><em>array_ACK(11);                                                                                            //get return or acknowledgement packet from module</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00)                                      //if command successful</em></p>
<p><em>Lcd_Write(1,2,&#8221;VfyPwd_OK&#8221;);</em></p>
<p><em>else                                                                                                                           //if command failure</em></p>
<p><em>{</em></p>
<p><em>Lcd_Write(1,2,&#8221;VfyPwd_ERROR&#8221;);</em></p>
<p><em>while(1);</em></p>
<p><em>}</em></p>
<p><em>Delay_ms(1000);</em></p>
<p>&nbsp;</p>
<p><em>do{</em></p>
<p><em>FINGERPRINT_Cmd_Get_Img();           //get finger print features from scanner</em></p>
<p><em>array_ACK(12);                                         //get return or acknowledgement packet from module</em></p>
<p><em>if(receive_ACK[10]!=0&#215;00)</em></p>
<p><em>{Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>Lcd_Write(1,2,&#8221;No Finger&#8221;);</em></p>
<p><em>Lcd_Write(2,1,&#8221;Place Finger&#8221;);}</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>}</em></p>
<p><em>while(receive_ACK[10]!=0&#215;00);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>Lcd_Write(1,2,&#8221;Image_OK&#8221;);</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>FINGERPRINT_Cmd_Img_To_Buffer1();       //save image features into buffer1</em></p>
<p><em>array_ACK(12);                                                        //get return or acknowledgement packet from module</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00)   Lcd_Write(1,2,&#8221;Img_to_Buff1_Ok&#8221;);</em></p>
<p><em>else        Lcd_Write(1,2,&#8221;Img_to.._ERROR&#8221;);</em></p>
<p><em>Delay_ms(2000);</em></p>
<p><em>do{</em></p>
<p><em>FINGERPRINT_Cmd_Get_Img();          //get finger print features from scanner</em></p>
<p><em>array_ACK(12);                                        //get return or acknowledgement packet from module</em></p>
<p><em>if(receive_ACK[10]!=0&#215;00)</em></p>
<p><em>{Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>Lcd_Write(1,2,&#8221;No Finger&#8221;);</em></p>
<p><em>Lcd_Write(2,1,&#8221;Place Finger&#8221;);}</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>}</em></p>
<p><em>while(receive_ACK[10]!=0&#215;00);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>Lcd_Write(1,2,&#8221;Image_OK&#8221;);</em></p>
<p><em>Delay_ms(500);</em></p>
<p><em>Lcd_Write(1,2,&#8221;Remove Finger&#8221;);</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>FINGERPRINT_Cmd_Img_To_Buffer2();     //save image features into buffer1</em></p>
<p><em>array_ACK(12);                                                         //get return or acknowledgement packet from module</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00)            Lcd_Write(1,2,&#8221;Img_to_Buff2_Ok&#8221;);</em></p>
<p><em>else Lcd_Write(1,2,&#8221;Img_to.._ERROR&#8221;);</em></p>
<p><em>Delay_ms(2000);</em></p>
<p><em>FINGERPRINT_Cmd_Reg_Model();</em></p>
<p><em>array_ACK(12);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00)</em></p>
<p><em>Lcd_Write(1,2,&#8221;RegMode1_OK&#8221;);</em></p>
<p><em>else</em></p>
<p><em>Lcd_Write(1,2,&#8221;RegMode1_ERROR&#8221;);</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>FINGERPRINT_Cmd_Get_Templete_Num();     //get template number</em></p>
<p><em>array_ACK(14);                                                 //get return or acknowledgement packet from module</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00)</em></p>
<p><em>Lcd_Write(1,2,&#8221;TemplateNum_OK&#8221;);</em></p>
<p><em>else</em></p>
<p><em>Lcd_Write(1,2,&#8221;TemplateNum_ERROR&#8221;);</em></p>
<p><em>Templete_Num=(((int)receive_ACK[10]*256)+(int)receive_ACK[11]);</em></p>
<p><em>Lcd_Chr(2,2,Templete_Num);</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>FINGERPRINT_Cmd_Store();</em></p>
<p><em>array_ACK(12);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00)</em></p>
<p><em>Lcd_Write(1,2,&#8221;Reg_Store_OK  &#8220;);</em></p>
<p><em>else</em></p>
<p><em>Lcd_Write(1,2,&#8221;Reg_Store_ERROR   &#8220;);</em></p>
<p><em>FINGERPRINT_Cmd_Save_Finger(0,2);</em></p>
<p><em>array_ACK(12);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00) Lcd_Write(1,2,&#8221;Save_OK  &#8220;);</em></p>
<p><em>if(receive_ACK[10]==0&#215;01) Lcd_Write(1,2,&#8221;Error  &#8220;);</em></p>
<p><em>if(receive_ACK[10]==0x0b) Lcd_Write(1,2,&#8221;Out of range&#8221;);</em></p>
<p><em>if(receive_ACK[10]==0&#215;18) Lcd_Write(1,2,&#8221;Flach Error&#8221;);</em></p>
<p><em>}</em></p>
<p>&nbsp;</p>
<p><em>void main (void)</em></p>
<p><em>{</em></p>
<p><em>int flag,count,i=0;</em></p>
<p><em>BUZZER=OFF;</em></p>
<p><em>LOAD=OFF;</em></p>
<p><em>Uart_Init(57600);</em></p>
<p><em>Lcd_Init();</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>Lcd_Cursor(1,1);</em></p>
<p><em>Lcd_Write(1,1,&#8221;WELCOME&#8221;);</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>while(1)</em></p>
<p><em>{</em></p>
<p><em>if(!SAVE)</em></p>
<p><em>Store_Number_Fingerprint();</em></p>
<p>&nbsp;</p>
<p><em>if(!DELETE)</em></p>
<p><em>{</em></p>
<p><em>BUZZER=OFF;</em></p>
<p><em>FINGERPRINT_Cmd_Delete_All_Model();  //delete finger print</em></p>
<p><em>array_ACK(12) ;</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00) Lcd_Write(2,2,&#8221;Empty_Ok&#8221;);</em></p>
<p><em>if(receive_ACK[10]==0&#215;01) Lcd_Write(2,2,&#8221;Empty_Error&#8221;);</em></p>
<p><em>if(receive_ACK[10]==0x0c) Lcd_Write(2,2,&#8221;Empty_Fail&#8221;);</em></p>
<p><em>}</em></p>
<p><em>if(!MATCH)</em></p>
<p><em>{</em></p>
<p><em>FINGERPRINT_Cmd_vfypwd();    //enable pasword handshaing with module</em></p>
<p><em>array_ACK(11);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00) Lcd_Write(1,2,&#8221;VfyPwd_OK&#8221;);</em></p>
<p><em>else</em></p>
<p><em>{</em></p>
<p><em>Lcd_Write(1,2,&#8221;VfyPwd_ERROR&#8221;);</em></p>
<p><em>while(1);</em></p>
<p><em>}</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>do{</em></p>
<p><em>FINGERPRINT_Cmd_Get_Img();</em></p>
<p><em>array_ACK(12);</em></p>
<p><em>if(receive_ACK[10]!=0&#215;00) Lcd_Cmd(_LCD_CLEAR); {Lcd_Write(1,2,&#8221;No Finger&#8221;);</em></p>
<p><em>Lcd_Write(2,1,&#8221;Place Finger&#8221;);}</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>}</em></p>
<p><em>while(receive_ACK[10]!=0&#215;00);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>Lcd_Write(1,2,&#8221;Please Wait&#8230;&#8221;);  Delay_ms(1000);</em></p>
<p><em>FINGERPRINT_Cmd_Img_To_Buffer1();</em></p>
<p><em>Delay_ms(1000);</em></p>
<p><em>FINGERPRINT_Cmd_Search_Finger();         //check for finger in flash memory</em></p>
<p><em>array_ACK(11);</em></p>
<p><em>Lcd_Cmd(_LCD_CLEAR);</em></p>
<p><em>if(receive_ACK[10]==0&#215;00) {Lcd_Write(1,2,&#8221;Finger Match&#8221;);</em></p>
<p><em>if(flag==0)</em></p>
<p><em>{Lcd_Write(2,2,&#8221;Door Opened&#8221;);</em></p>
<p><em>LOAD=ON;</em></p>
<p><em>flag=1;}</em></p>
<p><em>else</em></p>
<p><em>{Lcd_Write(2,2,&#8221;Door Closed&#8221;);</em></p>
<p><em>LOAD=OFF;</em></p>
<p><em>flag=0;}</em></p>
<p><em>count=0;</em></p>
<p><em>}</em></p>
<p><em>if(receive_ACK[10]==0&#215;01) Lcd_Write(2,2,&#8221;Match_Error&#8221;);</em></p>
<p><em>if(receive_ACK[10]==0&#215;09) {Lcd_Write(1,2,&#8221;Not Match&#8221;);</em></p>
<p><em>Lcd_Write(2,2,&#8221;Try Again&#8221;);</em></p>
<p><em>count++   ;</em></p>
<p><em>if(count&gt;3) {BUZZER=ON;                         //sound buzzer</em></p>
<p><em>count=0;</em></p>
<p><em>while(SAVE &amp;&amp; DELETE &amp;&amp; MATCH)</em></p>
<p><em>Lcd_Scroll(&#8220;        Sorry;;; You do not have access!!!&#8221;);}</em></p>
<p><em>}</em></p>
<p><em>}</em></p>
<p><em>}</em></p>
<p><em>}</em></p>
<p>&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=143</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Control Appliances using SMS</title>
		<link>http://microscale-embedded.com/blog/?p=132</link>
		<comments>http://microscale-embedded.com/blog/?p=132#comments</comments>
		<pubDate>Tue, 22 Nov 2011 07:05:57 +0000</pubDate>
		<dc:creator>Abbas Abdullahi</dc:creator>
				<category><![CDATA[AVR Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=132</guid>
		<description><![CDATA[The aim of this project, “Control Appliances via SMS using sim300cz gsm modem and ATMega16”, is to use GSM technology to automate and remotely control various household appliances. This project will aid student and developers to make use of sim300cz gsm modem in automation process. This design can be futher developed for &#160; more robust [...]]]></description>
			<content:encoded><![CDATA[<p>The aim of this project, “Control Appliances via SMS using <strong>sim300cz</strong> gsm modem and <strong>ATMega16</strong>”, is to use GSM technology to automate and remotely control various household appliances. This project will aid student and developers to make use of sim300cz gsm modem in automation process. This design can be futher developed for</p>
<p>&nbsp;</p>
<p>more robust home automation. The transmit TXD of the mega16 connected to receive RXD of SIM300CZ and transmit TXD of the SIM300CZ connected to receive RXD of the mega16, once sms message &#8220;Device1 ON&#8221; or &#8220;Device1 OFF&#8221; is sent from mobile phone, the sim300cz will receive and send to microcontroller, the microcontroller will check the command and ON or OFF any of the relay. The relay can be connected to any device.</p>
<p style="text-align: left;"><img class="size-medium wp-image-133" style="border-style: initial; border-color: initial;" src="http://microscale-embedded.com/blog/wp-content/uploads/2011/11/automation-300x207.jpg" alt="" width="300" height="207" /></p>
<div>Component:</p>
<ol>
<li>ATMega16 Microcontroller</li>
<li>SIM300CZ GSM Modem</li>
<li>6V Relay</li>
<li>4MHZ Crystal Oscillator</li>
<li>22pf Capacitor</li>
<li>1k resistor</li>
<li>1N4007 diodes</li>
<li>2N222 transistor</li>
<li>4k7 resistor</li>
</ol>
<p>You can get the component at <a href="http://www.microscale-embbed.com/">www.microscale-embbed.com</a></p>
<p>&nbsp;</p>
<p>Source code</p>
<p>&nbsp;</p>
<p>The source code is written using C language:</p>
<p>&nbsp;</p>
<pre>#include &lt;avr/io.h&gt;
#include &lt;avr/interrupt.h&gt;
#include &lt;string.h&gt;
#include &lt;util/delay.h&gt;

unsigned int i=0;
char enter=0x0D;
char ctrZ=0x1A;

void USARTInit()
{

	//Set Baud rate
	UCSRA=0;
	UBRRL = 51;
	UBRRH = 0;
	UCSRC=(1&lt;&lt;URSEL)|(3&lt;&lt;UCSZ0);

	//Enable The receiver and transmitter
	UCSRB=(1&lt;&lt;RXEN)|(1&lt;&lt;TXEN)|(1&lt;&lt;RXCIE);
}

char get_char()
{
	//Wait untill a data is available
	while(!(UCSRA &amp; (1&lt;&lt;RXC)))
	{  }
	return UDR;
}

void put_char(char data)
{
	//Wait untill the transmitter is ready
	while(!(UCSRA &amp; (1&lt;&lt;UDRE)))
	{
	}

	//Now write the data to USART buffer
	UDR=data;
}

void put_str(char* str)
{
	unsigned char len;
	len=strlen(str);

	for(int i=0;i&lt;len;i++)
	{
		_delay_ms(100);

		while((UCSRA &amp; 0x20) == 0x0);

		UDR=str[i];
	}
}

int main (void)
{
	// set PORTA for output
	DDRA |= (1&lt;&lt;PA2) | (1&lt;&lt;PA1) | (1&lt;&lt;PD0);
	PORTA &amp;= ~(1&lt;&lt;PA2) | (1&lt;&lt;PA1) | (1&lt;&lt;PA0);

	USARTInit();
	_delay_ms(1000);

	send("AT");
	put_str(dummy);

	while(get_char()!='O');
	while(get_char()!='K');//Waiting for modem response

	put_str("ATE0");
	put_str (dummy);

	while(get_char()!='O');
	while(get_char()!='K');//Waiting for modem response

	put_str ("AT+CMGF=1");
	put_str (dummy);

	while(get_char()!='O');
	while(get_char()!='K');//Waiting for modem response

	put_str ("AT+CNMI=2,2,0,0,0");
	put_str (dummy);

	while(get_char()!='O');
	while(get_char()!='K');//Waiting for modem response

	while(1)
	{

		rx[i]=get_char();
		i++;
		if(rx[i-2]==13 &amp;&amp; rx[i-1]==10)
		{
			rx[i-1]='';
			rx[i-2]='';
			i=0;

			if(strcmp(rx,"device1 ON")==0)
			{
				PORTA |= (1&lt;&lt;PA0);
				_delay_ms(1000);
				put_str ("AT");
				put_str (enter);
				put_str ("AT+CMGS=\"+gsm number\"");   // you need to add your gsm number here e.g +2348033870967
				put_str (enter);
				put_str ("device1 ON ");
				put_str (ctrZ);
			}

			if(strcmp(rx,"device1 OFF")==0)
			{
				PORTA |= (1&lt;&lt;PA1);
				_delay_ms(1000);
				put_str ("AT");
				put_str (enter);
				put_str ("AT+CMGS=\"+gsm number\"");
				put_str (enter);
				put_str ("device1 OFF ");
				put_str (ctrZ);
			}

			if(strcmp(rx,"device2 ON")==0)
			{
				PORTA |= (1&lt;&lt;PA2);
				_delay_ms(1000);
				put_str ("AT");
				put_str (enter);
				put_str ("AT+CMGS=\"+gsm number\"");
				put_str (enter);
				put_str ("device2 ON");
				put_str (ctrZ);
			}

			if(strcmp(rx,"device2 OFF")==0)
			{
				PORTA |= (1&lt;&lt;PA2);
				_delay_ms(1000);
				put_str ("AT");
				put_str (enter);
				put_str ("AT+CMGS=\"+gsm number\"");
				put_str (enter);
				put_str ("device2 OFF");
				put_str (ctrZ);
			}

			if(strcmp(rx,"device3 ON")==0)
			{
				PORTA |= (1&lt;&lt;PA2);
				_delay_ms(1000);
				put_str ("AT");
				put_str (enter);
				put_str ("AT+CMGS=\"+gsm number\"");
				put_str (enter);
				put_str ("device3 ON");
				put_str (ctrZ);
			}

			if(strcmp(rx,"device3 OFF")==0)
			{
				PORTA |= (1&lt;&lt;PA2);
				_delay_ms(1000);
				put_str ("AT");
				put_str (enter);
				put_str ("AT+CMGS=\"+gsm number\"");
				put_str (enter);
				put_str ("device3 OFF");
				put_str (ctrZ);
			}

		}

	}
}</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=132</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Product Review: GSM Controller Board for Industrial Applications</title>
		<link>http://microscale-embedded.com/blog/?p=121</link>
		<comments>http://microscale-embedded.com/blog/?p=121#comments</comments>
		<pubDate>Wed, 19 Oct 2011 02:16:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Product Review]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=121</guid>
		<description><![CDATA[﻿If you are looking for a head start in GSM industrial control, then look no further. This GSM controller board features Siemens TC35 GSM module and STC 8951 series microcontrollers. The board is well documented and comes with sample codes to get you started. You can use it to prototype in your product development or [...]]]></description>
			<content:encoded><![CDATA[<p>﻿If you are looking for a head start in GSM industrial control, then look no further. This GSM controller board features Siemens TC35 GSM module and STC 8951 series microcontrollers. The board is well documented and comes with sample codes to get you started. You can use it to prototype in your product development or use it as an integral part of your product.</p>
<p>Hardware Description:  MCU STC89Cxx, frequency up to 90MHz, on-chip FLASH program memory 4K above, 8K or so chip EEROM, 512B-1208B-chip RAM, 36 IO ports.</p>
<p><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/10/siemens_gsm.png"><img title="siemens_gsm" src="http://microscale-embedded.com/blog/wp-content/uploads/2011/10/siemens_gsm.png" alt="" width="400" height="279" /></a></p>
<ul>
<li>TC35 module incorporates the standard RS232 interface and SIM card.</li>
<li>1 LED: a power indicator.</li>
<li>LM2941 4.2V power supply IC.</li>
<li>ISP interface (for program download, serial monitor).</li>
<li>RS232 interface ISP; support serial debugging</li>
<li>12V DC power input with power indicator</li>
<li>8 LED indicators</li>
<li>On-board microphone, handset interface for voice call.</li>
<li>On-board digital temperature sensor DS18B20 interface which can be programmed for wireless temperature transmission applications.</li>
<li>16-channel digital output, 8 channels for relay control, and the other 8 TTL-level outputs for user expansion. (Relay control load: 250V/10A)</li>
<li>TC35 module serial communication modes selection: supports connecting modem to MCU or modem to PC serial communication.</li>
</ul>
<p>For availability and pricing, contact Microscale Embedded: info @ microscale-embedded. com</p>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=121</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Digital StopWatch Using Microcontroller</title>
		<link>http://microscale-embedded.com/blog/?p=112</link>
		<comments>http://microscale-embedded.com/blog/?p=112#comments</comments>
		<pubDate>Fri, 30 Sep 2011 12:24:52 +0000</pubDate>
		<dc:creator>Abbas Abdullahi</dc:creator>
				<category><![CDATA[AVR Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=112</guid>
		<description><![CDATA[A microcontroller base stopwatch is use to determine the time interval between start and stop of any action or activity for example in sport such as racing and can also be applicable in so many other areas.  The three buttons “Start”, “Stop”, and “Reset” are use to control the stopwatch.  once the start button is [...]]]></description>
			<content:encoded><![CDATA[<p>A microcontroller base stopwatch is use to determine the time interval between start and stop of any action or activity for example in sport such as racing and can also be applicable in so many other areas.  The three buttons “Start”, “Stop”, and “Reset” are use to control the stopwatch.  once the start button is pressed the stop watch will begin counting. The stop can be use to pause the counting while the reset to take it back to 00:00:00. The circuit given here is a digital stopwatch that displays the time on 16&#215;2 LCD AVR ATMega8 microcontrollers.</p>
<p style="text-align: center"><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/09/stopwatch1.png"><img class="aligncenter size-medium wp-image-114" src="http://microscale-embedded.com/blog/wp-content/uploads/2011/09/stopwatch1-300x257.png" alt="" width="300" height="257" /></a></p>
<p>/******************************************************</p>
<p>******************************************************/</p>
<p>#include &lt;avr/io.h&gt;</p>
<p>#include &lt;util/delay.h&gt;</p>
<p>#include &lt;avr/interrupt.h&gt;</p>
<p>#include &#8220;lcd.h&#8221;</p>
<p>volatile unsigned int      millisecond=0;</p>
<p>volatile char              second=0;</p>
<p>volatile char              minute=0;</p>
<p>volatile char              hour=0;</p>
<p>int main()</p>
<p>{</p>
<p>PORTB|=((1&lt;&lt;PB2)|(1&lt;&lt;PB1)|(1&lt;&lt;PB0));</p>
<p>int8_t hr,min;</p>
<p>hr=min=0;</p>
<p>lcd_Init(0);</p>
<p>LCDClear();</p>
<p>TCCR1B=(1&lt;&lt;WGM12)|(1&lt;&lt;CS11)|(1&lt;&lt;CS10);</p>
<p>OCR1A=250;</p>
<p>TIMSK|=(1&lt;&lt;OCIE1A);</p>
<p>sei();</p>
<p>LCDClear();</p>
<p>lcd_String(&#8220;     DIGITAL       &#8220;);</p>
<p>lcd_Stringxy(0,1,&#8221;   Stop Watch  &#8220;);</p>
<p>_delay_ms(100);</p>
<p>LCDClear();</p>
<p>lcd_String(&#8220;   STOP WATCH  &#8220;);</p>
<p>lcd_Stringxy(0,1,&#8221;Stop &#8220;);</p>
<p>lcd_Stringxy(6,1,&#8221;- 00:00:00&#8243;);</p>
<p>hour = hr;</p>
<p>minute = min;</p>
<p>second =0;</p>
<p>LCDClear();</p>
<p>lcd_String(&#8220;   STOP WATCH  &#8220;);</p>
<p>lcd_Stringxy(0,1,&#8221;Start &#8220;);</p>
<p>lcd_Stringxy(6,1,&#8221;-&#8221;);</p>
<p>while(1)</p>
<p>{</p>
<p>lcd_Intxy(8,1,hour,2);</p>
<p>lcd_String(&#8220;:&#8221;);</p>
<p>lcd_Intxy(11,1,minute,2);</p>
<p>lcd_String(&#8220;:&#8221;);</p>
<p>lcd_Intxy(14,1,second,2);</p>
<p>if(!(PINB &amp; (1&lt;&lt;PB0)))</p>
<p>{</p>
<p>lcd_Stringxy(0,1,&#8221;Reset &#8220;);</p>
<p>millisecond=0;</p>
<p>second=0;</p>
<p>minute=0;</p>
<p>hour=0;</p>
<p>lcd_Stringxy(0,1,&#8221;Start &#8220;);</p>
<p>}</p>
<p>if(!(PINB &amp; (1&lt;&lt;PB1)))</p>
<p>{</p>
<p>lcd_Stringxy(0,1,&#8221;Stop &#8220;);</p>
<p>TCCR1B&amp;=(~((1&lt;&lt;CS12)|(1&lt;&lt;CS11)|(1&lt;&lt;CS10)));</p>
<p>}</p>
<p>if(!(PINB &amp; (1&lt;&lt;PB2)))</p>
<p>{</p>
<p>lcd_Stringxy(0,1,&#8221;Start &#8220;);</p>
<p>TCCR1B=(1&lt;&lt;WGM12)|(1&lt;&lt;CS11)|(1&lt;&lt;CS10);</p>
<p>}</p>
<p>if((hour == 9) &amp;&amp; (minute == 9) &amp;&amp; (second == 9))</p>
<p>{</p>
<p>hour = 0;</p>
<p>minute = 0;</p>
<p>second =0;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>ISR(TIMER1_COMPA_vect)</p>
<p>{</p>
<p>millisecond++;</p>
<p>if(millisecond==61)</p>
<p>{</p>
<p>second++;</p>
<p>millisecond=0;</p>
<p>if(second==59)</p>
<p>{</p>
<p>minute++;</p>
<p>second=0;</p>
<p>if(minute==59)</p>
<p>{</p>
<p>hour++;</p>
<p>minute=0;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=112</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>4X4 Keypad interfacing</title>
		<link>http://microscale-embedded.com/blog/?p=98</link>
		<comments>http://microscale-embedded.com/blog/?p=98#comments</comments>
		<pubDate>Tue, 27 Sep 2011 11:48:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AVR Tutorials]]></category>

		<guid isPermaLink="false">http://microscale-embedded.com/blog/?p=98</guid>
		<description><![CDATA[In this tutorial, the interfacing of 4&#215;4 (16 buttons) keypad to ATMega 16 is explored. The keypad is organized into 4 rows and 4 columns utilizing only 8 i/o pins instead of 16.The rows are connected to PD0 through PD3 while the columns are connected to PD4 through PD7. The MCU decodes key-press (if any) [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial, the interfacing of 4&#215;4 (16 buttons) keypad to ATMega 16 is explored. The keypad is organized into 4 rows and 4 columns utilizing only 8 i/o pins instead of 16.The rows are connected to PD0 through PD3 while the columns are connected to PD4 through PD7. The MCU decodes key-press (if any) by successively pulling low the rows one at a time. It reads the PORT and perform some bit operations on the basis of which it knows whether any particular key has been pressed. The key pressed is displayed on a 16&#215;2 LCD which is connected to PORT A and B (RS and E).  Shown below is tutorials circuit diagram. Remember to connect Vcc and ground to appropriate power supply (5V preferable).  power supply (5V preferable).﻿﻿  ﻿</p>
<p><a href="http://microscale-embedded.com/blog/wp-content/uploads/2011/09/Capture1.jpg"><img class="alignnone size-medium wp-image-106" title="Circuit diagram" src="http://microscale-embedded.com/blog/wp-content/uploads/2011/09/Capture1-300x171.jpg" alt="" width="300" height="171" /></a></p>
<p>The firmware (C source code in AVR Studio syntax) is shown below*</p>
<p>#include &lt;avr/io.h&gt;<br />
#include &lt;util/delay.h&gt;<br />
#include &#8220;lcd.h&#8221;<br />
#include &#8220;lcd.c&#8221;</p>
<p>#define KB_PORT_OUT 			PORTD<br />
#define KB_PORT_IN				PIND</p>
<p>unsigned char upperNibble, keyCode, keyPressed, i;</p>
<p>int main()<br />
{<br />
DDRA = 0xff;<br />
DDRB = 0xff;<br />
DDRD = 0x0f;<br />
PORTD = 0xff;<br />
lcd_init(DISPLAY_ON);<br />
lcd_puts(&#8220;Press any key&#8221;);<br />
lcd_gotoXY(0,1);<br />
while(1)<br />
{<br />
upperNibble = 0xff;</p>
<p>for(i=0; i&lt;4; i++)<br />
{<br />
_delay_ms(1);<br />
KB_PORT_OUT = ~(0&#215;01 &lt;&lt; i);<br />
_delay_ms(1);  		  	 		  //delay for port o/p settling<br />
upperNibble = KB_PORT_IN | 0x0f;</p>
<p>if (upperNibble != 0xff)<br />
{<br />
_delay_ms(20); 		  		 //key debouncing delay<br />
upperNibble = KB_PORT_IN | 0x0f;<br />
if(upperNibble == 0xff) goto OUT;</p>
<p>keyCode = (upperNibble &amp; 0xf0) | (0x0f &amp; ~(0&#215;01 &lt;&lt; i));</p>
<p>while (upperNibble != 0xff)<br />
upperNibble = KB_PORT_IN | 0x0f;</p>
<p>_delay_ms(20);   			   //key debouncing delay</p>
<p>switch (keyCode)			   //generating key characetr to display on LCD<br />
{<br />
case (0xee): keyPressed = &#8217;7&#8242;;<br />
break;<br />
case (0xed): keyPressed = &#8217;4&#8242;;<br />
break;<br />
case (0xeb): keyPressed = &#8217;1&#8242;;<br />
break;<br />
case (0xe7): keyPressed = &#8216; &#8216;;<br />
break;<br />
case (0xde): keyPressed = &#8217;8&#8242;;<br />
break;<br />
case (0xdd): keyPressed = &#8217;5&#8242;;<br />
break;<br />
case (0xdb): keyPressed = &#8217;2&#8242;;<br />
break;<br />
case (0xd7): keyPressed = &#8217;0&#8242;;<br />
break;<br />
case (0xbe): keyPressed = &#8217;9&#8242;;<br />
break;<br />
case (0xbd): keyPressed = &#8217;6&#8242;;<br />
break;<br />
case (0xbb): keyPressed = &#8217;3&#8242;;<br />
break;<br />
case (0xb7): keyPressed = &#8216;=&#8217;;<br />
break;<br />
case (0x7e): keyPressed = &#8216;/&#8217;;<br />
break;<br />
case (0x7d): keyPressed = &#8216;X&#8217;;<br />
break;<br />
case (0x7b): keyPressed = &#8216;-&#8217;;<br />
break;<br />
case (0&#215;77): keyPressed = &#8216;+&#8217;;<br />
break;<br />
default	   : keyPressed = &#8216;X&#8217;;<br />
}//end of switch</p>
<p>lcd_putc((char)keyPressed);</p>
<p>OUT:;<br />
}//end of if<br />
}//end of for<br />
}//end of while(1)</p>
<p>return 0;<br />
}</p>
<p>The &#8220;lcd.h&#8221; and &#8220;lcd.c&#8221; will be made available on request.</p>
]]></content:encoded>
			<wfw:commentRss>http://microscale-embedded.com/blog/?feed=rss2&#038;p=98</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

