Home
1. Introducton
Contents
1. CLK1 12 jumper Select sources CLKI JP22 CLOCK2 COUT6 ECLK1 CLK2 JP23 CLOCK2 COUTI ECLK2 CLK3 JP24 CLOCK2 COUT2 ECLK3 CLK4 JP13 CLOCK1 CLOCK2 COUT3 ECLK4 CLK5 JP14 CLOCK1 CLOCK2 COUT4 ECLK5 CLK6 JP15 CLOCKI CLOCK2 COUTS ECLK6 CLK7 JP10 CLOCK2 COUT12 ECLK7 CLK8 CLOCK1 CLOCK2 COUT7 ECLK8 CLK9 JP12 CLOCK1 CLOCK2 COUT8 ECLK9 CLK10 CLOCK1 CLOCK2 COUT9 ECLK10 CLK11 JP2 CLOCK1 CLOCK2 COUT10 ECLK11 CLK12 JP3 CLOCK1 CLOCK2 COUT11 ECLK12 PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 10 2 4 3 GATE1 GATE12 3 1 GATEn EXTGn GATEn Inverted COUTn 1 GATE Jumper Select source GATEI 19 Inverted COUT6 GATE2 J20 Inverted COUT1 EXTG2 GATE3 J21 Inverted COUT2 EXTG3 GATE4 J16 Inverted COUT3 EXTG4 5 J17 Inverted COUTA 5 GETE6 J18 Inverted COUT5 EXTG6 3 3 1 1 GATEn EXTGn GATEn COUTn 1 GATE Jumper Select source GATE7 J7 COUT12 EXTG7 GATES J8 COUT7 8 GATE9 J9 COUTS EXTG9 GATEIO J4 79 EXTG10 15 COUT10 EXTGI 1 GETEI2 6 COUTII EXTGI2 2 User s Manual Ver 2 0 Sep 2002 PMH 016 20 11 2 4 4 J25 Interrupt Source Selection There are five signals can be used
2. now_int_state 1 now int_signal is High codes given here _outpd wPLX 0x4c 0x41 active Low else old state high gt change to low now now_int_state 0 now int_signal is Low codes are given here _outpd wPLX 0x4c 0x43 active High if wIrq 8 outportb A2 8259 0x20 outportb 1 8259 0 20 ES PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 016 20 25 Example 2 assume initial level Low Initial Low 4 Y A i Initial sub now int state 0 _outpd wPLX 0x4c 0x43 INT signal is ISR_sub If now_int_state 0 old state low gt change to high now now_int_state 1 now int_signal is High application codes given here _outpd wPLX 0x4c 0x41 active Low else old state high gt change to low now now_int_state 0 now int_signal is Low T application codes are given here _outpd wPLX 0x4c 0x43 active High if wIrq 8 outportb A2 8259 0x20 Ps outportb Al 8259 0x20 So ISR_ sub will be active rising edge amp falling edge of interrupt signal Refer to demo7 c demol1 c 4 12 amp 4 13 for more information PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 26 3 4 New features 12 3 4 1 Default Shipping of PCI TM
3. printf n 1 Threr are PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n 1 0 printf n 2 Show the Configuration Space of all PCI TMC12 for i 0 i lt wBoards i 12 GetConfigAddressSpace i amp wBaseAddr amp wIrq amp wPLX printf 4 wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX 0 printf n 3 0 D O test wBaseAddr x wBaseAddr j 1 0 1 lt 16 i pci tmcl2 do j printf nTEST 2d gt DO x i j c getch if ess q c Q return j j 1 if j 0 1 12 DriverClose WORD pci tmcl2 do WORD wDo outport wBaseAddr 0x14 wDo return NoError PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 35 5 2 Demo2 Use e Ifthere is only one PCI TMCI2 this program will test this only card e Ifthere are over one PCI TMC12 cards installed in the PC system this program will test the second card How can we know which card is the second card Please refer to Sec 3 2 for more information demo 2 D I demo step 1 connect 2 amp CON3 of PCI TMC12 with a 20 1 to 1 flat
4. 24 photo MOS relay 0 1A 350VAC DB 24C 24 open collector 100 per channel 30V max The DB 24PR 24 channel power relay output board consists of 8 form C and 16 form A electromechanical relays for efficient switching of load programmed control The contact of each relay can control a 5A load at 250ACV 30VDCV The relay is energized by applying a 5 voltage signal to the appropriate relay channel on the 20 pin flat cable connector just used 16 relays or 50 pin flat cable connector OPTO 22 compatible for DIO 24 series Twenty four enunciator LEDs one for each relay light when their associated relay is activated To avoid overloading your power supply this board needs a 12VDC or 24VDC external power supply Normal Open From A Relay Com 20Pin cable To 20pin connector DB 24PR ES CON3 D O PCI TMC12 A Note 50 Pin connector OPTO 22 compatible for DIO 24 DIO 48 DIO 144 20 Pin connector for 16 channel digital output A 82X A 62X DIO 64 ISO DA16 DA8 Channel 16 From A Relay 8 From Relay Relay switching up to 5A at 110 5A at 30DCV PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 16 2 6 Pin Assignment The CONI is a 37 pin D type female connector 000 p ps ue o ee pem 09 p pako 2
5. COUNT3 0 indt CH3 4 while COUNT3 lt 4 if kbhit 0 getch break PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 51 count Oxff CNT_H 256 1 2 COUTO 1 ms low pulse width float count 1 0 printf NnCNT H x L x Low pulse f CNT H CNT L low pulse width ret label PTMC12 DriverClose _outpd wPLX 0x4c 0 disable all interrupt px Use CH3 to simulate the external signal user can must set the J25 CH3 this demo user set the J25 EXT real world application WORD init CH3 DWORD dwVal disable pci 12 c2 0xb6 0xff 0xff mode 3 CNT2 CH3 80K 65536 count 0 8192 sec gt high width 0 4096 sec 7 high width 0 4 sec low width 0 4 sec pci 12 0 0 36 0 32 CH 1 mode 3 low 0 high 32 cout 1K _outpd wPLX 0x4c 0x41 channel 1 interrupt active Low now int state 1 now int signal is High Xy if wIrq 8 irqmask inportb Al 8259 41 outportb Al 825941 irqmask Oxff 1 lt lt wIrq setvect wIrgt 8 irq service else irqmask inportb Al 8259 1 outporthb Al 825941 irqmask Oxfb LE TROD outporthb Al 8259 1 irgmask Oxff 1 lt lt wIrq irqmask inportb A2 8259 1 outportb A2 8259 1 Oxff 1 lt lt wIrq 8 setvect
6. down count from 8000 7999 gt 1 0 Oxfff delay one ms 1 int low high pei_tmcl2_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 gt 0x20 return overflow gt time up PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 39 5 5 Demod 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 signal to of 1 include PCITMC12 H WORD pci tmcl2 select8254 char cChip WORD pci tmcl2 cO char cConfig char cLow char cHigh WORD pci tmcl12 cl char cConfig char cLow char cHigh WORD pci tmcl2 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX int main rnt WORD wBoards wRetVal char c unsigned int high low count clrscr wRetVal PTMC12 DriverInit amp wBoards printf Mn l Threr are d 12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 12 GetConfigAddressSpace 0 amp wBaseAddr amp amp wPLX 0 printf n 3 Card 0 wBa
7. 2 User s Manual Ver 2 0 Sep 2002 016 20 27 3 4 2 Clock input of 8254 default select clock1 The clock input of 8254 chips in PCI TMCI2A is given as follows Xor control Register Sec 3 4 3 Select Clock source Xor logic Clock input default select clock1 The new features of PCI TMCI2A are given as follows A smith trigger buffer is added to remove noises in the selected clock source Xor control register is added to invert non inverted the selected clock source This mechanism can be used to generate 2 extra starting clocks to 8254 Note The Xor control register is clear to 0 when the PCI TMCI2A is first power up So the initial state of PCI TMCI2A is exactly compatible to PCI TMC12 Refer to Sec 5 15 Ndemo2 Generate 2 Clocks the twelve Xor bits are used to generate the 2 starting clocks So the initial value of 8254 can be verified after these 2 starting clocks are generated Then they are used to generate one single clock for testing In general these Xor bits are designed for generation of 2 starting clocks only PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 28 3 4 3 Xor control Register 12 WRITE wBase 0x18 set the Xor control register Note 1 Refer to Sec 3 1 for more information about wBase Note 2 All bits of this register will be clear to zero in power up stage gt invert non invert the s
8. i lt wBoards 1 12 GetConfigAddressSpace amp wBaseAddr amp amp wPLX printf Card d wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX select _0 printf 3 0 wBaseAddr x wBaseAddr printf Nn 4 start test interrupt pci tmc12 do 0 DOl int source gt initial low active High init interrupt old count 1 PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 61 for 22 if old count int count printf nint_High count d int count old count int count if kbhit 0 c getch if c q 0 break pci tmcl2 do 1 generate a High pulse to pci tmcl2 do 0 DOl ECLK11 2J25 int source printf Generate a High interrupt pulse 12 DriverClose _outpd wPLX 0x4c 0 disable all interrupt WORD init DWORD dwVal int count 0 pci 12 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 disable _outpd wPLX 0x4c 0x41 channel 1 interrupt active Low if wIrq 8 irqmask inportb Al 8259 1 outportb Al 825941 irqmask Oxff 1 lt lt wIrq
9. i5 6 EL quei ECLKI2 00000 COUTII B6 __ is 397 2 19 00 not available ECLKn external clock source for counter EXTGn external gate control signal for counter n COUTn output of timer counter n All signals are TTL compatible PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 17 assignment of digital input connector 5 Digital inputs 6 Digital input s_ 17 Digital input 8 Digital input 7_ 9 Digital inputs 10 Digital input 9_ Digital input 10 12 Digital input 11 Digital input 12 Digital input 13 15 Digital input 14 Digital input 15 PCB ground PCB ground PCB PCB pin assignment of digital output connector Digital output 4 Digital output 5 9 Digital ouput 10 Digital output 17 PCB ground PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 18 3 Control Register 3 1 How to Find the I O Address The plug amp play BIOS will assign a proper I O address to every PCI TMC12 A card in the power on stage The Ids of PCI TMC12 A are given as following e Vendor ID 1085 e Device ID 9050 e Sub vendor ID 2129 e Sub device ID 9912 We provide all necessary functions as following 1 PTMCI2 Driverlnit amp wBoard This function can detect how man
10. low width 0 4 sec now int state l now COUT3 is High xy _outpd wPLX 0x4c 0x41 channel 1 interrupt active Low if wIrq lt 8 irqmask inportb Al 8259 1 outportb Al 8259 1 irgmask amp Oxff 1 lt lt wIrq setvect wIrgt 8 irq service else irqmask inportb Al 8259 1 outporthb Al 825941 irqmask Oxfb IRQ2 outportb Al 825941 irqmask Oxff 1 lt lt wIrq irqmask inportb A2 825941 outportb A2 825941 amp Oxff 1 lt lt wIrq 8 setvect wIrg 8 0x70 irq service enable void interrupt irq service if now int state 0 old state low gt change to high now now int state 1 outpd wPLX 0x4c 0x41 1 if outporth 1 8259 0x20 find a high pulse nere now int state 0 COUNT3 _outpd wPLX 0x4c 0x43 channel_1 interrupt active High int signal is High channel 1 interrupt active Low old state high gt change to low now find a low pulse now int signal is low only count low pulse wIrq 8 outportb A2 8259 0x20 Refer to Sec 3 3 5 for more information V PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 50 5 12 Demo12 Low Pulse Width demo 12 detect the pulse width of low pulse Use 3 to Simulate external pulse step 1 C
11. t 8 192 float count ms f 1 0 t 1000 0 1 T printf nhigh x low x count d frequency f Hz high low count f PTMC12 DriverClose External signal 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 of 8 9 10 11 12 13 directly connected to next counter without inverter So they can not be used to replace 1 The 12 CNTs of TMC 12 are divided into two groups inverter group amp 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 2 User s Manual Ver 2 0 Sep 2002 016 20 47 5 10 10 Card Number demo 10 Find card number step 1 run DEMO10 EXE step 2 connect 20 pin flat cable to CON2 amp CON3 of step 3 card number is shown in screen as TEST x7 2 AU include PCITMC12 H WORD pci 12 do WORD void pci 12 di WORD wDi WORD pci 12 select8254 char cChip WORD pci 12 cO char cConfig char cLow char cHigh WORD pci 12 cl char cConfig char cLow char cHigh WORD pci tmcl2 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq int main int WORD wBoar
12. Counter 9 Counter 12 CLK CLK GATE9 GATE GATE12 GATE 2 User s Manual Ver 2 0 Sep 2002 016 20 7 2 3 Block Diagram PCI TMC12 A provide 16 channel digital input 16 channel digital output All levels are TTL compatible The connections diagram and block diagram are given as following read signal Local Data Bus write signal The D I port can be connected to the DB 16P The DB 16P is a 16 channel isolated digital input daughter board The D O port can be connected to the DB 16R or DB 24PR The DB 16R is a 16 channel relay output board The DB 24R is a 24 channel power relay output board PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 8 2 4 Jumper Setting 2 4 1 CLOCK1 amp CLOCK2 There are two stable internal clock sources in PCI TMC12 A which named as CLOCK amp CLOCK2 CLOCKI may be 8M or 1 6M selectable 127 The CLOCK2 may be 0 8M or 80K selected by J26 The block diagram of internal clock sources is given as following 8M 8M CLOCK1 2 CLOCKI 1 6 1 6 CLOCKI 8M CLOCKI 1 6M 800K 800K CLOCK2 5 CLOCK2 80K 80K CLOCK2 800K CLOCK2 80K 2 User s Manual Ver 2 0 Sep 2002 PMH 016 20 9 2 4 2 CLK1 to CLK12 select CLOCK1 select CLOCK2 select COUTn 1 select external CLKn from CN1 Select 2 Select CLOCKI 2 CLOCK2 5 6 A Ne Select
13. all resource of this card step3 control the PCI TMC12 A directly wBase wConfigSpace 0 0 get base address the card_0 outport wBase 0x14 wDoValue control the D O states of card_0 wDiValue inport wBase 0x14 read the D I states of card_0 wBase wConfigSpace 1 0 get base address of card_ 1 outport wBase 0x14 wDoValue control the D O states of card 1 wDiValue inport wBase 0x14 read the states of 1 wPLX wConfigSpace 2 2 get PCI interface base address of card 2 _outpd wPLX 0x4c 0x41 channel 1 interrupt active Low outpd wPLX 0x4c 0 disable all interrupt PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 016 20 20 3 2 Assignment of I O Address The plug amp play BIOS will assign the proper I O address to PCI TMCI2 If there is only one PCI TMC12 the user can identify the board as card 0 If there are two PCI TMCI2 cards in the system the user will be very difficult to identify which board is card 0 The software driver can support 16 boards max Therefore the user can install 16 boards of PCI TMC12 in one PC system How to find the card 0 amp card 1 The simplest way to find the card number is to use DEM10 EXE given DOS demo program This demo program will send a value to D O and read back from If the user install a 20 pin flat cable between CON2 amp CON3 the value read from D I will be the same as D O The
14. as interrupt sources CH3 CH6 CH9 CH12 amp EXT as following CH3 comes from COUT3 output of counter 3 CH6 comes from COUT6 output of counter 6 CH9 comes from COUT output of counter 9 CH12 comes from COUT12 output of counter 12 EXT comes from ECLK11 external CLK for counter 11 from CNI SPARE no interrupt source SPARE 2 User s Manual Ver 2 0 Sep 2002 016 20 12 2 5 Daughter Boards 2 5 1 DB37 The DB 37 is a general purpose daughter board for D sub 37 pins It is designed for easy wire connection gt Jedededededededededed 5 545454545454545454 2 5 2 DN37 DN20 The DN 37 is general purpose daughter board for DB 37 DN 20 is designed for 20 pin flat cable They are designed for easy wire connection They are Din Rail mounting 2 5 3 DB 8125 8 DB 8025 The DB 8125 is a general purpose screw terminal board It is designed for easy wire connection There are one DB 37 amp two 20 pin flat cable header in the DB 8125 The DB 8025 is designed for 20 pin flat cable header DB 8125 for DB 37 or 20 pin flat cable header PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 13 2 5 4 DB 16P Isolated Input Board The DB 16P is a 16 channel isolated digital input daughter board The optically isolated inputs of the DB 16P consists of a bi directional optocoupler with a re
15. cLow char cHigh WORD pci 12 cl char cConfig char cLow char cHigh WORD pci 12 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX int main int 2 7 5 WORD wBoards wRetVal char c cc 80 unsigned int high low count cout0 float f t clrscr wRetVal PTMC12 DriverInit amp wBoards printf NMn 1 Threr are d PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX card 0 printf 3 0 wBaseAddr x wBaseAddr printf n 4 frequency must be gt 125 Hz n wBaseAddr pci 12 select8254 0 select 8254 chip 0 pci tmcl2 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 0 2 latch status of counterO0 low inportb wBaseAddr high inportb wBaseAddr cout0 low amp 0x80 if cout0 20 break if kbhit 0 getch break outportb wBaseAddr 0x0C 0x40 latch counter 1 low inportb wBaseAddr 0x04 high inportb wBaseAddr 0x04 count 0xff high 256 Oxff low 2 PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 46 COUTO 65536 0 000125 8 192 ms
16. chip 3 is active D0 1 D1 1 8254 chip 4 is active outportb wBase 0x10 0 select the 8254 chip 1 CNT1 CNT3 outportb wBase 0x10 2 select the 8254 chip 3 CNT10 CNT12 PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 22 3 3 2 8254 Timer Counter Control There are four 8254 chips in PCI TMC12 A card Only one 8254 is active at a moment Before using the active 8254 use wBase 0x10 to select the active The 8254 has 4 registers from wBase 0 through wBase 0x0C For detailed programming information about 8254 please refer to Chapter 4 amp Microsystem Components Handbook assu 8254 Counter 0 Active 8254 Counter 0 lwBaset4 Active 8254 Counter 1 Active 8254 Counter 1 lwBaset8 Active 8254 Counter 2 Active 8254 Counter 2 wBase 0x0C Active 8254 Control word Active 8254 Control word Note Refer to Sec 3 1 for more information about wBase 3 3 3 Digital Input READ wBase 0x14 read the digital input channel 0 to 15 Note Refer to Sec 3 1 for more information about wBase wDiValue inport wBase 0x 14 read the states PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 23 3 3 4 Digital Output WRITE wBase 0x14 set the digital output channel 0 to 15 DO7 205 DO4 DO3 DO2 DOI Doo pois poio poo pos Note Refer to 3 1 for more information about wBase outport wBase
17. operation steps are given as following 1 Remove all 20 pin flat cable between CON2 and CON3 2 Install all PCI TMCI2 cards into this PC system 3 Power on and run DEMIO EXE 4 Now all D I value will be different from D O value 5 Install a 20 pin flat cable into CON2 amp CONG of any PCI TMCI2 card 6 There will be one card s value D O value the card number is also show in screen Therefore the user can find the card number very easy if he install a 20 pin flat cable into PCI TMC12 one by one PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 016 20 21 3 3 The Address The I O address of PCI TMC12 A is automatically assigned by main board ROM BIOS The I O address can also be re assigned by user It is strongly recommended not to change the I O address by user The plug amp play BIOS will assign proper I O address to each PCI TMC12 A very well The hardware I O ports are described as following Address Note Refer to Sec 3 1 for more information about wBase 3 3 1 Select the active 8254 chip 1 2 3 4 There are four 8254 chips in PCI TMC12 A card Only one 8254 is active at the same time Before using the active 8254 use wBase 0x10 to select the active 8254 WRITE wBase 0x10 select the active 8254 chip X k k k jg Note Refer to Sec 3 1 for more information about wBase D0 0 D1 0 8254 chip 1 is active D0 1 D1 0 8254 chip 2 is active D0 0 D1 1 8254
18. setvect wIrgt 8 irq service else irqmask inportb A1 8259 1 outportb Al 8259 1 irqmask amp Oxfb IRQ2 outportb Al 825941 irqmask Oxff 1 lt lt wIrq irqmask inportb A2 8259 41 outportb A2 825941 irqmask Oxff 1 lt lt wIrq 8 setvect wIrq 8 0x70 irq service enable void interrupt irq service now the int signal to is in Low state inport wBaseAddr 0x18 pre set int signal to PC to High value to enable next interrupt operation int counttt if wIrq 8 outportb A2 8259 0x20 outportb A1 8259 0x20 PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 016 20 62 5 18 Ndemod Active Low Int ndemo5 interrupt demo int source initial High active Low step 1 connect 001 pinl of CON3 to ECLK11 16 of 1 step 2 J25 select EXT step 3 run ndemo5 exe step 4 press any key to test press to stop include PCITMC12 H define 1 8259 0x20 define 2 8259 0 0 define EOI 0x20 WORD pci tmcl12 do WORD WORD pci tmcl2 102 WORD WORD init interrupt WORD wBaseAddr wIrq wPLX int count static void interrupt irq service int irqmask int main int 1 7 WORD wBoards wRetVal old count char c DWORD dwVal clrscr wRetVal PTMC12 DriverInit amp wBoards printf NMn 1 Threr are d PCI TMC12 Ca
19. wXor return NoError PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 58 5 16 Ndemo3 New ndemo3 watchdog timer using CH 3 modified from only add 2 lines to pre set int signal to PC step 1 CLK 3 select clock2 80K step 2 925 select X step 3 run ndemo3 exe include PCITMC12 H define 1 8259 0x20 define 2 8259 0xA0 define EOI 0x20 WO WO init watchdog wBaseAddr wIrq wPLX WORD pci 12 select8254 char cChip WORD pci 12 cO char cConfig char cLow char cHigh WORD pci 12 cl char cConfig char cLow char cHigh WORD pci 12 c2 char cConfig char cLow char cHigh RD RD static void interrupt irq service int watchdog irqmask int main WORD wBoards wRetVal char c DWORD dwVal clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are 24 PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 printf n 2 Show the Configuration Space of all PCI TMC12 for i 0 i lt wBoards 1 12 GetConfigAddressSpace i amp wBaseAddr amp wIrq amp wPLX printf Card 59 wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX 12 GetConfigAddressSpace 0 amp wBase
20. 0 50 0 clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are d PCI TMC12 Cards in this PC wBoards 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX card 0 printf n 3 Card 0 wBaseAddr x wBaseAddr printf Nn 4 16 bit event down counter n pci 12 select8254 0 select 8254 chip 0 pci tmcl2 0 0 30 CH 1 mode 0 down count ffff for outportb wBaseAddr 0x0C 0x00 latch counter 0 low inportb wBaseAddr high inportb wBaseAddr if high lt 0x80 50 1 if high gt 0x80 50 1 c65536 1 0 0 0 software count c65536 65536 0 0xff high 256 Oxff low 2 printf nhigh x low x c65536 f software count f high low c65536 software count if kbhit 0 getch break 12 DriverClose Note 1 The starting two ECLK will be used to initialize 8254 Note 2 c65536 will be increment by 1 every 65536 counts Note 3 So Total Count c65536 65536 Oxffff Current Counnt 2 Note 4 This software counter can be nearly infinite bits PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 41 5 7 Watchdog Timer 7 watchdog timer using step 1 CLK 3 select clock2 80K 924 step 2 INT select CH3 J2 step 3 run demo7 exe x7 2 he include PCITMC1
21. 0x14 wDoValue control the D O states 3 3 5 interrupt control status register of PCI 12 READ WRITE wPLX 0x4C interrupt control status register Bit Description BO INTERRUPT enable 0 disable 1 enable Bl POLARITY 1 active HIGH 0 active LOW B2 INTERRUPT status 0 int not active 1 int is active B3 reserved B4 reserved 5 reserved B6 PCI interrupt enable 0 disable 1 enable B7 Software interrupt a value of will generate interrupt B8 to reserved B31 Refer to DEMO7 C DEMO11 C DEMO12 C amp DEMO13 C for more information The interrupt of PCI TMC12 is level trigger The interrupt signal can be active low or active high programmable The procedures of programming are given as following PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 24 make sure the initial level is High Low if the initial state is High gt set the interrupt signal is active_low initially if the initial state is Low gt set the interrupt signal is active_high initially a a If the interrupt signal is active gt program will transfer into the interrupt service routine gt toggle the active_state before return from the ISR Example 1 assume initial level High Initial High Iniaial sub now int state 1 _outpd wPLX 0x4c 0x41 INT signal is active Low 15 sub If now_int_state 0 old state low gt change to high now
22. 0xff pci tmcl2 c2 0xb0 0xf9 0xff PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 57 pci 12 select8254 2 pci 12 c0 0x30 0xf8 0xff pci tmcl2 c1 0x70 0xf7 0xff pci tmcl2 c2 0xb0 0xf6 0xff pci tmcl2 select8254 3 pci 12 c0 0x30 0xf5 0xff pci tmcl2 c1 0x70 0xf4 0xff pci tmcl2 c2 0xb0 0xf3 0xff generate 2 starting clocks for all channels Counterl Counterl2 delay 1 pci tmcl12 do2 0 pci tmcl12 2 0 0 pci tmcl2 do2 0 pci tmcl12 do2 0xO0fff pci tmcl12 do2 0 for pci tmcl2 select8254 0 read 0 1 Counter 1 read_cl 2 Counter 2 read c2 3 Counter 3 pci tmcl2 select8254 1 read c0 4 Counter 4 read 1 5 Counter 5 read c2 6 Counter 6 pci tmcl2 select8254 2 read 0 7 Counter 7 read c1 8 Counter 8 read c2 9 Counter 9 pci tmcl2 select8254 3 read c0 10 Counter 10 read 1 11 Counter 11 read c2 12 Counter 12 generate one clock to all channels for testing only pci tmc12 do2 0xOfff pci tmc12 do2 0 printf Mn c getch rt fetutn 12 DriverClose JE WORD pci 12 WORD outport wBaseAddr 0x14 wDo return NoError WORD pci tmcl12 02 WORD wXor outport wBaseAddr 0x18
23. 2 H define 1 8259 0x20 define 2 8259 0xA0 define EOI 0x20 WORD pci 12 select8254 char cChip WORD pci 12 cO char cConfig char cLow char cHigh WORD pci 12 cl char cConfig char cLow char cHigh WORD pci 12 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 447 WORD wBoards wRetVal char ce DWORD dwVal clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are d PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX card 0 printf n 3 Card_0 wlIrq x wPLX x wIrq wPLX watchdog 0 pci 12 select8254 0 select 8254 chip 0 printf n 4 start refresh watchdog n init watchdog for refresh watchdog printf npress any key to simulate PC fail watch d watchdog if kbhit 0 getch break printf nWait watchdog failure PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 42 pop for if watchdog 0 printf nwatchdog is failure now break if kbhit 0 getch break 12 DriverClose _outpd wPLX 0x
24. 29 344 Block Diagram of Interrupt System esee eene 30 343 Demo LO SAM yee eee vedete t EE 31 2 User s Manual Ver 2 0 Sep 2002 PMH 016 20 2 4 254 seasessosonssvntssosenssusedeenes sosuesensesasssseeseduessosansonss sueteese 32 4 1 CONTROE WORD EORMAT e b it 32 4 2 COMMAND eerie eene ee 33 4 3 READ BACK COMMAND e eene EXE EE 33 4 4 STATUS BYTE FORMAT DO PEU 33 DEMO P 34 5 1 DEMO USE D O nieto PUER ie DR E 35 5 2 DEMO2 USEBDJ L z eos et amo asi ees 36 5 3 DEMO3 WAVE GENERATOR oria reete terne e e EO IRE HE TRO REPRE EiS 37 5 4 DEMO4 DELAY ONE MS tnihi tatto iate inita sens 39 5 5 DEMO 5 IO6 BIT EVENT COUNTER reb mer e e her treni 40 5 6 DEMOO SOFTWARE COUNTER o et 41 9 7 WATCHDOG TIMER 42 5 8 DEMOS PULSE WIDTH MEASURE 44 5 9 9 FREQUENCY MEASURE 46 5 10 DEMO10 FIND CARD 1 4 0 a 48 5 11 DEMOLI COUNT LOW PULSE rer e DEP CE DI tn 49 5 12 DEMO12 LOW PULSE WIDTH eret ettet ttr redet eno eee peruana a a 51 5 13 IDEMOJT3 HIGH PUL
25. 2A All old program designed for PCI TMC12 can be executed on 2 without any modification PCI TMCI2A provides more features refer to Sec 3 4 for more information 1 2 Product Check List In addition to this manual the package includes the following items PCI TMCI2 A card Onecompanion CD for software driver amp related documentations Attention If any of this items is missing or damaged contact the dealer from whom you purchased the product Save the shipping materials carton in case you want to ship or store the product in the future PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 5 Hardware configuration 2 Board Layout 2 1 4 lt N 4 lt 2 N gt oy N 92 LEDI LED2 LED3 lt 2 lt lt 2 2 J10 J11 J12 J13 J14 J15 J16 J17 J18 J19 J20 J21 J22 J23 J24 PCI BUS Note J28 LED1 LED2 amp LED3 are designed for PCI TMC12A only 6 2 User s Manual Ver 2 0 Sep 2002 016 20 2 2 Counter Architecture There are four 8254 chips on the PCI TMC12 A card The block diagram is given as following 8254 CHIP 1 U12 8254 CHIP 2 U8 Counter Counter 4 CLK CLK GATE3 GATE GATE6 GATE 8254 CHIP 3 U3 8254 CHIP 4 U1 Counter 7 Counter 10 COUT10 COUTII
26. 3 read the counter value of counterl to counter12 dub include PCITMC12 H WORD wBaseAddr wIrq wPLX WORD pci 12 do WORD WORD pci tmcl2 102 WORD wXor WORD pci 12 select8254 char cChip WORD pci tmc12 cO char cConfig char cLow char cHigh WORD pci 12 cl char cConfig char cLow char cHigh WORD pci 12 c2 char cConfig char cLow char cHigh void read 0 B void read cl int B void read c2 int B int main me WORD wBoards wRetVal char c clrscr wRetVal PTMC12 DriverInit amp wBoards printf NMn 1 Threr are d PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 printf n 2 Show the Configuration Space of all PCI TMC12 for 150 i lt wBoards i PTMC12 GetConfigAddressSpace i amp wBaseAddr amp amp wPLX printf An wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX select card 0 printf n 3 Card 0 LED test wBaseAddr x wBaseAddr initial count pci tmcl2 select8254 0 pci tmcl2 c0O 0x30 0xfe 0xff pci tmcl2 c1 0x70 0xfd 0xff pci tmcl2 c2 0xb0 0xfc 0xff pci tmcl2 select8254 1 pci 12 c0O 0x30 0xfb 0xff pci tmcl2 c1 0x70 0xfa
27. 3 GATEI TO GATEI2 in ot egi ce n e 11 244 J25 Interrupt Source 12 2 5 DAUGHTER BOARDS 13 2 5 1 VDI 13 2 5 2 DNIT amp DN20 i 13 2 5 3 1858125 egt oe eta dp 13 2 5 4 DB 16P Isolated Input 1 14 2 5 5 16 Relay ee rid et dedere 15 2 5 6 DB 24PR DB 24POR 24 eene eerte entree eren 16 2 6 PIN ASSIGNMENE Sirito nispi e e e E E E E EEE O EE E 17 CONTROL 19 3 1 HOW TO FIND THE ADDRESS ene ene e nennen rennes 19 3 2 THE ASSIGNMENT OF ADDRESS terere eee eee 21 3 3 THEI O ADDRESS MAP rettet rnit ptt reden 22 3 3 1 Select the active 8254 chip 1 2 3 4 sse eene eene 22 3 3 2 8254 Timer Counter Confolens nennen 23 3 3 3 Digital AN PUt 23 3 24 Digital Outp ltz 24 3 3 5 interrupt control status register of 1 12 24 3 4 NEW FEATURES OF MCU 24 27 34 1 Default Shipping of PCI TMCIA2A 27 343 Clock input of S254 ic 28 3 4 3 Xor control Register of PCI TMCI2A sse eene nennen
28. 4c 0 disable all interrupt WORD init watchdog DWORD dwVal disable refresh watchdog _outpd wPLX 0x4c 0x41 channel 1 interrupt active Low if wIrq 8 irqmask inportb Al 8259 41 outportb Al 825941 irqmask Oxff 1 lt lt wIrq setvect wIrg 8 irq service printf lt x gt wIrq else irqmask inportb Al 8259 1 outporthb Al 8259 1 irgmask Oxfb IRQ2 outportb Al 825941 irqmask Oxff 1 lt lt wIrq irqmask inportb A2 825941 outportb A2 825941 irqmask Oxff 1 lt lt wIrq 8 setvect wIrq 8 40x70 irq service printf x wIrq enable 80K 65536 count 0 8192 sec gt high width 0 4096 sec the user has to refresh the watchdog before 0 4 sec refresh watchdog pci 12 2 0 6 Oxff mode 3 2 gt return void interrupt irq service watchdog if wIrq 8 outportb A2 8259 0x20 outportb Al 8259 0x20 Refer to Sec 3 3 5 for more information PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 43 5 8 8 Pulse Width Measure demo 8 Pulse Width Measure 1 919 select EXTG1 922 select CLOCL1 8M hz step 2 connect 20 of 1 to pinl of CON2 step 3 connect external signal to 20 19 step 4 dem
29. 8 0 70 irq service enable void interrupt irq service if now int state 0 old state low gt change to high now COUNT3 find a HIGH pulse if COUNT3 4 stop down count amp read counter outportb wBaseAddr 0x0C 0x40 latch counterl L inportb wBaseAddr 0x04 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 PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 016 20 52 else old state low gt change to high now COUNT3 find a low pulse if COUNT 3 start counter pci tmcl2 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 Al 8259 0x20 Initial High 8M N down count of CNT2 High Clock 1 ms 1 BASE CLK IK Width of low pulse N 1 ms Refer to Sec 3 3 5 for more information PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 016 20 53 5 13 13 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 gt simulate ext signal step 2 CLK 1 select cloc
30. Addr amp wIrg amp wPLX select card 0 printf Nin 3 0 wBaseAddr x wBaseAddr watchdog 0 pci 12 select8254 0 select 8254 chip 0 printf n 4 start refresh watchdog n init watchdog PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 59 for refresh watchdog printf npress any key to simulate PC fail watchdog d watchdog if kbhit 0 getch break printf nWait watchdog failure for 1 watchdog 0 printf nwatchdog is failure now break if kbhit 0 getch break 12 DriverClose _outpd wPLX 0x4c 0 disable all interrupt WORD init watchdog DWORD dwVal inport wBaseAddr 0x18 pre set int signal to PC added line 1 disable refresh watchdog outpd wPLX 0x4c 0x41 channel 1 interrupt active Low if wIrq 8 irqmask inportb Al 8259 41 outportb Al 825941 irqmask Oxff 1 lt lt wIrq setvect wIrgt 8 irq service else irqmask inportb Al 8259 1 outporthb Al 825941 irqmask Oxfb IRQ2 outportb Al 8259 1 irqmask amp Oxff 1 lt lt wIrq irqmask inportb A2 825941 outportb A2 825941 irqmask Oxff 1 lt lt wIrq 8 setvect wIrg 8 0x70 irq service enable 80K 65536 count 0 8192 sec gt high width 0 4096 sec the us
31. C12A The default shipping of J28 is selected in TMC12 Sec 3 4 4 it is equivalent to PCI TMCI2 So the interrupt system of PCI TMC12A in the default shipping is compatible to PCI TMCI2 Refer to Sec 3 4 4 for interrupt block diagram of PCI TMC12 amp PCI TMCI2A Xor of PCI TMCI2A are clear to their Low states in the first power up stage so all clock sources of PCI TMCI2A are compatible to those of PCI TMCI2 Refer to Sec 3 4 2 for block diagram In general you can buy one PCI TMCI2A amp use it as PCI TMCI2 old application program designed for PCI TMC12 can be executed PCI TMCI12A without any modification Key point gt default shipping of PCI TMC12A PCI TMC12 The new features of PCI TMCI2A are given as follows The new interrupt mechanism Sec 3 4 4 The Xor bits for 2 clocks generation Sec 3 4 2 There are 3 LEDs for status indicators Sec 3 4 3 amp Sec 2 1 It equips one smith trigger buffer for the selected clock source Sec 3 4 2 One new D O port wBase 0x18 for Xor bits XorInt amp LED on off control Refer to Sec 3 4 3 for more information One new port wBase 0x18 for interrupt enable The initial routine amp ISR must inport from wBase 0x18 to enable next interrupt operation Refer to Sec 3 4 4 for more information Refer to new demo programs given in Sec 3 4 5 for how to use these new features Refer to Sec 2 1 for PCB layout of PCI TMC12A
32. LK 3 select clock2 80K simulate ext signal step 2 CLK 1 select clock1 8M gt generate BASE clock step 3 CLK 2 select COUT1 1K measure pulse width step 4 J25 select CH3 step 5 run demol2 exe hy include 12 define 1 8259 0x20 define 2 8259 0 0 1 EOI 0x20 WORD pci tmcl2 1 8254 cChip WORD pci tmcl2 cO char cConfig char cLow char cHigh WORD pci tmcl2 cl char cConfig char cLow char cHigh WORD pci tmcl2 c2 char cConfig char cLow char cHigh WORD init WORD wBaseAddr wIrq wPLX static void interrupt irq service int COUNT3 WIDTH3 CNT H CNT L irqmask now int state int main int 1 3 WORD wBoards wRetVal count char c DWORD dwVal float low pulse width clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX card 0 printf n 3 Card 0 wBaseAddr x wBaseAddr printf n 4 detect the pulse width of low pulse pci tmcl2 select8254 0 select 8254 0 for printf npress any key to continue to stop c getch if 4 0 goto ret label
33. PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 printf n 2 Show the Configuration Space of all PCI TMC12 for i 0 i lt wBoards i 12 GetConfigAddressSpace i amp wBaseAddr amp wIrq amp wPLX printf n 59 wBaseAddr x wIrq x wPLX x i wBaseAddr wlrq wPLX 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX select card 0 printf n 3 Card 0 LED test wBaseAddr x wBaseAddr pci 12 do2 0xe000 printf nAll LED off press any key to continue getch pci 12 do2 0xc000 printf nLED1 on press any key to continue getch pci tmcl2 do2 0xa000 printf nLED2 on press any key to continue getch pci tmc12 do2 0x6000 printf NnLED3 on press any key to continue getch PTMC12 DriverClose WORD pci 12 WORD wDo outport wBaseAddr 0x14 wDo return NoError WORD pci 12 02 WORD wXor outport wBaseAddr 0x18 return NoError PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 56 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
34. PCI TMCI2 A User s Manual Warranty products manufactured ICP DAS are warranted against defective materials for a period of one year from the date of delivery to the original purchaser Warning ICP DAS assume no liability for damages consequent to the use of this product ICP DAS reserves the right to change this manual at any time without notice The information furnished by ICP DAS is believed to be accurate and reliable However no responsibility is assumed by ICP DAS for its use nor for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 2002 by ICP DAS rights are reserved Trademark The names used for identification only maybe registered trademarks of their respective companies 2 User s Manual Ver 2 0 Sep 2002 PMH 016 20 1 Tables of Contents 1 INTRODUCTION 4 1 1 2 lt tete E E E 5 1 2 5 HARDWARE CONFIGURATION 6 2 1 6 2 2 COUNTER ARCHITECTURE 4 oett nier ite ine er ph 7 2 3 DVO BLOCK DIAGRAM si tee RR 8 2 4 JUMPER SETTING 9 2 4 1 CLOCK IE CLOCK e a erbei 9 24 21 CER DIOCEKRI2 t M ARN AM 10 2 4
35. SE 54 5 14 NDEMOT USING LEDS 56 5 15 NDEMO2 GENERATE 2 CLOCKS rte ee ete reinen 57 5 16 NDEMO3 NEW pido 59 5 17 NDEMO4 ACTIVE HIGH INT ERE I e 61 5 18 NDEMOS ACTIVE LOW INT eese es eet esent eet E eto eene ERE 63 PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 016 20 3 1 Introduction The PCI TMCI2 amp PCI TMC12A is a general purpose counter timer and digital I O card e PC AT compatible PCI bus On board four 8254 chips e 5 different interrupt sources 4 internal 1 external jumper selectable e Flexible clock sources and gate control signals selectable e 2 stable internal clock sources CLOCK1 8M 1 6M CLOCK2 0 8M 80K jumper selectable e 12 external clock sources e 12 external gate control signals e 16 bits general purpose TTL compatible D O or relay with daughter board DB 16R or DB 24PR 16 bits general propose TTL compatible or isolated input with daughter board DB 16P e 12 independent 16 bits timer counter All signals are TTL compatible e Operating Temperature 0 C to 60 C e Storage Temperature 20 C to 80 C e Humility 0 to 90 non condensing e Dimension 150mm X 105mm Power Consumption 5 500mA Note 2 PCI TMC12 or PCI TMC12A PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 4 11 12 8 PCI TMC1
36. about 10 demo program given in the DOS floppy disk The program source of library amp demo program are all given in the disk These demo program will help the user to solve their real world problem more easy TC LARGE TC LARGE LIB TC LARGE DEMO TC LARGE LIB PCITMC12 H TC LARGE LIB PCITMC12 C TC LARGE LIB A BAT TC LARGE LIB B BAT TC LARGE LIB PCITMC12 lib TC LARGE DEMO1 PCITMC12 H TC LARGE DEMO1 DEMO1 C TC LARGE DEMO1 DEMO1 PRJ gt for Turbo 2 xx or above gt for large model gt for library source code gt demo program source code gt library header file gt library source file gt compiler file gt link file gt library file gt library header file gt demol source file gt TC project file TC LARGE DEMO1 IOPORTL LIB gt port library file TC LARGE DEMO1 PCITMC12 LIB library file TC LARGE DEMO1 DEMO1 EXE gt demol execution file PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 34 5 1 1 Use D O demo 1 D O demo y step 1 connect a DB 16R to CON3 of PCI TMC12 step 2 run step 3 check the LEDs of DB 16R will turn on sequentially Jc include 12 WORD pci 12 WORD WORD wBaseAddr wIrq wPLX int main rnt 04 0 WORD wBoards wRetVal char c clrscr wRetVal PTMC12 DriverInit amp wBoards
37. al Ver 2 0 Sep 2002 PMH 016 20 29 3 4 4 Block Diagram of Interrupt System The block diagram of interrupt system in PCI TMC12 is given as follows CH3 CH6 CH9 CH12 PCI Interface Controller EXT SPARE J25 default select no int CH3 CH6 CH9 CH12 PCI Interface Controller TMC 12A J28 default select TMC 12 EXT SPARE XorInt Control bit Sec 3 4 3 Inport from wBase 0x18 to pre set Q to Pre Set High Note in software demo program Q int signal to PC refer to Sec 5 16 Sec 5 17 amp Sec 5 18 for demo program PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 016 20 30 The interrupt mechanism of 2 can be active Low or active High And the interrupt system of PCI bus is level trigger So the Windows driver of PCI TMC12 must create a thread to handle all interrupt active conditions There are so many possible conditions so the interrupt performance will be reduced very much The new interrupt mechanism of PCI TMCI2A is designed to improve the performance of Windows driver as follows initial subroutine amp ISR will inport from wBase 0x18 to pre set int signal to PC in Sec 3 4 4 to High state to enable the next interrupt operation if the initial value of interrupt source is Low set XorInt to 0 rising edge interrupt if the initial value of interrupt source is High set XorInt to 1 gt falling edge interrup
38. cConfig char cLow char cHigh outportb wBaseAddr 0x0C cConfig outportb wBaseAddr 8 CcLow outportb wBaseAddr 8 CHigh return NoError PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 38 Af 5 4 4 Delay One Ms This demo use CNTI to implement a machine independent timer So you can run this demo in any speed PC amp find the shown in screen every seconds The machine independent timer is useful in industry application demo 4 delay 1 ms Using CH 1 step 1 CLK 1 select clock1 8M step 2 run demo4 exe JUR Xy include PCITMC12 H WORD pci tmcl2 select8254 char cChip WORD pci tmcl12 cO char cConfig char cLow char cHigh WORD pci tmcl12 cl char cConfig char cLow char cHigh WORD pci tmcl2 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX int main Int WORD wBoards wRetVal char c elrscr 3 wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are PCI TMC12 Cards in this PC wBoards PTMC12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX card 0 printf Nn 3 Card 0 wBaseAddr x wBaseAddr printf Nn 4 Delay 1 ms n for for 0 1 lt 1000 1 delay one ms if kbhit 0 getch return 12 DriverClose CLK 1 8M gt count 0 1 40 count 8000 1 ms
39. cable step 2 run DEMO2 EXE ny include PCITMC12 H WORD pci_tmcl2 do WORD void pci 2 di WORD wDi WORD wBase wIrq wPLX int main ine go WORD wBoards wRetVal char c clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are PCI TMC12 Cards in this PC wBoards if wBoards 1 PTMC12 GetConfigAddressSpace 1 amp wBase else PTMC12 GetConfigAddressSpace 0 amp printf n 3 D I O test wBase x wBase 1 1 for i 0 1 lt 16 i pci tmcl2 do j pci tmcl12 printf NnTEST 2d DO x DI x i j k if j k printf TEST ERROR else printf TEST OK j j 1 if 3 0 j 1 12 DriverClose LX card 1 LX card 0 void pci tmcl2 di WORD wDi WORD wRetVal wDi 1 0 14 amp PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 36 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 x7 Sub include PCITMC12 H WORD pci 12 select8254 char cChip WORD pci 12 cO char cConfig char cLow char cHigh WORD pci 12 cl char cConfig char cL
40. ds wRetVal char c clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 for printf press any key to stop for 1 0 i lt wBoards i test_card i for 0 1 lt 1000 i delay ms delay 1 sec if kbhit 0 getch break 12 DriverClose 73 test card int card int i j k ok 12 GetConfigAddressSpace amp wBaseAddr amp wIrq ok 1 for 1 0 1 lt 16 i pci tmcl2 do j pci tmcl2 di amp k if j k ok 0 1 1 lt lt 1 if j 0 j 1 printf nCard Number d wBaseAddr x card if ok 1 printf Test OK else printf Test ERROR PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 48 5 11 Demo11 Count Low Pulse demo 11 count low pulse Use CH 3 to Simulate external pulse step 1 CLK 3 select clock2 80K step 2 925 select step 3 run demoll exe 1 include PCITMC12 H define 1 8259 0x20 define 2 8259 0 0 1 EOI 0x20 WORD pci tmcl2 select8254 char cChip WORD pci tmcl2 cO char cConfig char cLow char cHigh WORD pci tmcl2 cl char cConfig char cLo
41. elected clock source of CLK1 Xor2 gt invert non invert the selected clock source of CLK2 1 gt invert non invert the selected clock source of CLK11 2 gt invert non invert the selected clock source of CLK12 Xor 0 gt non invert it is the power up value Xor 1 gt invert XorInt gt inverted non inverted the selected interrupt source Ledl gt Led1 0 gt Turn LED1 ON Led1 1 gt turn LED1 Off Led2 gt Led2 0 gt Turn LED2 ON Led2 1 gt turn LED2 Off Led3 gt Led3 0 gt Turn LED3 ON Led3 1 gt turn LED3 Off The Xor is designed to generate the starting 2 clocks for 8254 The XorInt is used to invert non invert the interrupt source to Low state that is to say if the initial value of interrupt source is High set this bit to High to invert it to Low state Refer to Sec 5 18 Ndemo5 Active Low Int for demo program Whenthe TMCI2A is first power up the initial values are all zero So Led1 2 3 are all turn ON The Led1 2 3 are designed for status indicators User can use them based on their special requirements Refer to Sec 5 15 Ndemo2 Generate 2 Clocks the twelve Xor bits are used to generate the 2 starting clocks So the initial value of 8254 can be verified after these 2 starting clocks are generated Then they are used to generate single clock for testing In general these Xor bits are designed for generation of 2 starting clocks only PCI TMCI2 TMCI2A User s Manu
42. er has to refresh the watchdog before 0 4 sec refresh watchdog pci 12 2 0 6 Oxff mode 3 2 gt return void interrupt irq service inport wBaseAddr 0x18 pre set int signal to added line 2 if wIrq 8 outportb A2 8259 0x20 outportb Al 8259 0x20 PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 60 5 17 4 Active High Int ndemo4 interrupt demo int source initial low active High step 1 connect 001 pinl of CON3 to ECLK11 16 of CON1 step 2 J25 select EXT step 3 run ndemo4 exe step 4 press any key to test press to stop include PCITMC12 H define 1 8259 0x20 define 2 8259 0 0 define EOI 0x20 WORD pci tmcl12 do WORD WORD pci tmcl2 102 WORD WORD init interrupt WORD wBaseAddr wIrq wPLX int count static void interrupt irq service int irqmask int main int 1 7 WORD wBoards wRetVal old count char c DWORD dwVal clrscr wRetVal PTMC12 DriverInit amp wBoards printf NMn 1 Threr are d PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 printf n 2 Show the Configuration Space of all PCI TMC12 for i 0
43. er latch command 0 1 Read write LSB ONLY 1 0 Read write MSB ONLY 1 1 Read write LSB first then read write MSB M2 1 0 Working mode 0 0 0 Mode 0 0 0 1 1 Don t care 1 0 2 Don t care 1 1 3 1 0 0 4 1 0 1 5 BCD Description 0 Binary counter 16 bits 1 Binary coded decimal BCD counter 4 decades PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 32 4 2 Counter latch command D7 D6 05 04 D3 D2 DI DO SCI SCO 0 0 X X X X SCO Description 0 0 Latch counter 0 0 1 Latch counter 1 1 0 Latch counter 2 1 1 Read back command 4 3 Read back command 7 106 DS D4 D3 D2 DI DO 1 1 COUNT STATUS CNT2 CNTO 0 D5 0 gt latch counter value of selected counters D4 0 2 latch status of selected counters D3 gt select counter 2 D2 gt select counter 1 1 1 gt select counter 0 4 4 Status byte format D7 106 5 D4 D3 D2 DI DO Cout Null RWI RW2 M2 1 0 BCD count D7 0 gt Cout Low D7 1 gt Cout High D6 0 gt count available for reading D6 1 gt null count e 05 000 gt setting value read back PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 33 5 Demo Program The application program of 8254 is very complicated There are
44. k1 8M gt generate BASE clock step 3 CLK 2 select COUT1 1K gt measure pulse width step 4 J25 select CH3 step 5 run demol3 exe Use CH3 to simulate the external signal user can must set the J25 CH3 this demo user set the J25 EXT in real world application WORD init DWORD dwVal disable pei_tmcl2_c2 0xb6 Oxff mode 3 2 gt CH3 80K 65536 count 0 8192 sec gt high width 0 4096 sec high width 0 4 sec low width 0 4 sec pci 12 c0 0x36 0 32 CH 1 mode 3 low 0 high 32 cout 1K _outpd wPLX 0x4c 0x41 channel 1 interrupt active Low now int state 1 now int signal is High if wIrq 8 irqmask inportb Al 8259 41 outportb Al 8259 1 irqmask amp Oxff 1 lt lt wIrq setvect wIrq 8 irq service else irqmask inportb Al 8259 1 outporthb Al 825941 irqmask Oxfb IRQ2 outportb 1 8259 1 irgmask amp Oxff 1 lt lt wIrq irqmask inportb A2 8259 1 outportb A2 8259 1 irgmask amp Oxff 1 lt lt wIrq 8 setvect wIrg 8 0x70 irq service enable void interrupt irq service if now int state 0 COUNT3 find a high pulse if COUNT3 2 start to down count pci tmcl2 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 signa
45. l is High 2 User s Manual 2 0 Sep 2002 016 20 54 x else COUNT3 find a low pulse if COUNT3 3 stop the down count amp read count outportb wBaseAddr 0x0C 0x40 latch counterl CNT L inportb wBaseAddr 0x04 H inportb wBaseAddr 0x04 _outpd wPLX 0x4c 0 disable all interrupt 15 outpd wPLX 0x4c 0x43 channel 1 interrupt active High now int state 0 now int signal is Low if gt 8 outportb A2 8259 0x20 outportb 1 8259 0x20 Initial Low START STOP CNT2 CNT2 N down count of CNT2 High Clock 1 ms CLK 1K Width of high pulse N 1 ms 8M Refer to Sec 3 3 5 for more information PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 55 5 14 1 Using LEDs ndemol LED1 LED2 LED3 demo step 1 default shipping of PCI TMC12A step 2 run NDEMO1 EXE step 3 the LED1 2 3 of TMC12A will turn on sequentially finclude PCITMC12 H WORD pci 12 do WORD WORD pci 12 do2 WORD wXor WORD wBaseAddr wIrq wPLX int main Int E WORD wBoards wRetVal char G clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are PCI TMC12 Cards in this
46. le next interrupt operation Xy disable outpd wPLX 0x4c 0x41 channel 1 interrupt active Low if wIrq 8 irqmask inportb Al 8259 1 outportb Al 825941 irqmask Oxff 1 lt lt wIrq setvect wIrgt 8 irq service else irqmask inportb A1 8259 1 outportb Al 8259 1 irqmask amp Oxfb IRQ2 outportb Al 825941 irqmask Oxff 1 lt lt wIrq irqmask inportb A2 8259 41 outportb A2 825941 irqmask Oxff 1 lt lt wIrq 8 setvect wIrq 8 0x70 irq service enable void interrupt irq service now the int signal to is in Low state inport wBaseAddr 0x18 pre set int signal to pc to High value to enable next interrupt operation de int countt if wIrq 8 outportb A2 8259 0x20 outportb A1 8259 0x20 PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 016 20 64
47. o8 exe the width of active high pulse will fe be shown in the screen 8 ms max 5 Jp 7 include 12 void pci tmcl2 di WORD wDi WORD pci 12 select8254 char cChip WORD pci 12 cO char cConfig char cLow char cHigh WORD pci 12 cl char cConfig char cLow char cHigh WORD pci 12 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX int main int 2 7 5 WORD wBoards wRetVal char c cc 80 unsigned int high low count float ms clrscr wRetVal PTMC12 DriverInit amp wBoards printf NMn 1 Threr are d PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 printf n 2 Show the Configuration Space of all PCI TMC12 for i 0 i wBoards 1 12 GetConfigAddressSpace i amp wBaseAddr amp wIrq amp wPLX printf Mn Card d wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX 12 GetConfigAddressSpace 0 amp wBaseAddr amp wPLX card 0 printf 3 Card 0 wBaseAddr x wBaseAddr printf Nn 4 read amp show 80 n wBaseAddr for 1 0 1 lt 80 i pci tmcl2 di amp k cc i k for 0 1 lt 80 i j cc i amp 0 01 if j 0 printf 0 else printf 1 2 U
48. or CH1 to CH3 select 8254 chip 1 CH 1 mode 3 10w 2 highz0 cout 4M CH 2 mode 3 10w 4 highz0 cout 2M CH 3 mode 3 10w 8 highz0 cout 1M Generator for CH4 to CH6 select 8254 chip 2 CH 4 mode 3 10w 16 highz0 cout 500K CH 5 mode 3 low 32 high 0 cout 250K CH 6 mode 3 low 64 high 0 cout 125K Generator for to CH9 select 8254 chip 3 CH 7 mode 3 low 128 high 0 cout 64K CH 8 mode 3 low 0 high 1 cout 32K CH 9 mode 3 low 0 high 2 cout 16K Generator for CH10 to CH12 PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 37 a A y pci tmcl2 select8254 3 select 8254 chip 4 pci tmcl2 c0 0x36 0 4 CH 10 mode 3 10w 0 high 4 cout z8K 6 pci tmcl2 c1 0x76 0 8 CH 11 mode 3 low 0 high 8 cout 4K pci tmc12 c2 0xb6 0 16 CH 12 mode 3 10w 0 high 16 cout 2K PTMC12 DriverClose WORD pci tmcl2 1 8254 char cChip outportb wBaseAddr 0x10 cChip return NoError WORD pci tmcl2 cO char cConfig char cLow char cHigh outportb wBaseAddr 0x0C cConfig outportb wBaseAddr CLow outportb wBaseAddr CHigh return NoError WORD pci tmcl2 cl char cConfig char cLow char cHigh outportb wBaseAddr 0x0C cConfig outportb wBaseAddr 4 cLow outportb wBaseAddr 4 CHigh return NoError WORD pci tmcl2 c2 char
49. ow char cHigh WORD pci 12 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX int main int i j WORD wBoards wRetVal char clrscr wRetVal PTMC12 DriverInit amp wBoards prin if 1 Threr are d 12 Cards in this PC wBoards wBoards 0 utch 0x07 putch 0x07 putch 0x07 rintf 1 There are no PCI TMC12 card in this PC n 0 2 2 Show the Configuration Space of all PCI TMC12 1 0 i lt wBoards i 12 GetConfigAddressSpace 1 amp wBaseAddr amp amp wPLX printf wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX card 0 prin prin pci Nn 3 4 Square Wave tmcl2 select8254 0 pci pci pci prin tmc12 c0 0x36 2 0 J tmcl2 1 0 76 4 0 tmcl2 c2 0xb6 8 0 tf n 5 Square Wave pci_ pci pci pci prin pci tmcl2 select8254 1 12 c0 0x36 16 0 tmcl2 c1 0x76 32 0 tmcl2 c2 0xb6 64 0 6 Square Wave tmcl2 select8254 2 pci pci pci prin tmcl2 c0 0x36 128 0 tmcl2 1 0 76 0 1 tmcl2 c2 0xb6 0 2 7 Square Wave Card 0 wBaseAddr x wBaseAddr Generator f
50. rds in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 printf n 2 Show the Configuration Space of all PCI TMC12 for i 0 i lt wBoards 1 12 GetConfigAddressSpace amp wBaseAddr amp amp wPLX printf Card d wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX 12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrg amp wPLX select _0 printf 3 Card 0 wBaseAddr x wBaseAddr printf Nn 4 start test interrupt pci tmcl2 1 DOl int source gt initial High active Low init interrupt old_count 1 PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 63 for 22 if old count int count printf nint_count d int count old count int count if kbhit 0 c getch if c q 0 break pci tmcl2 do 0 generate a Low pulse to pci tmcl2 do 1 DOl ECLK11 2J25 int source printf Generate a Low interrupt pulse PTMC12 DriverClose _outpd wPLX 0x4c 0 disable all interrupt JEN WORD init interrupt DWORD dwVal int_count 0 pci 12 do2 0x1000 set IntXor to invert the int source inport wBaseAddr 0x18 pre set int signal to PC to High value to enab
51. seAddr x wBaseAddr printf 4 16 bit event down counter n pci tmcl2 select8254 0 select 8254 0 pci tmcl2 c0 0x30 0xff 0xff CH 1 mode 0 down count ffff for outportb wBaseAddr 0x0C 0x00 latch counter 0 low inportb wBaseAddr high inportb wBaseAddr count 0xff high 256 Oxff low 42 printf nhigh x low x count u high low count if kbhit 0 getch break 12 DriverClose 1 The starting two will be used to initialize 8254 So gt Total_Count Oxffff Current_Counnt 2 Note2 If the count gt 65536 gt this 16 bit counter will be overflow So gt refer to DEMO6 for infinite bit counter PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 40 5 6 Demo6 Software Counter T4 demo 6 software event down counter step 1 CNT1 select ECLK1 JP22 step 2 run demo6 exe step 3 connect the external CNT signal to pinl of CON1 include PCITMC12 H WORD pci 12 select8254 char cChip WORD pci 12 cO char cConfig char cLow char cHigh WORD pci 12 cl char cConfig char cLow char cHigh WORD pci 12 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX float c65536 software count int main lint Xy WORD wBoards wRetVal char c s0 unsigned int high low 65536
52. ser s Manual Ver 2 0 Sep 2002 016 20 44 while inport wBaseAddr 0x14 amp 1 7 0 wait EXG1 High while inport wBaseAddr 0x14 681 0 wait EXGl Low pci tmcl2 select8254 0 select 8254 chip 0 pci tmcl2 c0 0x30 0xff 0xff CH 1 mode 0 down count ffff while inport wBaseAddr 0x14 amp 1 7 0 wait while inport wBaseAddr 0x14 amp 1 0 wait EXGl Low outportb wBaseAddr 0x0C 0x00 latch counter 0 low inportb wBaseAddr high inportb wBaseAddr count 0xff high 256 Oxff low 2 ms 0 000125 float count printf nhigh x low x count d Sf ms high low count ms PTMC12 DriverClose 8 Pulse Width External signal e N number of down count in CNT1 8M clock Pulse width 8M width N AY NUS s PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 45 5 9 9 Frequency Measure demo 9 Signal Frequency Measur step 1 J19 select EXTG1 J22 select CLOCL1 8M hz step 2 920 select NCOUT1 J23 select ECLK2 step 3 connect external signal to pin21 pinl9 step 4 run demo9 exe the frequency of input signal will fe be shown in the screen 125 Hz min Jp t include 12 void pci tmcl2 di WORD wDi WORD pci 12 select8254 char cChip WORD pci 12 cO char cConfig char
53. sistor for current sensing You can use the DB 16P to sense DC signal from TTL levels up to 24V or use the DB 16P to sense a wide range of AC signals You can use this board to isolated the computer from large common mode voltage ground loops and transient voltage spike that often occur in industrial environments PCI TMCI2 Opto Isolated 2 CON2 D I AC or DC Signal 0V to 24V 2 User s Manual Ver 2 0 Sep 2002 016 20 14 2 5 5 DB 16R Relay Board The DB 16R 16 channel relay output board consists of 16 form C relays for efficient switch of load by programmed control It is connector and functionally compatible with 785 series board but with industrial type terminal block The relay are energized by apply 5 voltage signal to the appropriated relay channel on the 20 pin flat connector There are 16 enunciator LEDs for each relay light when their associated relay is activated To avoid overloading your s power supply this board provides a screw terminal for external power supply From C Relay Normal Open Normal Close Com 20Pin cable 2 CON3 D O PCI TMCIX A Note Channel 16 From C Relay Relay Switching up to 0 5A at 110ACV or at 24DCV PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 016 20 15 2 5 6 DB 24PR DB 24POR DB 24C DB 24PR 24 power relay 5A 250V DB 24POR
54. t the software driver is designed for rising edge or falling edge interrupt When the interrupt ISR is executed the int signal to PC Q in Sec 3 4 4 is in Low state so the interrupt ISR must inport from 0 18 to pre set int signal to PC to High state to enable next interrupt operation Refer to Sec 5 16 Sec 5 17 amp Sec 5 18 for demo program 3 4 5 New Demo Program New demo program 1 How to Use Status Indicators LEDs Refer to Sec 5 14 Ndemol Using LEDs New demo program 2 How to Generate the Starting 2 Clocks for 8254 Refer to Sec 5 15 Ndemo2 Generate 2 Clocks New demo program 3 gt Modify demo7 designed for PCI TMC12 to fit the new interrupt mechanism of PCI TMCI2A Refer to Sec 5 16 Ndemo3 New Demo7 New demo program 4 2 interrupt source initial low active High Refer to Sec 5 17 Ndemo4 Active Low Int New demo program 5 interrupt source initial High active low Refer to Sec 5 18 Ndemo5 Active High Int PCI TMCI2 TMCI2A User s Manual Ver 2 0 Sep 2002 PMH 016 20 31 4 4 1 8254 Programming Control Word Format D7 D6 05 04 D3 D2 DI DO SCO RWI RWO M2 1 0 BCD SCO Description 0 0 Select counter_0 0 1 Select counter 1 1 0 Select counter 2 1 1 Read back command RWO Description 0 0 Count
55. w char cHigh WORD pci tmcl2 c2 char cConfig char cLow char cHigh WORD init WORD wBaseAddr wIrqg wPLX static void interrupt irq service int COUNT3 irqmask now int state int main ine js WORD wBoards wRetVal char os DWORD dwVal clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are PCI TMC12 Cards in this PC wBoards if wBoards 0 putch 0x07 putch 0x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n exit 0 12 GetConfigAddressSpace 0 amp wBaseAddr amp amp wPLX card 0 printf n 3 Card 0 wBaseAddr x wBaseAddr COUNT3 0 pci tmcl2 select8254 0 select 8254 0 printf n 4 show the count of low pulse n init for 77 printf nCOUNT3 d COUNT3 if kbhit 0 getch break PTMC12 DriverClose _ outpd wPLX 0x4c 0 disable all interrupt JD PCI TMC12 TMC12A User s Manual Ver 2 0 Sep 2002 PMH 016 20 49 Use to simulate the external signal The user can must set the J25 CH3 in this demo user set the J25 EXT in real world application WORD init DWORD dwVal disable pci tmcl2 c2 0xb6 0xff 0xff mode 3 CNT2 CH3 80K 65536 count 0 8192 sec gt high width 0 4096 sec T high width 0 4 sec
56. y PCI TMC12 A cards in the system It is implemented based on the PCI plug amp play mechanism 1 It will find all PCI TMCI2 A cards installed in this system amp save all their resource in the library wBoard 1 only one PCI TMCI2 A in this PC system wBoard 2 2 there are two PCI TMCI2 A in this PC system 2 PTMCI2 GetConfigAddressSpace wBoardNo wBase wIrq wPLX The user can use this function to save resource of all PCI TMCI2 A installed in this system Then the application program can control all functions of PCI TMC12 A directly wBoardNo 0 to gt totally N 1 cards of PCI TMC12 A wBase gt base address of the board control word wlrq gt allocated IRQ channel number of this board wPLX gt base address of PCI interface IC 2 User s Manual Ver 2 0 Sep 2002 PMH 016 20 19 sample program source is given as following stepl detect all PCI TMC12 A card first wRetVal PTMC12_DriverInit amp wBoards printf Threr are PCI TMCI2 Cards in this wBoards step2 save resource of all PCI TMC12 A cards installed in this PC for i 0 i lt wBoards i PTMCI2 GetConfigAddressSpace 1 amp wBase amp wlrg amp wPLX printf nCard 4 wBase x wlrq x wPLX x i wBase wlrq wPLX wConfigSpace i 0 wBaseAddress save all resource of this card wConfigSpace i 1 wlrq save all resource of this card wConfigSpace i 2 wPL X save
Download Pdf Manuals
Related Search
Related Contents
Instruction pour l`installation du kit de recirculation RAPPORT D`ACTIVITÉ - Provence Promotion Untitled Mushkin 998731 memory module Windmere TT100 Use & Care Manual Clarity C900 User's Manual CFL 3650/1 E CFL 3655/1 E MANUAL DE USO Copyright © All rights reserved.
Failed to retrieve file