United Kingdom:One Omega Drive, River Bend Technology Centre
ISO 9002 CertifiedNorthbank, Irlam, Manchester
M44 5BD United Kingdom
TEL: +44 (0)161 777 6611FAX: +44 (0)161 777 6622
Toll Free in United Kingdom: 0800-488-488
e-mail: sales@omega.co.uk
OMEGAnet®Online Service Internet e-mail
www.omega.com info@omega.com
It is the policy of OMEGA to comply with all worldwide safety and EMC/EMI regulations that
apply. OMEGA is constantly pursuing certification of its products to the European New Approach
Directives. OMEGA will add the CE mark to every appropriate device upon certification.
The information contained in this document is believed to be correct, but OMEGA Engineering, Inc. accepts
no liability for any errors it contains, and reserves the right to alter specifications without notice.
WARNING: These products are not designed for use in, and should not be used for, patient-connected applications.
Page 3
OME-PCI-TMC12(A)
User Manual
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 1
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 34
Page 37
5.1 Demo1: Use D/O
/* demo 1 : D/O demo */
/* step 1 :
/* step 2 : run DEMO1.EXE */
/* step 3 : check the LEDs of OME-DB-16R turn on sequentially */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
WORD pci_tmc12_do(WORD wDo);
WORD wBaseAddr, wIrq, wPLX;
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\nCard_%d: wBaseAddr=%x, wIrq=%x, wPLX=%x"
,i,wBaseAddr,wIrq,wPLX);
}
void pci_tmc12_di(WORD *wDi)
{
WORD wRetVal;
(*wDi)=(inport(wBase+0x14))&0xffff;
}
: connect a CON2 & CON3 of OME-PCI-TMC12 with a */
20-pin 1-to-1 flat cable */
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 36
Page 39
5.3 Demo3: Wave Generator
/* demo 3 : Square Wave Generator */
/* step 1 : all CLK select clock1=8M */
/* step 2 : run DEMO3.EXE */
/* step 3 : check all Cout of four 8254 by scope */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD wBaseAddr,wIrq,wPLX;
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\nCard_%d: wBaseAddr=%x, wIrq=%x, wPLX=%x"
,i,wBaseAddr,wIrq,wPLX);
}
/* down count from 8000 --> 7999 --> ..... --> 1 --> 0 --> 0xfff */
delay_one_ms()
{
int low,high;
pci_tmc12_select8254(0); /* select 8254-chip-0 */
pci_tmc12_c0(0x30,0x40,0x1f); /* CH-1,mode-0 down count 8000 */
for (;;)
{
outportb(wBaseAddr+0x0C,0x00); /* latch counter_0 */
low=inportb(wBaseAddr);
high=inportb(wBaseAddr);
if (high>0x20) return; /* overflow Æ time up */
}
CLK-1 select clock1=8M */
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 39
Page 42
5.5 Demo5: 16-bit Event Counter
/* demo 5 : 16-bit event down counter */
/* step 1 : CNT1 select ECLK1 (JP22) */
/* step 2 : run demo5.exe */
/* step 3 : connect the external CNT signal to pin1 of CON1 */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD wBaseAddr,wIrq,wPLX;
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
unsigned int high,low,count;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD init_watchdog();
WORD wBaseAddr,wIrq,wPLX;
static void interrupt irq_service();
int watchdog,irqmask;
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
DWORD dwVal;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 cards in this PC !!!\n");
exit(0);
}
/* 80K*65536_count=0.8192 sec --> high_width=0.4096 sec */
/* --> the user has to refresh the watchdog before 0.4 sec */
refresh_watchdog()
{
pci_tmc12_c2(0xb6,0xff,0xff); /* mode_3, CNT2--> CH3 */
return(NoError);
}
void interrupt irq_service()
{
watchdog++;
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
}
Refer to Sec. 3.3.5 for more information.
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 43
Page 46
5.8 Demo8: Pulse Width Measure
/* demo 8 : Pulse Width Measure */
/* step 1 : J19 select EXTG1, J22 select CLOCL1=8M hz */
/* step 2 : connect pin20 of CON1 to pin1 of CON2 */
/* step 3 : connect external signal to (pin20,pin19) */
/* step 4 : run demo8.exe, the width of active high pulse will */
/* be shown in the screen. (8 ms max.) */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
void pci_tmc12_di(WORD *wDi);
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD wBaseAddr,wIrq,wPLX;
int main()
{
int i,j,k;
WORD wBoards,wRetVal;
char c,cc[80];
unsigned int high,low,count;
float ms;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\n Card_%d: wBaseAddr=%x, wIrq=%x, wPLX=%x"
,i,wBaseAddr,wIrq,wPLX);
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 45
Page 48
5.9 Demo9: Frequency Measure
/* demo 9 : Signal Frequency Measure */
/* step 1 : J19 select EXTG1, J22 select CLOCL1=8M hz */
/* step 2 : J20 select \COUT1,J23 select ECLK2 */
/* step 3 : connect external signal to (pin21,pin19) */
/* step 4 : run demo9.exe, the frequency of input signal will */
/* be shown in the screen. (125 Hz min.) */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
void pci_tmc12_di(WORD *wDi);
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD wBaseAddr,wIrq,wPLX;
int main()
{
int i,j,k;
WORD wBoards,wRetVal;
char c,cc[80];
unsigned int high,low,count,cout0;
float f,t;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(4) *** frequency must be > 125 Hz ***\n",wBaseAddr);
pci_tmc12_select8254(0); /* select 8254-chip-0 */
pci_tmc12_c0(0x30,0xff,0xff); /* CH-1,mode-0 down count ffff */
pci_tmc12_c1(0x70,0xff,0xff); /* CH-2,mode-0 down count ffff */
for (;;)
{
outportb(wBaseAddr+0x0C,0xE2); /* latch status of counter0 */
low=inportb(wBaseAddr);
high=inportb(wBaseAddr);
cout0=low&0x80;
if (cout0!=0) break;
if (kbhit()!=0) {getch(); break;}
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 46
Page 49
/* COUT0 = 65536*0.000125=8.192 ms */
t=8.192/(float)count; /* ms */
f=(1.0/t)*1000.0; /* f=1/T */
printf("\nhigh=%x, low=%x, count=%d : frequency = %f
Hz",high,low,count,f);
PTMC12_DriverClose();
}
8M
High
External signal
CLK1
GATE1
COUT1
COUT2
GATE2
CLK2
T
T
t
N
• Down_count2=number of down count in CNT2
• t=T/Down_count2
• f=1/t
• The CNT1 can be changed to CNT3/4/5/6.
The COUT of CNT 8/9/10/11/12/13 are
directly connected to next counter
without inverter. So they can not be used
to replace CNT1.
• The 12 CNTs of TMC-12 are divided into
two groups: inverted group & non-inverted
group. The inverted group includes CNT
1/2/3/4/5/6. The non-inverted group
included CNT 7/8/9/10/11/12. The user has
to select his proper group for different
application.
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 47
Page 50
5.10 Demo10: Find Card Number
/* demo 10: Find card number demo */
/* step 1 : run DEMO10.EXE */
/* step 2 : connect a 20-pin flat cable to CON2&CON3 of card_? */
/* step 3 : The card number is shown in screen as TEST OK */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
WORD pci_tmc12_do(WORD wDo);
void pci_tmc12_di(WORD *wDi);
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD wBaseAddr,wIrq;
int main()
{
int i,j,k;
WORD wBoards,wRetVal;
char c;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
for (;;)
{
printf("\n------------- press any key to stop -------------");
for (i=0; i<wBoards; i++) test_card(i);
for (i=0; i<1000; i++) delay_one_ms(); /* delay 1 sec */
if (kbhit()!=0) {getch(); break;}
}
PTMC12_DriverClose();
}
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD init_CH3();
WORD wBaseAddr,wIrq,wPLX;
static void interrupt irq_service();
int COUNT3,irqmask,now_int_state;
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
DWORD dwVal;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 cards in this PC !!!\n");
exit(0);
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 49
Page 52
/* Use CH3 to simulate the external signal */
/* The user can must set the J25=CH3 in this demo. */
/* The user can set the J25=EXT in real world application. */
WORD init_CH3()
{
DWORD dwVal;
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD init_CH3();
WORD wBaseAddr,wIrq,wPLX;
static void interrupt irq_service();
int COUNT3,WIDTH3,CNT_H,CNT_L,irqmask,now_int_state;
int main()
{
int i,j;
WORD wBoards,wRetVal,count;
char c;
DWORD dwVal;
float low_pulse_width;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
ret_label:
PTMC12_DriverClose();
_outpd(wPLX+0x4c,0); /* disable all interrupt */
}
/* ------------------------------------------------------------- */
/* Use CH3 to simulate the external signal */
/* The user can must set the J25=CH3 in this demo. */
/* The user can set the J25=EXT in real world application. */
WORD init_CH3()
{
DWORD dwVal;
if (now_int_state==0)/*
{
COUNT3++; /* find a HIGH_pulse */
if (COUNT3==4) /* stop down-count & read-counter */
{
outportb(wBaseAddr+0x0C,0x40); /* latch counter1 */
CNT_L=inportb(wBaseAddr+0x04);
CNT_H=inportb(wBaseAddr+0x04);
_outpd(wPLX+0x4c,0); /* disable all interrupt */
}
_outpd(wPLX+0x4c,0x41); /* channel_1, interrupt active_Low */
now_int_state=1; /* now int_signal is High */
}
old state=low Æ change to high now */
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 52
Page 55
else /* old state=low Æ change to high now */
K
{
COUNT3++; /* find a low_pulse */
if (COUNT==3) /* start counter */
pci_tmc12_c1(0x70,0xff,0xff); /* CH-2,mode-0 down count ffff */
else
_outpd(wPLX+0x4c,0x43); /* channel_1, interrupt active_High*/
now_int_state=0; /* now int_signal is Low */
}
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
}
Initial=High
BASE CLK=1K
8M
High
High
START
CNT2
STOP
CNT2
CLK1
GATE1
N=down-count of CNT2
Clock=1 ms
Width of low pulse = N*1 ms
COUT1
1
CLK2
GATE2
COUT2
Refer to Sec. 3.3.5 for more information.
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 53
Page 56
5.13 Demo13: High Pulse Width
/* demo 13 detect the pulse_width of high_pulse */
/* (Use CH-3 to simulate external pulse) */
/* step 1 : CLK-3 select clock2=80K --> simulate ext signal */
/* step 2 : CLK-1 select clock1=8M --> generate BASE clock */
/* step 3 : CLK-2 select COUT1=1K --> measure pulse-width */
/* step 4 : J25 select CH3 */
/* step 5 : run demo13.exe */
/* ----------------------------------------------------------- */
………………………………………………………………………………………………………………………………………………………………………….
…………………………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………………………………
/* -------------------------------------------------------------*/
/* Use CH3 to simulate the external signal */
/* The user can must set the J25=CH3 in this demo. */
/* The user can set the J25=EXT in real world application. */
WORD init_CH3()
{
DWORD dwVal;
void interrupt irq_service()
{
if (now_int_state==0)
{
COUNT3++; /* find a high_pulse */
if (COUNT3==2) /* start to down-count */
pci_tmc12_c1(0x70,0xff,0xff);/* CH-2,mode-0 down count ffff */
_outpd(wPLX+0x4c,0x41); /* channel_1, interrupt active_Low */
now_int_state=1; /* now int_signal is High */
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 54
Page 57
else
K
K
{
COUNT3++; /* find a low_pulse */
if (COUNT3==3) /* stop the down-count & read-count */
{
outportb(wBaseAddr+0x0C,0x40);/* latch counter1 */
CNT_L=inportb(wBaseAddr+0x04);
CNT_H=inportb(wBaseAddr+0x04);
_outpd(wPLX+0x4c,0); /* disable all interrupt */
}
else
_outpd(wPLX+0x4c,0x43); /* channel_1, interrupt active_High*/
now_int_state=0; /* now int signal is Low */
}
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
}
BASE CLK=1
Initial=Low
8M
High
1
High
CLK1
GATE1
COUT1
CLK2
GATE2
COUT2
START
CNT2
STOP
CNT2
N=down-count of CNT2
Clock=1 ms
Width of high pulse = N*1 ms
Refer to Sec. 3.3.5 for more information.
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 55
Page 58
5.14 Ndemo1: Using LEDs
/* ndemo1 : LED1, LED2, LED3 demo */
/* step 1 : default shipping of OME-PCI-TMC12A */
/* step 2 : run NDEMO1.EXE */
/* step 3 : the LED1/2/3 of TMC12A will turn on sequentially */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
WORD pci_tmc12_do(WORD wDo);
WORD pci_tmc12_do2(WORD wXor);
WORD wBaseAddr,wIrq,wPLX;
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 cards in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\n Card_%d: wBaseAddr=%x, wIrq=%x,
wPLX=%x",i,wBaseAddr,wIrq,wPLX);
}
PTMC12_GetConfigAddressSpace(0,&wBaseAddr,&wIrq,&wPLX); /* select
card_0 */
printf("\n(3) *** Card_0 LED test, wBaseAddr=%x ***",wBaseAddr);
pci_tmc12_do2(0xe000); printf("\nAll LED off, press any key to
continue"); getch();
pci_tmc12_do2(0xc000); printf("\nLED1 on, press any key to
continue"); getch();
pci_tmc12_do2(0xa000); printf("\nLED2 on, press any key to
continue"); getch();
pci_tmc12_do2(0x6000); printf("\nLED3 on, press any key to
continue"); getch();
WORD pci_tmc12_do2(WORD wXor)
{
outport(wBaseAddr+0x18,wXor);
return(NoError);
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 56
Page 59
5.15 Ndemo2: Generate 2 Clocks
/* ndemo2 : generate 2 starting clock demo */
/* step 1 : all clock sources select external_clock */
/* step 2 : run NDEMO2.EXE */
/* step 3 : read the counter value of counter1 to counter12 */
/* ----------------------------------------------------------- */
#include "PCITMC12.H"
WORD wBaseAddr,wIrq,wPLX;
WORD pci_tmc12_do(WORD wDo);
WORD pci_tmc12_do2(WORD wXor);
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
void read_c0(int B);
void read_c1(int B);
void read_c2(int B);
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\n Card_%d: wBaseAddr=%x, wIrq=%x,
wPLX=%x",i,wBaseAddr,wIrq,wPLX);
}
WORD pci_tmc12_select8254(char cChip);
WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh);
WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh);
WORD init_watchdog();
WORD wBaseAddr,wIrq,wPLX;
static void interrupt irq_service();
int watchdog,irqmask;
int main()
{
int i,j;
WORD wBoards,wRetVal;
char c;
DWORD dwVal;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\n Card_%d: wBaseAddr=%x, wIrq=%x,
wPLX=%x",i,wBaseAddr,wIrq,wPLX);
}
/* 80K*65536_count=0.8192 sec --> high_width=0.4096 sec */
/* --> the user has to refresh the watchdog before 0.4 sec */
refresh_watchdog()
{
pci_tmc12_c2(0xb6,0xff,0xff); /* mode_3, CNT2--> CH3 */
return(NoError);
}
void interrupt irq_service()
{
watchdog++;
inport(wBaseAddr+0x18); /* pre-set int_signal_to_PC, added line 2 */
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 61
Page 64
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 62
Page 65
5.17 Ndemo4: Active High Int
/* ndemo4 : interrupt demo, int source=initial low, active High */
/* step 1 : connect DO1 (pin1 of CON3) to ECLK11 (pin16 of CON1) */
/* step 2 : J25 select EXT */
/* step 3 : run ndemo4.exe */
/* step 4 : press any key to test, press Q to stop */
/* ------------------------------------------------------------- */
WORD pci_tmc12_do(WORD wDo);
WORD pci_tmc12_do2(WORD wDo);
WORD init_interrupt();
WORD wBaseAddr,wIrq,wPLX,int_count;
static void interrupt irq_service();
int irqmask;
int main()
{
int i,j;
WORD wBoards,wRetVal,old_count;
char c;
DWORD dwVal;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\n Card_%d: wBaseAddr=%x, wIrq=%x,
wPLX=%x",i,wBaseAddr,wIrq,wPLX);
}
pci_tmc12_do(0); /* DO1=int source --> initial low, active High */
init_interrupt();
old_count=1;
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 63
Page 66
for (;;)
{
if (old_count != int_count)
{
printf("\nint_High_count=%d",int_count);
old_count=int_count;
}
if (kbhit()!=0)
{
c=getch();
if ((c=='q') || (c=='Q')) break;
pci_tmc12_do(1); /* generate a High pulse to */
pci_tmc12_do(0); /* DO1=ECLK11=J25=int source */
printf(" --> Generate a High interrupt pulse");
}
}
PTMC12_DriverClose();
_outpd(wPLX+0x4c,0); /* disable all interrupt */
}
int_count=0;
pci_tmc12_do2(0); /* set IntXor OFF to non-invert the int source */
inport(wBaseAddr+0x18); /* pre-set int_signal_to_PC to High value */
/* to enable next interrupt operation */
void interrupt irq_service()
{
/* now the int_signal_to_PC is in Low state */
inport(wBaseAddr+0x18); /* pre-set int_signal_to_PC to High value */
/* to enable next interrupt operation */
int_count++;
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 64
Page 67
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 65
Page 68
5.18 Ndemo5: Active Low Int
/* ndemo5 : interrupt demo, int source=initial High, active Low */
/* step 1 : connect DO1 (pin1 of CON3) to ECLK11 (pin16 of CON1) */
/* step 2 : J25 select EXT */
/* step 3 : run ndemo5.exe */
/* step 4 : press any key to test, press Q to stop */
/* ------------------------------------------------------------- */
WORD pci_tmc12_do(WORD wDo);
WORD pci_tmc12_do2(WORD wDo);
WORD init_interrupt();
WORD wBaseAddr,wIrq,wPLX,int_count;
static void interrupt irq_service();
int irqmask;
int main()
{
int i,j;
WORD wBoards,wRetVal,old_count;
char c;
DWORD dwVal;
clrscr();
wRetVal=PTMC12_DriverInit(&wBoards);
printf("\n(1) Threr are %d OME-PCI-TMC12 Cards in this PC",wBoards);
if ( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no OME-PCI-TMC12 card in this PC !!!\n");
exit(0);
}
printf("\n(2) Show the Configuration Space of all OME-PCI-TMC12:");
for(i=0; i<wBoards; i++)
{
PTMC12_GetConfigAddressSpace(i,&wBaseAddr,&wIrq,&wPLX);
printf("\n Card_%d: wBaseAddr=%x, wIrq=%x,
wPLX=%x",i,wBaseAddr,wIrq,wPLX);
}
void interrupt irq_service()
{
/* now the int_signal_to_PC is in Low state */
inport(wBaseAddr+0x18); /* pre-set int_signal_to_pc to High value */
/* to enable next interrupt operation */
int_count++;
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
}
OME-PCI-TMC12(A) User Manual (Ver. 2.0, Sep/2002) --- 67
Page 70
WARRANTY/DISCLAIMER
OMEGA ENGINEERING, INC. warrants this unit to be free of defects in materials and workmanship for a
period of 13 months from date of purchase. OMEGA’s WARRANTY adds an additional one (1) month
grace period to the normal one (1) year product warranty to cover handling and shipping time. This
ensures that OMEGA’s customers receive maximum coverage on each product.
If the unit malfunctions, it must be returned to the factory for evaluation. OMEGA’s Customer Service
Department will issue an Authorized Return (AR) number immediately upon phone or written request.
Upon examination by OMEGA, if the unit is found to be defective, it will be repaired or replaced at no
charge. OMEGA’s WARRANTY does not apply to defects resulting from any action of the purchaser,
including but not limited to mishandling, improper interfacing, operation outside of design limits,
improper repair, or unauthorized modification. This WARRANTY is VOID if the unit shows evidence of
having been tampered with or shows evidence of having been damaged as a result of excessive corrosion;
or current, heat, moisture or vibration; improper specification; misapplication; misuse or other operating
conditions outside of OMEGA’s control. Components which wear are not warranted, including but not
limited to contact points, fuses, and triacs.
OMEGA is pleased to offer suggestions on the use of its various products. However,
OMEGA neither assumes responsibility for any omissions or errors nor assumes liability for any
damages that result from the use of its products in accordance with information provided by
OMEGA, either verbal or written. OMEGA warrants only that the parts manufactured by it will be
as specified and free of defects. OMEGA MAKES NO OTHER WARRANTIES OR
REPRESENTATIONS OF ANY KIND WHATSOEVER, EXPRESS OR IMPLIED, EXCEPT THAT OF TITLE,
AND ALL IMPLIED WARRANTIES INCLUDING ANY WARRANTY OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. LIMITATION OF
LIABILITY: The remedies of purchaser set forth herein are exclusive, and the total liability of
OMEGA with respect to this order, whether based on contract, warranty, negligence,
indemnification, strict liability or otherwise, shall not exceed the purchase price of the
component upon which liability is based. In no event shall OMEGA be liable for
consequential, incidental or special damages.
CONDITIONS: Equipment sold by OMEGA is not intended to be used, nor shall it be used: (1) as a “Basic
Component” under 10 CFR 21 (NRC), used in or with any nuclear installation or activity; or (2) in medical
applications or used on humans. Should any Product(s) be used in or with any nuclear installation or
activity, medical application, used on humans, or misused in any way, OMEGA assumes no responsibility
as set forth in our basic WARRANTY/ DISCLAIMER language, and, additionally, purchaser will indemnify
OMEGA and hold OMEGA harmless from any liability or damage whatsoever arising out of the use of the
Product(s) in such a manner.
RETURN REQUESTS/INQUIRIES
Direct all warranty and repair requests/inquiries to the OMEGA Customer Service Department. BEFORE
RETURNING ANY PRODUCT(S) TO OMEGA, PURCHASER MUST OBTAIN AN AUTHORIZED RETURN
(AR) NUMBER FROM OMEGA’S CUSTOMER SERVICE DEPARTMENT (IN ORDER TO AVOID
PROCESSING DELAYS). The assigned AR number should then be marked on the outside of the return
package and on any correspondence.
The purchaser is responsible for shipping charges, freight, insurance and proper packaging to prevent
breakage in transit.
FOR W
ARRANTY
RETURNS, please have the
following information available BEFORE
contacting OMEGA:
1. Purchase Order number under which the product
was PURCHASED,
2. Model and serial number of the product under
warranty, and
3. Repair instructions and/or specific problems
relative to the product.
FOR NON-W
ARRANTY
REPAIRS,
consult OMEGA
for current repair charges. Have the following
information available BEFORE contacting OMEGA:
1. Purchase Order number to cover the COST
of the repair,
2. Model and serial number of the product, and
3. Repair instructions and/or specific problems
relative to the product.
OMEGA’s policy is to make running changes, not model changes, whenever an improvement is possible. This affords
our customers the latest in technology and engineering.
reproduced, translated, or reduced to any electronic medium or machine-readable form, in whole or in part, without the
prior written consent of OMEGA ENGINEERING, INC.