|
답글 감사 합니다...
많은 도움이 되었습니다....^^*
좋은 하루 되시구요...추석 잘 보내세요..
유영인.Chris 님이 쓰신 글 :
: 죄송하지만 질문이 광범위 해서 어떤 부분이 문제가 있는지는 잘 모르겠고요. 일단, 주파수나 이런 것들이 어떤 경로를 통해서 들어 오느냐도 중요하고요, 주소값에서 직접 읽어오시려면 Windows 2000 등을 배려하여 따로 컴포넌트 등을 설치하셔야 겠고요, 어떤 작업을 하시느냐도 중요합니다.
: 이쪽 분야가 아니라서 잘 모르겠지만, I2C 와 비슷한 구조라면, 이전에 잠깐 작업한 I2C 소스를 올려드리겠습니다.
:
: 아래는, 제 답변은 아니지만, 어떤 사람이 counter 0, 8254, mode 3 을 가지고 테스트 한 소스입니다.
:
:
: Look at QueryPerformanceCounter and QueryPerformanceFrequency in the
: Win32 on-line help.
:
: I ran the code below inside of the IDE (debug on) in an AMD900MHz
: Win98SE and got 16 - 17 ticks, 1193180 ticks/s (a 1.19 MHz counter
: = 0.84 us period) and an elapsed time of 13.41 - 14.25 us
:
: BTW, the number 1193180 reminds me of the input frequency of the
: 8254 counter chip the PCs' used(?) to have. I suppose this chip or an
: equivalent one is still present on PCs' mainboard. On old DOS days,
: counter 0 of the 8254 was initialized to mode 3 with a 65535 count
: period, so IRQ0 (which was mapped to INT8h) was issued 18.2 times
: per second (+- 55 ms interval). This was the basic tick for DOS.
: Probably Windows reprograms the 8254's (or its equivalent) counters
: to achieve better timing resolution.
:
: But be careful: I believe precision timing under multitask
: environments is problematic.
:
: Regards
:
: Eudy
:
: //----------------------------------------------------
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
: LARGE_INTEGER Count, Freq;
: __int64 *C, *F, ini;
: int Max=250;
:
: if (!QueryPerformanceCounter(&Count)) {
: ShowMessage("QueryPerformanceCounter failed");
: return;
: }
: ini = *(__int64*)&Count;
: if (!QueryPerformanceFrequency(&Freq)) {
: ShowMessage("QueryPerformanceFrequency failed");
: return;
: }
: F=(__int64*)&Freq;
: for (int i=0; i<Max; i++) {
: int dummy = i-1;
: }
: QueryPerformanceCounter(&Count);
: C=(__int64*)&Count;
: Caption = "Elapsed (ticks)=" + IntToStr((*C-ini)) +
: " 1/Freq (ticks/s)=" + IntToStr(*F) +
: " Elapsed (us)= " +
: FloatToStr(1.e6*(double)(*C-ini)/(double)(*F));
: }
: //----------------------------------------------------
:
:
: 월하독작 님이 쓰신 글 :
: : 안녕하세요??
: : 막 C++builer를 시작한 초보인데요...도저히 이해가 안가서 질문드립니다...
: :
: : 외부 입력 주파수를 8254라는 타이머/카운터를 이용하여 edit창에 띄우고 싶습니다.
: : counter0에 입력이 되고요.. mode4를 사용 합니다.
: : 간단한 주석문과 합께 부탁합니다....
: :
: : 또 GetTickConter()라는 것도 정확히 이해가 안가서요...답변 부탁드립니다...
: : 좋은 하루 부탁드립니다....
|