請問一下如何利用c語言寫一個中斷副程式? |
尚未結案
|
snyu1982
一般會員 發表:3 回覆:2 積分:1 註冊:2005-07-15 發送簡訊給我 |
|
hobolin
初階會員 發表:0 回覆:25 積分:25 註冊:2005-07-03 發送簡訊給我 |
|
snyu1982
一般會員 發表:3 回覆:2 積分:1 註冊:2005-07-15 發送簡訊給我 |
請問一下如何利用c語言寫一個完整的中斷程式架構?
我是要用在控制類比數位信號轉換的(卡片為ISA),
希望能利用固定週期的中斷
達到固定取樣頻率做一次A/D轉換的目的
只是要利用到C語言中的中斷指令,
但是不知要如何下手!!!!!請各位幫個忙!!!!!
方便的話可以給小弟完整的DEMO嗎?(包含所有宣告,inculde)
若能標明["固定時間"的設定處]和["A/D轉換的程式"該放在哪裡]更好
PS:我用TURBO C 3.0 (DOS下操作)
E-MAIL:tsai.snyu@msa.hinet.net
|
hobolin
初階會員 發表:0 回覆:25 積分:25 註冊:2005-07-03 發送簡訊給我 |
用 google 查到了下面的網址
http://downloads.suntimes.com/category.php%5Baction%5Dbrowse&i=20&id=294&f=%7C%7C%7C%7C&s=product.date_released%7CDESC%5BSiteID%5Dsuntimes 裡面有 ticktock.c
/* Name: ticktock.c Author: Michael Tighe System: IBM PC/XT/AT/PS2, MS-DOS 3.30 Language: Turbo C Version 2.00 Description: Demo of the IBM-PC's high resolution clock INFO FOR TICKTOCK: The TICKTOCK programs demonstrate how to obtain accurate timing information from the IBM PC/XT/AT family of computers. The next few paragraphs should give you a basic idea of how the time is stored in these computer systems. In the PC family, an internal clock runs at 1.193180 Mhz. This clock is divided by 65536 to give 18.206482 clock pulses per second (.0549255 seconds per clock pulse). Therefore, the clock 'ticks' every .0549255 seconds. Two addresses in low memory are used to keep track of the tick count. They are both 1 word (two bytes) in length. The first is at address 0000:046C. It is incremented 18.2 times a second. When it overflows, it is reset to 0 and another word at address 0000:046E is incremented. It should be noted that the word at address 0000:046E is also the current hour, in 24 hour format. The address at 0000:046C when divided by 18.2, is the current time past the hour, in seconds. */ # include取得系統時間後,可以用此做一個簡單的 delay 程式,以達 到週期性取值的目的。 沒辦法給你完整的 demo,手頭上沒有 dos 可以測試, 不過這個 code 應該是沒有問題的 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |