hello

i m working on a project involving microcontroller,

i have square wave pulse as an input to my 16f877a microcontroller (the amplitude of the waves is rather 0v or 5v) i want to count how many pulse i have in 30 seconds, multiply it y 120 and then output the result on a 7segment display.

i know C++, i tried to think of how to do it and came up with the following.

thanks in advanced for the help.

i m working on a project involving microcontroller,

i have square wave pulse as an input to my 16f877a microcontroller (the amplitude of the waves is rather 0v or 5v) i want to count how many pulse i have in 30 seconds, multiply it y 120 and then output the result on a 7segment display.

i know C++, i tried to think of how to do it and came up with the following.

Code:

do{ int a=0; // a is used to count the number of pulses every 30 seconds int temp=0; int b; // b contains the value to be outputted int d=1; // d is used to have an infinite loop for(int t=0; t<30; t++) // t represent 30 seconds // i should be able to count all the pulse in every second. but didnt know how. if( A==high) // I considered that A is the input and by high i mean 5V a++; temp= a*120; b=temp; B=b; // I considered B as the port for the output } while ( d=1)

*Last edited by shabbir; 13Apr2012 at 09:17.. Reason: Code blocks*