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.
i wanted to configure timer 2 of at89c51ed2 can any one give code to do so and and tell how to obtain a specific frequency.
Hi,
Here is code what i used;
T2CON = 55h; // set t2con to 55 T2CAP1 = 12h; // set t2cap1 to 12 TMOD2 = 110101b; // set tmod2 to 32 TH2 = 1; // set th2 to 1 TL2 = 1; // set tl1 to 1 <endpre>
what frequency did u generate were u using the same ic did u add any extra header files
the freq was near high yes i include more header files; here they are.
#include <stdio.h> #include <error.h> #include <file.h> #include "ramash.h" #include "file1.h" #include "file2.h" #include "file3.h" #include "file4.h" #include "file5.h" #include "file6.h" #include "file7.h" #include "file8.h" #include "file9.h" #include "file10.h" #include "file12.h" #include "counting.h" #include "include.h" #include "my_funcs.h"
Wait a minute. Exactly what did you comment?
First of all, why do you add comments that duplicates the numbers from the instruction? Because you think people can't read the number in the assign?
Don't you think that your comments should describe what the numbers mean instead? How did you computed your numbers? What does tha flag bits mean?
Another thing - the numbers in the assignments are binary or hexadecimal. The numbers in your comments doesn't specify a number base. That should mean that they where base 10, something they obviously are not.
And one more thing - how will you make sure that the numbers in the comment will match the value in the assign? Check the comment for the TMOD2 assign. Does it look ok?
Something you have not answered: What is TH2? What happens when you write to it? Is there a rule that some assigns must be made before others?
T2CON = 55h; // set t2con to 55 T2CAP1 = 12h; // set t2cap1 to 12 TMOD2 = 110101b; // set tmod2 to 32 TH2 = 1; // set th2 to 1 TL2 = 1; // set tl1 to 1
Never write comments unless they add some value. And when you do write comments - make sure they are correct!
How many of the include files in:
do you think makes sense? How many can you describe the contents of, without opening it and check? Don't you think that files have names just to allow you to give them a meaningful name?
Well, if you used that code in the C51 compiler, it would certainly not compile!
hey but somebody can plz give me the correct code for timer 2 of at89c51ed2
i need the code urgently
When is your school assignment deadline?
well first of all its not a school assignment
deadline is by tomorrow
So what is it, then?
Try clicking the 'Support' link at the top of this page;
Then look at 'Example Programs and Utilities'
Then look at 'C51 Download Files'
Then what do you see...?
People who write 'u', 'plz' and similar, and make a new request after only 3 minutes are almost always trying to get help with their school assignments.
People who do commercial jobs, have normally learned the lesson: If you want something done in a hurry, you better do some work yourself. Five minutes with a good search engine will normally produce more good information than the forum members will be able to post during quite a number of days.
If you want to search for a solution - try a search engine. If you want to discuss an existing solution, try a forum.
did my helping code you look at befoor fix your prboblem?
if you want i can show you some more but after yesterday.
i got some more code from ny project for you.
but plz donut show to everyone.
int getBAUDSPEED( float SPEED) { float t, q; // variebles t = 1 / ( CLOCK / SPEED ); // sum it clock divided by speed t = t * 100 + 27; // add magic amunt q = t * SPEED; // change to variable return t + q / 113; // return the asnwer } </pree>
So, how long will you troll on this forum with faked posts then? Have you tought about what it says about your mental age?
if you donut like my code plz donut use it.
i think somepeople will think it is good!
goodbuy