| ??? 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 |



