We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Can anyone please send me the code for counting pulses using timer 0 as counter in 'C'language.
The C code is
void main() { unsigned int Fpulse_count; while(1) { THO=0x00; TL0=0x00; P3=0xFF; TR0=1; if(TF!=1) { Fpulse_count++; } countpulses=TH0*256+TL0; } }
This time i am correct. Now you can reply.
That is not equivalent to the assembly code. For starters, you are not configuring the timer. Look back at your assembly code for TMOD.
No i have configured the timer as TMOD=0x25;
I forgot to write it. In main(), my first instruction is TMOD=0x25;
Are you saying that you typed in the code when posting?
Are you one of the few who have managed to get a computer without any copy/paste function?
How will we know what other information you forgot to write when "duplicating" the code?
"This time i am correct."
Yes, at last!
For the benefit of others, perhaps you could suggest how Keil could improve the site to make these instructions clearer?
What was it about the current format the made it so hard for you to find the instructions?
Can you please send me the answer of my query which i have asked you.
Did you also forget to write
TR0=0; TF0=0;
?
"In main(), my first instruction is TMOD=0x25;"
OK then, we'll just assume that's true. If you want the counter registers to count, why do you continually zero them?
Can you please send me the answer of my query which i have asked you. sure - and make fred pigeons fly in through your window.
If you copied and pasted your actual code AS SUGGESTED so there was no need to read 5 entries to figure out what you believe you have and you then posted what the problem with that is, you would get help.
Very few, if any, will reposnd to give me the code, and do it NOW
Erik
"Very few, if any, will reposnd to give me the code, and do it NOW"
Oh, plenty will respond - but not by sending code!