hi members... i have a question today. i'm working with the sdcc cross compiler and metabolize c in assembler. i want to delay some programms but i can't use the function sleep or wait in sdcc. i have realized the delay with grinds at the moment but its very inexactly. sorry for the bad spelling i'm a german schoolboy i can't it superiorly. yours sincerely nick
"sorry for the bad spelling i'm a german schoolboy i can't it superiorly." It looks like you're using an automatic translator - is that right? As you're at school, shouldn't you be asking your teachers? It will be much easier for you to talk to someone face-to-face, in your own language, and who actually knows you and can see what you're doing & what you're using! "i have realized the delay with grinds at the moment but its very inexactly." I presume you mean loops? In that case, you will get the same results in any high-level language! If you want precise timing delays, this relies on knowing precisely what instructions are being executed - and high level languages give you no control whatsoever over that! If you want precise delay loops, you must write them in assembler! Alternatively, you could use a hardware timer.
hi members... i dont't use a automatic translator *smile* sorry for my bad attainments! i know that i could use a hardware timer or likewise...only how, that is the question! i write in this english forum as the german cooperativeness not realy good. i need assistance to cope my practical training. i need help! thank's for your sympathy... yours sincerely nick
i know that i could use a hardware timer or likewise...only how, that is the question! Do a search here on "the bible" and you will find what you need there. Erik An explanation since you are seemingly weak in english" "the bible" (lower case) is NOT "the Bible" (uppercase), but the basic document describing the function of a '51 oh well here are the links to "the bible" Chapter 1 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf chapter 2 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf chapter 3 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf
i have solved the problem alone... i have write the folowing timer function (delay of one second): void timer(void) { #define TF0_VECTOR 1 int R7=20; TR0=0; TF0=0; TMOD=TMOD | 0xF0; //Timer 0,16 bit Timer TMOD=TMOD & 0x01; TL0=0xAF; //Timer 0, set 1 second TH0=0x3C; TR0=1; //start timer while(R7!=0) { if(TF0!=0) //test if the timer overflow { TR0=0; //stop timer TF0=0; //clear the overflow flag R7--; TR0=1; } } } Thank's for you help yours sincerely nick