Skip to main content

Posts

Showing posts from October, 2010

NESCAFE advertisement: esetpip version

Microcontroller program that count the number of "ABC" & "XYZ"

#include REG52.h char found1=0; char found2=0; char countABC=0; char countXYZ=0; void searchABCXYZ () interrupt 4 {     if (RI==1)     {         if (SBUF=='A')         {             found1=1;         }             else if ((SBUF=='B')&& (found1==1))         {             found1=2;         }             else if ((SBUF=='C')&& (found1==2))         {             countABC++;             found1=0;         }                 else             found1=0;         P0=countABC;         if (SBUF=='X')         {             found2=1;         }             else if ((SBUF=='Y')&&(found2==1))         {             found2=2;         }             else if ((SBUF=='Z')&&(found2==2))         {             countXYZ++;             found2=0;         }         else                         found2=0;                 P1=countXYZ;         RI=0;       } }     void main ()     {  

Traffic Light program code

#include int cnt=0; int x=0; char state=1; void tim0 () interrupt 1 {     TR0=0;         TH0=0x3C;     TL0=0xB0;     cnt++;     switch (state)     {         case 1:                 P0=0x01;                 if (cnt== 1200)                 {                     state=2;                     cnt=0;                 }                 break;         case 2:                 P0=0x02;                 if (cnt== 2400)                 {                     state=3;                     cnt=0;                 }                 break;         case 3:                 P0=0x04;                 if (cnt== 600)                 {                     state=4;                     cnt=0;                 }                 break;          case 4:                  P0=0x08;                 if (cnt== 2400)                 {                     state=5;                     cnt=0;                 }                 break;         case 5:                 P0=0x04;    

Wifi BOOSTer!