Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/27/07 13:04
Modified:
  10/27/07 13:05

Read: times


 
Msg Score: -1
 -1 Looks like homework
#146287 - problem
Hi my name is Shilpa
i have a project in which i have to code a microcontroller but i am facing many problems with that...
the project is simple but i couldnt do it .. so plz help me..
the project is to write a code for a microcontroller
three sensors are connected to the pins 0.0, 0.1, 0.2
and i have to measure the frequencies of the waves that the sensors pass through to the microcontroller... the wave obtained is a square wave...and afterwards there is some calculation part and finally the value should be displayed on an LCD...
the code which i wrote is below ...but it isnt working plz do tell me wat are the mistakes i did

# include <8051.h>
Sbit front = P0^0;
sbit back1 = P0^1;
sbit back2 = P0^2;
void MSDelay(unsigned int value);
void ConvertAndDisplay(unsigned char value);
void main(void)
{
unsigned char z,d1,d2,d3,d4,d5,d6;
unsigned int sf,sb,value;
front=1;
back1=1;
back2=1;
for (z=0;z<30;z++)
{
if (P0^0==d4)
d1==d1;
else
d1==d1+front;
if (back1==d5)
d2==d2;
else
d2==d2+back1;
if (back2==d6)
d3==d3;
else
d3==d3+back2;
front==d4;
back1==d5;
back2==d6;
}
sf=2*d1;
sb=5*(d2+d3);
value=((sf-sb)/sf)*100;
ConvertAndDisplay(value);
}
void ConvertAndDisplay(unsigned char value)
{
unsigned char x,d1,d2,d3;
x=value/10;
d1=value%10;
d2=x%10;
d3=x/10;
P1=d1;
MSDelay (250);
P1=d2;
MSDelay (250);
P1=d3;
MSDelay (250);
}
void MSDelay (unsigned int value)
{
unsigned char x,y;
for (x=0;x<value;x++);
for (y=0;y<127;y++);
}

if some one can help me with the code it would be of great help to me


List of 28 messages in thread
TopicAuthorDate
problem            01/01/70 00:00      
   Equality vs. assignment            01/01/70 00:00      
      which begs the question            01/01/70 00:00      
         Probably not, but...            01/01/70 00:00      
            Keil does            01/01/70 00:00      
   Only one pass through main...            01/01/70 00:00      
   Does it work with one sensor?            01/01/70 00:00      
      Which sensor are you asking about?            01/01/70 00:00      
   How to post legible source code            01/01/70 00:00      
   Step-by-step - learning to debug            01/01/70 00:00      
      Before debugging...            01/01/70 00:00      
   problem is            01/01/70 00:00      
      See DanĀ“s comment            01/01/70 00:00      
      Error information            01/01/70 00:00      
         Macros introducing more errors            01/01/70 00:00      
            Case sensitivity            01/01/70 00:00      
            thanks            01/01/70 00:00      
   where is that...            01/01/70 00:00      
      Not all equal            01/01/70 00:00      
         problem            01/01/70 00:00      
            DESCRIBE THE PROBLEMS            01/01/70 00:00      
   Obvious errors            01/01/70 00:00      
   Error Description            01/01/70 00:00      
      No, that won't work            01/01/70 00:00      
   Verify the hardware?            01/01/70 00:00      
      Pullups don't solve toolchain errors            01/01/70 00:00      
   reply to ur prblm            01/01/70 00:00      
      Try a spell checker            01/01/70 00:00      

Back to Subject List