From: me AT here DOT com Newsgroups: comp.os.msdos.programmer,comp.os.msdos,comp.os.msdos.djgpp,comp.os.msdos.misc Subject: Re: Control timing Date: 2 Nov 2001 23:53:11 GMT Organization: ?!? Lines: 115 Message-ID: <9rvbl7$q6f$1@newshost.mot.com> References: <8ea1626e DOT 0110280229 DOT 68dc811b AT posting DOT google DOT com> NNTP-Posting-Host: css31u.seattle.css.mot.com X-Trace: newshost.mot.com 1004745191 26831 199.1.163.31 (2 Nov 2001 23:53:11 GMT) X-Complaints-To: motpost1 AT azmsg DOT mot DOT com NNTP-Posting-Date: 2 Nov 2001 23:53:11 GMT User-Agent: tin/pre-1.4-19990216 ("Styrofoam") (UNIX) (SunOS/5.7 (sun4u)) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In comp.os.msdos.programmer jeffchan wrote: > Thanks, i re-allocate the jobs into main function and ISR. Now the ISR > is doing as your mention. > Actually, the input data is analog voice data. I need to control an > capture card to read and store it into hard drive. Now i find that > some strange sound like "tak" in my recorded file. It appears in each > times i use fwrite() to put the data from buffer into a file. When i > change the buffer size, the period of the "tak" is also changed. > What's it caused by and any idea to solve it? Once I did high speed acquisition from an 4 channel A/D, and ended up 2 ISR -- one was timer activated that latched in the data timer_ISR: disable; for (i = 0; i < 4; i++) { latch_in_channel[i]; } start_conversion; enable; iret; the other one was activated by the copmpletion signal (all were OR-d to one pin) then figured out the source, read and stored the data A2D_completed: disable; read_intr_ID; read_data; store_data; enable; iret; I had 2 ISR because it took several milliseconds from start_conversion to the A2D_completed, and by using 2 ISR's in this way, I could make my ISRs as efficient as possible. As to check time spent in the ISR, you can read the 8254 timer directly, i.e.: some_ISR: disable; start_LSB = inportb(0x40); start_MSB = inportb(0x40); do_something; end_LSB = inportb(0x40); end_MSB = inportb(0x40); enable; iret; This reads the HW timer, so it is accurate to a couple of us as long as your ISR takes less than 55 ms. If your ISR takes more than 55 ms to execute, then it's a bad ISR. > On the other hand, i create the file's name be around 23 > characters(including extension). Of course under dos will cuts it out. > Does any method let me use long file name? > Jeff > "Alexander Russell" wrote in message news:... >> "jeffchan" wrote in message >> news:bf50ce95 DOT 0110301711 DOT 78e48e58 AT posting DOT google DOT com... >> > Hi, >> > >> > That's mean i must install DOS on my PC. Can i use windows startup >> > disk booting up, to make an environment as dos? Is that still same as >> > dos box in win9x? >> > >> > And if the new_timer(void) routine is too much coding, it can't finish >> > the job when the next interrupt came expected. Do i need to set some >> > interrupt masking flags? >> > >> > How do i check the timing spent of this interrupt service routine? >> > >> > Jeff >> > >> >> I generally make an interrupt service as SHORT and FAST as possible. Set a >> flag, store a bit of data in a global structure. then the main program polls >> the vars set by the interrupt and does any longer processing. >> >> For example, the interrupt my just store data to a queue, then the main prog >> process the data in the queue and write it to disk. >> >> As for dos 7, I haven't tried that, but its likely ok. >> >> > >> > > > > AJR - I don't see an obvious problem. Are you running under DOS? If >> running >> > > > > under a dos box in win9x the timing will not be exactly what you >> expect. >> > > > >> > > > Let me know the reason. >> > > > >> > > Windows 9x grabs all the interrupts, and lets dos programms 'use' them >> at >> > > random intervals. >> > > >> > > > -- >> > > > Peace - The choice of the new generation. -- *** This space is for rent ***