Home

PCI-TMC12 User Manual

image

Contents

1. outpd 0 4 0 disable all interrupt Tx Use CH3 to simulate the external signal The user can must set the J25 CH3 in this demo The user set the J25 EXT in real world application WORD init CH3 DWORD dwVal disable pci tmc12 c2 0xb6 0xff 0xff mode 3 CNT2 CH3 80K 65536_count 0 8192 sec high width 0 4096 sec gt high_width 0 4 sec low_width 0 4 sec now int state 1 now COUT3 is High _outpd wPLX 0x4c 0x41 channel 1 interrupt active_Low if wIrq lt 8 irqmask inporthb 1_8259 1 outportb A1 8259 1 irqmask 6 Oxff 1 lt lt wIrq setvect 8 irq service else A1_8259 1 outporthb A1_8259 1 irgqmask amp Oxfb IRQ2 outportb Al1 8259 1 irqmask 6 Oxff 1 lt lt wIrq irqmask inportb A2 825941 outportb A2 8259 1 irqmask 6 Oxff 1 lt lt wIrq 8 setvect 8 0 70 irq service enable void interrupt irq service if now int state 0 old state low gt change to high now find a high pulse nere xj now int state 1 now int signal is High outpd wPLX 0x4c 0x41 channel 1 interrupt active Low else old state high gt change to low now PCI TMC12 User Manual Ver 1 0 53 find a low pulse now_int_state 0 now int_signal is low COUNT3
2. 0 a rea adaise ian ies 36 5 6 DEMO6 SOFTWARE COUNTER 880 toseters restren 38 5 7 WATCHDOG TIMER erret et e 40 58 DEMOS PULSE WIDTH MEASURE c ccccccsssccsssessccssscccsssccsssccssscessscesscsescesscssessssessscesecesseesscesseeces 44 5 9 FREQUENCY MEASURES 47 5 10 DEMOIO FIND CARD NUMBER cccccccccssscessccsssccsescessecssecssscessscessscsscessssesssssessssessecesseceesensssessesees 51 DEMOLLISGOUNTEOW PULSES 52 5 12 DEMOI2 LOW PULSE WIDTH n Ea 55 5 13 DEMO13 HIGH PULSE A T a tese a a ia 59 PCI TMC12 User Manual Ver 1 0 2 1 Introduction The PCI TMC12 is a general purpose counter timer and digital I O card e PC AT compatible PCI bus e 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 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 e 16 bits general propose TTL compatible D I or isolated input with daughter board DB 16P e 12 independent 16 bits timer counter All signals TTL compatible
3. N down count of CNT2 High Width of high pulse N 1 ms BASE CLK 1K 2 2 Refer to Sec 3 3 5 for more information 12 User Manual Ver 1 0 61
4. 2 User Manual Warranty All products manufactured by 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 1999 by ICP DAS All rights are reserved Trademark The names used for identification only maybe registered trademarks of their respective companies PCI TMC12 User Manual Ver 1 0 1 Tables of Contents 1 INTRODUCTION 3 Tl VP RODUCT eei 3 HARDWARE CONFIGURATION cccssscsssssscssscsccsssccsscsscssscssccsssssscsscsssscssscssssscsaccsassssseccssscnsscees 4 2 1 cete ere t tesa Mica cote 4 2 2 COUNTER ARCHITECTURE cccccsssccssscessscessessssecssscessssssscssssessssessscessescessscessessssessscessscsessecesssessssesscenses 5 213 BLOCK DIAGRAM nah a 6 254 JUMPERSEEEHNNG eiit eite eter eite e bat eta ete
5. CON3 D O PCI TMC12 Note Channel 16 From C Relay T Relay Switching up to 0 5A at 110 or 1A at 24DCV PCI TMC12 User Manual Ver 1 0 13 2 5 6 DB 24PR DB 24POR DB 24C DB 24PR 24 power relay 5A 250V DB 24POR 24 photo MOS relay 0 1A 350VAC DB 24C 24 open collector 100mA 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 PC s 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 CON3 D O PCI TMC12 50 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 Channel 16 From A Relay 8 From C Relay Relay switching up to 5A at 110 5A at 30DCV
6. include PCITMC12 H WORD pci tmc12 select8254 char cChip WORD pci tmc12 cO char cConfig char cLow char cHigh WORD pci tmc12 cl char cConfig char cLow char cHigh WORD pci tmc12 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX nt main nt 1 2 ORD wBoards wRetVal harc clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are 84 12 Cards in this PC w PTMC12_GetConfigAddressSpace 0 amp wBaseAddr amp amp wPLX printf n 3 Card_0 wBaseAddr x wBaseAddr printf n 4 Delay 1 ms n for for 0 1 lt 1000 144 delay one ms printf if kbhit 0 getch return PTMC12_DriverClose Boards 0 CLK 1 8M gt count 0 1 40 count 8000 1 ms down count from 8000 gt 7999 gt gt 1 0 gt Oxfff delay one ms int low high pci 12 1 8254 0 select 8254 chip 0 pei_tmc12_c0 0x30 0x40 0x1f CH 1 mode 0 down count 8000 for outportb wBaseAddr 0x0C 0x00 latch counter_0O low inportb wBaseAddr high inportb wBaseAddr PCI TMC12 User Manual Ver 1 0 34 if high gt 0x20 return overflow gt time up PCI TMC12 User Manual Ver 1 0 35 5 5 Demod 16 bit Event Counter de
7. D D D pci tmc12 select8254 char cChip pci tmc12 cO char cConfig char cLow char cHigh pci tmc12 cl char cConfig char cLow char cHigh D pci tmcl2 c2 char cConfig char cLow char cHigh D wBaseAddr wIrq wPLX main 1 2 D wBoards wRetVal r c cc 80 unsigned int high low count cout0 flo clr at EE Sero wRetVal PTMC12 DriverInit amp wBoards ntf n 1 Threr are 54 PCI TMC12 Cards in this PC wBoards pri if PTMC12_GetConfigAddressSpace 0 amp w pri pri pci pci DOT for wBoards putch 0x07 printf 1 exit 0 ntf n 3 Card 0 wBaseAddr x wBaseAddr ntf n 4 frequency must be gt 125 Hz n wBaseAddr tmcl12 select8254 0 select 8254 chip 0 tmcl12 cO 0x30 0xff O0xff CH 1 mode 0 down count ffff tmcl12 cl1 0x70 0xff O0xff CH 2 mode 0 down count ffff 57 outportb wBaseAddr 0x0C 2 latch status of counterO0 low inportb wBaseAddr high inportb wBaseAddr putch 0x07 putch 0x07 There are no PCI TMC12 card in this PC BaseAddr amp amp wPLX 11130 cout0 1low amp 0x80 if cout0 0 break if kbhit 0 getch break PCI TMC12 User Manual Ver 1 0 0 xy ay Ey outportb wBaseAddr 0x0C 0x40 latch counter 1 low inportb wBaseAddr 0x0
8. now int_signal is High if lt 8 irqmask inportb A1_8259 1 outportb Al1 8259 1 irqmask amp Oxff 1 lt lt setvect 8 irq service else irqmask inportb 1_8259 1 outporthb A1_8259 1 irqmask amp Oxfb IRQ2 outportb Al1 8259 1 irqmask 6 Oxff 1 lt lt wIrqg irqmask inportb A2 825941 outportb A2 8259 1 irqmask 6 Oxff 1 lt lt wIrq 8 setvect 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 PCI TMC12 User Manual Ver 1 0 56 if COUNT3 4 stop down count amp read counter outportb wBaseAddr 0x0C 0x40 latch counterl CNT 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 27 PCI TMC12 User Manual Ver 1 0 57 else COUNT3 if COUNT 3 pci 12 c1 0x70 0xff O0xff else _outpd wPLX 0x4c 0x43 x now_int_state 0 if wIrq 8 outportb Al 8259 0x20 Initial High 8M High BASE CLK 1K High GATE 2 Refer to Sec
9. PCI TMC12 User Manual Ver 1 0 14 2 6 Pin Assignment The CONI is a 37 pin D type female connector a 3 Z 5 Description ECLKI Pin Number Description N COUTI EXTG2 20 EXTGI 21 ECLK2 A ECLK3 COUT3 COUT2 EXTG3 QN JA EXTG4 ECLK5 2 2 2 COUT4 N 5 EXTG6 EXTG5 7 ECLK6 pem ECLK7 COUT7 EXTG8 ECLK9 30 ECLK8 31 COUTS8 COUT9 10 EXTG9 ECLK10 ECLKII COUTII 3 3 3 EXTGII ECLKI2 2 3 5 26 2 28 COUT6 29 EXTG7 2 3 5 6 oo EXTG12 GND 3 3 7 COUT12 This pin not available external clock source for counter n EXTGn external gate control signal for counter n COUTn output of timer counter n All signals are TTL compatible PCI TMC12 User Manual Ver 1 0 15 CON2 assignment of digital input connector Pin Name Pin Name 3 Digital input 2 4 Digital input 3 17 Digital input 6 8 Digital input 7 0 NT 2 4 5 6 7 8 Digital input 10 1 Digital input 11 15 Digital input 14 1 Digital input 15 17 PCB ground 1 PCB ground 19 PCB 5V 20 PCB 12V CON3 pin assignment of the digital output connector 1 Digital output 0 2 Digital output 1 5 Digital output 4 6 Digital output 5 17 Digital output 6 8 Digital output 8 10 Digi
10. gt DO 1 1 c getch if 0 return lt lt 1 if 0 3 1 PTMC12 DriverClose WORD pci 12 do WORD wDo outport 0 14 PCI TMC12 User Manual Ver 1 0 28 return NoError PCI TMC12 User Manual Ver 1 0 5 2 2 Use e If there is only one PCI TMC12 this program will test this only card If there are over one PCI TMC12 cards installed in the PC system this program will test the second card e How we know which card is the second card 2 Please refer to Sec 3 2 for more information demo 2 D I demo step 1 connect a 2 8 CON3 of PCI TMC12 with a 20 pin 1 to 1 flat cable step 2 run DEMO2 EXE include PCI TMC12 H WORD pci tmc12 do WORD void pci tmc12 di WORD wDi WORD wBase wI nt main Db X ORD wBoards har C clrscr wRetVal PTMC12 DriverInit amp w printf 1 if wBoards gt 1 rq WPLX wRetVal Boards Threr are d 12 Cards in this PC wBoards PTMC12 GetConfigAddressSpace 1 amp wBase amp wIrq amp WPLX card 1 else PTMC12 GetConfigAddressSpace 0 amp wBase amp wIrq amp wPLX card 0 printf Mn 3 1 1 for 1 0 1 lt 16 D I O test
11. itt wBase x wBase pci tmc12 do j pci tmc12 di amp k printf n if j k else lt lt 1 if 12 Driver TEST 2d gt prrmkf t gt printf lt 1 0 1 1 Close DO Sx DI x 1 j k EST ERROR TEST OK 224 void pci 12 di WORD wDi PCI TMC12 User Manual Ver 1 0 30 WORD wRetVal wDi inport wBase 0x14 amp PCI TMC12 User Manual Ver 1 0 5 3 Demo3 Wave Generator demo 3 Square Wave Generator step 1 all CLK select clock1 8M Key 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 cO char cConfig char cLow char cHigh WORD pci tmc12 1 cConfig char cLow char cHigh WORD pci tmc12 c2 char cConfig char cLow char cHigh WORD wBaseAddr wIrq wPLX int main int ly 77 WORD wBoards wRetVal char c clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are 54 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 12 Ge printf PTMC12_GetCon
12. 3 3 5 for more information PCI TMC12 User Manual Ver 1 0 old state low gt change to high now find a low_pulse start counter CH 2 mode 0 down count interrupt active High is Low channel 1 now int signal outportb A2 8259 0x20 5 CNT2 START CNT2 N down count of CNT2 Clock 1 ms Width of low pulse N 1 ms 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 xy step 2 CLK 1 select clock1 8M gt generate BASE clock step 3 CLK 2 select COUT1 1K gt measure pulse width step 4 J25 select CH3 step 5 run 13 Ky EE Use CH3 to simulate the external signal The user must set the J25 CH3 in this demo The user set the J25 EXT in real world application WORD init CH3 DWORD dwVal disable pci tmcl12 c2 0xb6 0xff 0xff mode 3 CNT2 CH3 80K 65536_count 0 8192 sec gt high_width 0 4096 sec gt high_width 0 4 sec low_width 0 4 sec 24 pci tmc12 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
13. only count low pulse outpd wPLX 0x4c 0x43 channel 1 interrupt active_High if wIrq 8 outportb A2 8259 0x20 outportb Al 8259 0x20 Refer to Sec 3 3 5 for more information PCI TMC12 User Manual Ver 1 0 54 5 12 12 Low Pulse Width demo 12 detect the pulse_width of low_pulse Use 3 to simulate external pulse step 1 CLK 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 gt measure pulse width step 4 J25 select CH3 step 5 run 12 jm include PCITMC12 H define 1 8259 0x20 define 2 8259 define EOI 0x20 WORD pci tmc12 select8254 char cChip WORD pci tmc12 cO char cConfig char cLow char cHigh WORD pci tmc12 cl char cConfig char cLow char cHigh WORD pci tmc12 c2 char cConfig char cLow char cHigh WORD init CH3 0 WORD wBaseAddr wIrq wPLX static void interrupt irq service int COUNT3 WIDTH3 CNT H CNT L irqmask now int state int main int 1 7 WORD wBoards wRetVal count char c DWORD dwVal float low pulse width clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are d PCI TMC12 Cards in this PC wBoards if wBoards 0 exi PTMC12_GetConfigAddressSpace 0 amp w putch 0x07 putch 0
14. stepl detect all PCI TMC12 card first wRetVal PTMC12_DriverInit amp wBoards printf Threr are PCI TMC12 Cards in this wBoards step2 save resource of all PCI TMC12 cards installed in this PC for 120 i lt wBoards i PTMC12_GetConfigAddressSpace i amp wBase amp wlrg amp wPLX printf nCard_ d wBase x wIrq x wPLX x i wBase wlItq wPLX wConfigSpace i 0 wBaseAddress save all resource of this card wConfigSpace i 1 wlrq save all resource of this card wConfigSpace i 2 wPLX save all resource of this card step3 control the PCI TMC12 directly wBase wConfigSpace 0 0 get base address the 0 outport wBase 0x 14 wDoValue control the D O states of 0 wDiValue inport wBase 0x 14 read states of 0 wBase wConfigSpace 1 0 get base address of 1 outport wBase 0x14 wDoValue control the D O states of 1 wDi Value inport wBase 0x 14 read the D I states of card_1 wPLX wConfigSpace 2 2 get PCl interface base address of card 2248 _outpd wPLX 0x4c 0x41 channel_1 interrupt active_Low outpd wPLX 0x4c 0 disable all interrupt PCI TMC12 User Manual Ver 1 0 18 3 2 Assignment of I O Address The plug amp play BIOS will assign the proper I O address to PCI TMC12 If there is only one PCI TMC12 the user can identify the board as
15. x wBaseAddr n 4 16 bit event down counter n tmcl12 select8254 0 tmcl2 c0 0x30 0xff 0xff CH 1 mode 0 down count ffff low inportb wBaseAddr high inportb wBaseAddr if if high 0x80 50 1 high 0x80 amp amp select 8254 1 0 BaseAddr 0x0C 0x00 latch counter 0 50 1 65536 1 0 50 0 software_count c65536 65536 0 Oxff high 256 Oxff low 2 printf nhigh x low x Cc65536 f software count f high low c65536 software count kbhit 0 getch break pr PTMC12 DriverClose Note 1 The starting two ECLK will be used to initialize 8254 PCI TMC12 User Manual Ver 1 0 38 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 User Manual Ver 1 0 39 5 7 Watchdog Timer demo 7 watchdog timer using CH 3 step 1 CLK 3 select clock2 80K J24 step 2 INT select CH3 J2 step 3 run demo7 exe include PCITMC12 H define 1 8259 0x20 define 2 8259 define EOI 0x20 WORD pci tmc12 select8254 char cChip WORD pci tmc12 cO char cConfig char cLow char cHigh WORD pci tmc12 cl char cConfig char cLow char cHigh WORD pci tm
16. 0 If there are two PCI TMC12 cards in the system the user will be very difficult to identify which board is 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 17 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 2 amp the value read from will be the same as D O The operation steps are given as following 1 Remove all 20 pin flat cable between CON2 and CON3 2 Install all PCI TMC12 cards into this PC system 3 Power on and run DEM10 EXE 4 Now all D I value will be different from D O value 5 Install a 20 pin flat cable into CON2 amp CON3 of any PCI TMC12 card 6 There will be one card s D I 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 TMC12 User Manual Ver 1 0 19 3 3 The Address The I O address of PCI TMC12 is automatically assigned by the 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 very well The hardware I O ports are de
17. 8254 chip 0 CH 1 mode 0 down count ffff latch counter 0 Note1 The starting two ECLK will be used to initialize 8254 So gt Total_Count Oxffff Current_Counnt 2 PCI TMC12 User Manual Ver 1 0 36 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 User Manual Ver 1 0 37 5 6 Software Counter X 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 CONI include 12 WOR WOR WOR WOR WOR D pci_tmc12_select8254 char cChip D pci tmcl2 cO char cConfig char cLow char cHigh D pci tmcl2 cl char cConfig char cLow char cHigh D pci tmcl2 c2 char cConfig char cLow char cHigh D wBaseAddr wIrq wPLX float c65536 software count int main WOR i 1 D wBoards wRetVal char c s0 unsigned int high low 65536 0 50 0 clr wRe pri PTM pri pri pci pci for scr ntf nu ntf Gi outporth w tVal PTMC12 DriverInit amp wBoards n 1 Threr are 54 3 Card 0 PCI TMC12 Cards in this PC wBoards C12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrq amp wPLX card 0 wBaseAddr
18. five signals can be used as interrupt sources CH3 CH6 CH9 CH12 amp EXT as following CH3 comes from COUT3 output of counter 3 CH6 comes from 6 output of counter 6 CH9 comes from COUT output of counter 9 12 comes from COUT12 output of counter 12 EXT comes from ECLK11 external CLK for counter 11 from CNI SPARE no interrupt source e 6 e CH9 EXT SPARE interrupt source ECLK11 CH3 CH6 CH9 CH12 EXT SPARE interrupt source COUT6 SPARE No interrupt source SPARE interrupt source COUT3 PCI TMC12 User Manual Ver 1 0 10 2 5 Daughter Boards 251 DB37 The DB 37 is a general purpose daughter board for D sub 37 pins It is designed for easy wire connection 545458585458545468 2 5 2 DN37 8 DN20 The DN 37 is a general purpose daughter board for DB 37 The DN 20 is designed for 20 pin flat cable They are designed for easy wire connection They are Din Rail mounting DN 37 2 5 3 8125 amp DB 8025 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 2 5 4
19. interrupt a value of 1 will generate interrupt B8 to reserved B31 Refer to DEMO7 C DEMOII 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 User Manual Ver 1 0 22 make sure the initial level is High or 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 T 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 Y 15 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 are 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 application codes are given here _outpd wPLX 0x4c 0x43 active High if wIrq 8 outportb A2 8259 0x20 EOI outportb 1 8259 0x20 EOI PCI TMC12 User Manual Ver 1 0 23 Example 2 ass
20. wIrq lt 8 A1_8259 1 A1_8259 1 irqmask 6 Oxff 1 lt lt setvect 8 irq service else irqmask inportb A1 825941 outportb Al1 8259 1 irqmask amp Oxfb IRQ2 outportb Al1 8259 1 irqmask 6 Oxff 1 lt lt wIrq irqmask inportb A2 825941 outportb A2 8259 1 irqmask 6 Oxff 1 lt lt wIrq 8 setvect 8 0 70 irq service enable void interrupt irq service if now_int_state 0 COUNT3 find a high_pulse PCI TMC12 User Manual Ver 1 0 59 x if COUNT3 2 start to down count pci tmc12 c1 0x70 0xff 0xff CH 2 mode 0 down count outpd wPLX 0x4c 0x41 channel 1 interrupt active Low now int state 1 now int signal is High PCI TMC12 User Manual Ver 1 0 60 else COUNT3 find a low_pulse if 3 stop the down count 6 read count outportb wBaseAddr 0x0C 0x40 latch counterl 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 AY if wIrq gt 8 outportb A2 8259 0x20 outportb A1_8259 0x20 A Initial Low START STOP CNT2 CNT2 8M
21. while inport wBaseAddr4 pci tmcl12 select8254 0 pci tmcl1 while inport wBaseAddr4 while inport wBaseAddr4 outporth w low inportb w inport wBaseAddr4 12_ 0 0x30 BaseAddr 0x0C 0x00 BaseAddr high inportb wBaseAddr count 0xff high 256 Oxff low 2 t Ox14 amp 1 0 wait EXG1 High Ox14 amp 1 0 wait EXG1 Low select 8254 0 CH 1 mode 0 down count t Ox14 amp 1 0 wait EXG1 High Ox14 amp 1 0 wait EXG1 Low latch counter 0 ms 0 000125 float count printf nhigh x low x count d f ms high low count ms PTMC12 DriverClose 8M Se 11111 External signal COUTI e N number of down count in CNT1 8M clock e Pulse width 8M width N PCI TMC12 User Manual Ver 1 0 46 7 52 5 9 Demo9 Frequency Measure voi demo 9 Signal Frequency Measur step 1 119 select 1 222 select CLOCL1 8M hz step 2 J20 select NCOUT1 J23 select ECLK2 step 3 connect external signal to 21 19 J Step 4 run demo9 exe the frequency of input signal will be shown in the screen 125 Hz min xy clude PCITMC12 H WOR WOR WOR WOR WOR int int WOR cha pci tmcl2 di WORD wDi
22. 12 cO char cConfig char WORD pci tmc12 1 cConfig char WORD pci tmc12 c2 char cConfig char WORD wBaseAddr wIrq wPLX int main mnt yg k WORD wBoards wRetVal char c cc 80 unsigned int high low count float ms clrscr wRetVal PTMC12 DriverInit amp wBoards printf N if wBoa putch printf exit 0 printf for i 0 PTMC12 printf 12 Ge printf printf for i 0 cc i cLow char cHigh cLow char cHigh cLow char cHigh n 1 Threr are 54 PCI TMC12 Cards in this PC wBoards rds 0 0x07 putch 0x07 putch 0x07 1 There are no 12 card in this PC n n 2 Show the Configuration Space of all PCI TMC12 i lt wBoards 1 4 _GetCo n i W 1 lt 80 nfigAddressSpace i amp w BaseAddr amp wIrq amp wPLX Card d wBaseAddr x wIrq x wPLX x tConfigAddressSpace 0 amp w n 3 Card 0 wBaseAddr x wBaseAddr n 4 read BaseAddr wIrq wPLX i mc12 di amp k BaseAddr amp wIrq amp wPLX card 0 amp show 80 read n wBaseAddr PCI TMC12 User Manual Ver 1 0 44 for 1 O i lt 80 itt 11680 01 if 3 0 0 else printf 1 PCI TMC12 User Manual Ver 1 0 while
23. 12 select8254 char cChip pci tmc12 cO char cConfig char cLow char cHigh pci tmc12 cl char cConfig char cLow char cHigh pci tmc12 c2 char cConfig char cLow char cHigh wBaseAddr wIrq CJ AX uU nt main nt ORD wBoards wRetVal har clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are 54 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 n press any key to stop bap rs for i 0 i lt wBoards i test_card i for 1 0 i lt 1000 i delay one ms delay 1 sec if kbhit 0 getch break PTMC12 DriverClose 19 test_card int card int i j k ok PTMC12 GetConfigAddressSpace card amp wBaseAddr amp wIrq 1 1 ok 1 for 1 0 1 lt 16 i pci tmc12 do j pci tmc12 di amp k PCI TMC12 User Manual Ver 1 0 51 if j k lt lt 1 if printf nCard Number d w if ok 1 printf Test ok 0 J 0 gels BaseAddr x card wBaseAddr else printf Test ERROR 5 11 demo 11 Use C step 1 CL step 2 J2 step 3 ru count low pulse H 3 to Simulate 5 select CH3 n demoll exe external pulse
24. 4 high inportb wBaseAddr 0x04 count 0xff high 256 Oxff low 2 PCI TMC12 User Manual Ver 1 0 48 COUTO 65536 0 000125 8 192 ms t 8 192 float count ms 1 0 6 1000 0 f lI T printf Nnhigh x low x count d frequency f Hz high low count f PTMC12 DriverClose CLK High GATEI COUTI Y COUT2 External signal CLK2 t gt Down_count2 number of down count CNT2 t T Down_count2 1 The be changed to CNT3 4 5 6 The COUT 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 PCI TMC12 User Manual Ver 1 0 49 to select his proper group for different application PCI TMC12 User Manual Ver 1 0 50 5 10 10 Find Card Number demo 10 Find card number demo step 1 run DEMO10 EXE step 2 connect a 20 pin flat cable to CON2 amp CON3 of card 2 step 3 The card number is shown in screen as TEST OK include PCITMC12 H WO VO WO WO WO WO WO pci tmc12 do WORD pci tmc12 di WORD wDi pci tmcl
25. CLK CLK10 CLK OUT OUT COUTIO _ GATE7 10 Counter 8 Counter 11 CLK8 CLK CLKII CLK OUT COE OUT COUTII GATES _ GATES y gt Counter 9 Counter 12 COUTI2 2 3 Block Diagram The PCI TMC12 provide 16 channel digital input and 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 DB 16R is a 16 channel relay output board The DB 24R is 24 channel power relay output board PCI TMC12 User Manual Ver 1 0 6 2 4 Jumper Setting 2 4 1 CLOCK1 amp CLOCK2 There are two stable internal clock sources in PCI TMC12 which named as CLOCKI amp CLOCK2 The CLOCKI may be 8M or 1 6M selectable by J27 The CLOCK2 may be 0 8M or 80K selected by J26 The block diagram of internal clock sources is given as following J27 select CLOCKI 8M CLOCKI 1 6 1 6M 8 1 6 CLOCKI 8M 800K CLOCK2 80K CLOCK2 800K 800K CLOCK2 80K CLOCK2 80K 2 User Manual Ver 1 0 7 2 4 2 CLK1 to CLK12 select CLOCK1 select CLOCK2 sel
26. 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 resistor 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 2 D I Opto Isolated LJ PCI TMC12 CON2 D I 20Pin cable NEM QUUM AC or DC Signal OV to 24V PCI TMC12 User Manual Ver 1 0 12 2 5 5 DB 16R Relay Board The DB 16R 16 channel relay output board consists of 16 form 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 DB 16R
27. K 3 select clock2 80K Demo11 Count Low Pulse 7 22 include PCITMC12 H defin defin defin 1 8259 0x20 2 8259 0 0 EOI 0x20 WO WO WO WO WO WO pci tmc12 cO char cConfig pci tmc12 cl char cConfig pci tmc12 c2 char cConfig nit CH3 BaseAddr wIrqg wPLX 2 23 2 2 2 2 void interrupt irq_service UNT3 irqmask now int state a tatic t CO t main nt i j ORD wBoards wRetVal har DWORD dwVal clrser wRetVal PTMC12 DriverInit amp w printf n 1 Threr are if wBoards 0 putch 0x07 printf 1 exit 0 putch 0x07 PTMC12_GetConfigAddressSpace 0 amp w printf n 3 Card 0 w COUNT3 20 pci tmcl12 select8254 0 printf 4 init CH3 0 PCI TMC12 User Manual Ver 1 0 BaseAddr x w pci tmc12 select8254 char cChip char cLow char cLow char cLow char cHigh char cHigh char cHigh 0 Boards d PCI TMC12 Cards putch 0x07 There are no PCI TMC12 card in this PC BaseAddr amp amp wPLX BaseAddr select 8254 chip 0 show the count of low pulse n in this PC w Boards card 0 for printf nCOUNT3 d COUNT3 if kbhit 0 getch break PTMC12 DriverClose
28. Operating Temperature 0 C to 60 C e Storage Temperature 20 C to 80 C e Humility 0 to 90 non condensing Dimension 150mm X 105mm Power Consumption 5V 500mA 11 Product Check List In addition to this manual the package includes the following items e PCI TMCI2 card e Demo program diskette Attention If any of this items is missing or damaged contact the dealer from whom you purchased the product Save the shipping materials and carton in case you want to ship or store the product in the future 2 User Manual Ver 1 0 3 Hardware configuration 2 Board Layout 2 1 PCI TMC12 Jl J2 J3 14 15 16 J7 18 J9 J10 J11 J12 J13 J14 J15 EL J16 J17 J18 J19 J20 J21 EE J22 J23 J24 8M CLOCKI 1 6M CON3 D O CON2 D I 4 PCI TMC12 User Manual Ver 1 0 2 2 Counter Architecture There are four 8254 chips on the PCI TMC12 card The block diagram is given as following 8254 CHIP 1 U12 8254 CHIP 2 U8 Counter Counter 4 CLKI CLK _ CLK4 CLK OUT OUT _ _ GATE4 Counter 2 Counter 5 CLK2 CLK5 gt CLK GATE2 SEA GATES T Counter 3 Counter 6 8254 CHIP 3 U3 8254 CHIP 4 U1 Counter 7 Counter 10 CLK7
29. TC LARGE DEMOI DEMO1 C gt demol source file VTTOCLARGEDEMODDEMOI PRJ gt TC project file TC LARGE DEMOI OPORTL LIB gt I O port library file TC LARGE DEMOI PCITMC12 LIB gt library file e TC LARGE DEMOI DEMOI EXE gt demol execution file PCI TMC12 User Manual Ver 1 0 21 5 1 1 Use D O 1 D O demo Xu step 1 connect a DB 16R to CON3 of PCI TMC12 Ez step 2 run DEMO1 EXE step 3 check the LEDs of DB 16R will turn on sequentially ai include PCITMC12 H WORD pci tmc12 do WORD WORD wBaseAddr wIrq wPLX nt main nt i j ORD wBoards wRetVal har C clrscri wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are 54 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 1 0 i lt wBoards i PTMC12_GetConfigAddressSpace amp wBaseAddr amp wPLX printf nCard_ d wBaseAddr x wIrq x wPLX x i wBaseAddr wIrq wPLX PTMC12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrq amp wPLX card 0 printf n 3 Card 0 D O test wBaseAddr x wBaseAddr 1 1 for i20 1 lt 16 i pci tmc12 do j printf NnTEST 824
30. c12 c2 char cConfig char cLow char cHigh WORD init watchdog WORD wBaseAddr wIrq wPLX static void interrupt irq service nt watchdog irqmask nt main nt 1 3 ORD wBoards wRetVal har DWORD dwVal H clrscr wRetVal PTMC12 DriverInit amp wBoards printf n 1 Threr are 54 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 PTMC12 GetConfigAddressSpace 0 amp wBaseAddr amp wIrq amp wPLX 0 printf n 3 Card_0 wIrq x wPLX x wIrq wPLX watchdog 0 pci_tmcl2_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 PCI TMC12 User Manual Ver 1 0 40 printf NnWait watchdog failure PCI TMC12 User Manual Ver 1 0 i for if watchdog 0 printf nwatchdog is failure now break if kbhit 0 getch break PTMC12 DriverClose outpd wPLX 0x4c 0 disable all interrupt Auf WORD init watchdog DWORD dwVal disable refresh watchdog outpd wPLX 0x4c 0x41 channel 1 interrupt active Low if wIrq 8 irqmask in
31. cription 0 Latch counter 0 1 Latch counter 1 0 Latch counter 2 Read back command 4 3 Read back command D7 D6 D5 D4 D3 D2 DI DO 1 1 COUNT STATUS CNT2 CNTI CNTO 0 D5 0 gt latch counter value of selected counters D4 0 gt latch status of selected counters D3 1 gt select counter 2 e 02 14 select counter 1 e DI 1 gt select counter 0 4 4 Status byte format Cout Null RWI RW2 M2 MI MO BCD count 7 0 gt Cout Low D7 1 gt Cout High D6 0 gt count available for reading D6 1 gt null count e D5 to DO 2 setting value read back PCI TMC12 User Manual Ver 1 0 26 5 Demo Program The application program of 8254 is very complicated There are 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 gt for Turbo C 2 xx or above TC LARGE gt for large model TC LARGE LIB gt for library source code TC LARGE DEMO gt demo program source code TC LARGE LIB PCITMC12 H gt library header file TC LARGE LIB PCITMC12 C gt library source file TC LARGE LIB A BAT gt compiler file TC LARGE LIB B BAT gt link file TC LARGE LIB PCITMC12 lib gt library file TC LARGE DEMOI PCITMC12 H gt library header file
32. ect COUTn 1 select external CLKn from CN1 Bm N Select 1 Select CLOCKI 2 CLOCK2 2 Select EXT_CLKn external CLKn Select COUTn 1 last channel CLK1 12 jumper Select sources CLOCKI CLOCK2 COUT6 ECLK1 CLOCK1 CLOCK2 COUT1 ECLK2 CLOCKI CLOCK2 COUT2 ECLK3 CLOCK1 CLOCK2 COUT3 ECLK4 CLOCKI CLOCK2 COUT4 ECLK5 CLOCKI CLOCK2 COUTS ECLK6 CLOCK1 CLOCK2 COUT12 ECLK7 CLOCKI CLOCK2 COUT7 ECLK8 CLOCKI CLOCK2 COUT8 ECLK9 CLOCK1 CLOCK2 COUT9 ECLK10 CLOCK2 COUTIO ECLK11 CLOCK2 COUT11 ECLK12 PCI TMC12 User Manual Ver 1 0 8 2 4 3 1 GATE12 3 1 3 2 1 GATEn Inverted COUTn 1 GATE Jumper Select source Inverted COUT6 Inverted EXTG2 Inverted COUT2 EXTG3 Inverted COUT3 EXTG4 Inverted COUTA EXTG5 Inverted COUTS EXTG6 3 1 3 2 1 GATEn COUTn 1 GATE GATE7 Jumper Select source COUT12 EXTG7 GATE8 GATE9 COUT7 EXTG8 COUTS EXTG9 GATE10 11 EXTG10 10 EXTG11 GETE12 COUTI1 EXTG12 PCI TMC12 User Manual Ver 1 0 2 4 4 425 Interrupt Source Selection There are
33. eta 7 215 11 2 0 PIN ASSIGNMENT 2 reete e etit 15 VO CONTROL 5 17 3 1 How TO FIND THE ADDRESS ccccccescesscsssccssccesssccssscessessscessscessscesssscessscesssesssesecessessssesseseeses 17 3 2 THE ASSIGNMENT OF ADDRESS eene nnne nnne nnne nene 19 3 3 THEI O ADDRESS MAP eene nennen ia 20 8254 PROGRAMMING 25 4 1 CONTROL WORD FORMAT err 25 4 2 COUNTER LATCH COMMAND 26 4 32 READ BACK COMMAND A SOD Sea Ihn ea 26 Zo STATUS BYTE FORMAT Sis bane nena eee han de C e NO EE E eee Us 26 DEMO PROGRAM enu a ce oe ce nece e ese Qe suae e Paese wai 27 5 1 DEMOL USED O XM 28 5 27 ettet 30 9 3 DEMOS W AVE GENERATOR eene etie vitet eio db ee ee ee veneto ye reed eve bete eed a 32 DEMOAZDEPAY ONEMS ise ebbe EL t Ne LE e er 34 5 5 DEMOS 16 BIT EVENT
34. figAddressSpace 0 amp w printf 3 printf 4 pci 2 se pci tmcl12 cO pci tmci12 c1 pci tmci12 c2 printf 5 pci_tmcl2_se pci 2 cO pci tmcl12 c1 pci tmcl12 c2 printf Mn 6 i wBoards i nCard d i wBaseAddr Card 0 Square lect8254 0 0x36 2 0 0x76 4 0 0xb6 8 0 Square lect8254 1 0x36 16 0 0x76 32 0 0xb6 64 0 Square PCI TMC12 User Manual Ver 1 0 tConfigAddressSpace i amp w wBaseAddr x wIrq wPLX wlrq x wPLX x BaseAddr amp amp wPLX wBaseAddr x wBaseAddr BaseAddr amp amp wPLX card 0 Wave Generator for to CH3 select 8254 chip 1 CH 1 mode 3 low 2 high 0 cout 4M CH 2 mode 3 low 4 high 0 cout 2M CH 3 mode 3 low 8 high 0 cout 1M Wave Generator for to CH6 select 8254 chip 2 CH 4 mode 3 low 16 high 0 cout 500K CH 5 mode 3 low 32 high 0 cout 250K CH 6 mode 3 low 64 high 0 cout 125K Wave Generator for CH7 to CH9 pci tmcl12 select8254 2 select 8254 chip 3 pci tmcl12 c0 0x36 128 0 CH 7 mode 3 low 128 high 0 cout 64K pci tmcl12 1 0 76 0 1 CH 8 mode 3 low 0 high 1 cout 32K pci tmcl12 c2 0xb6 0 2 CH 9 mode 3 low 0 high 2 cout 16K printf n 7 Square Wave Gene
35. mo 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 pinl of 1 Tu include PCITMC12 H WORD pci tmc12 select8254 char cChip WORD pci 12 cO char cConfig char WORD pci 12_ 1 cConfig char WORD pci tmc12 c2 char cConfig char WORD wBaseAddr wIrq wPLX nt main nu 1 2 Nar clrscr d 1 WORD wBoards wRetVal u nsigned int high low count wRetVal PTMC12 DriverInit amp w Boards printf n 1 Threr are if wBoards putch 0x07 printf 1 exit 0 PTMC12_GetConfigAddressSpace 0 amp w putch 0x07 putch cLow char cHigh cLow char cHigh cLow char cHigh 54 PCI TMC12 Cards in this PC wBoards 0x07 There are no PCI TMC12 card in this PC n BaseAddr amp wIrq amp wPLX card 0 printf n 3 Card 0 wBaseAddr x wBaseAddr printf n 4 16 bit event down counter n pci tmcl12 select8254 0 pci tmc12 c0 0x30 0xff 0xff for outporth w low inportb w th xff high 256 Oxff low 2 count u high low count high inpor count 0 printf An BaseAddr high x low x if kbhit 0 getch PTMC12 DriverClose BaseAddr 0x0C 0x00 BaseAddr break select
36. porthb A1_8259 1 outporthb A1l_8259 1 irgqmask 6 Oxff 1 lt lt setvect 8 irq service printf lt x gt wIrq else irqmask inportb A1 825941 outportb A1 8259 1 irqmask amp Oxfb IRQ2 outportb A1 8259 1 irqmask 6 Oxff 1 lt lt wIrqg 88 rqmask inportb A2 825941 utportb A2 8259 1 irqmask 6 Oxff 1 lt lt wIrq 8 setvect 8 0 70 irq service printf x wIrq enable 80K 65536_count 0 8192 sec gt high_width 0 4096 sec 7 gt the user has to refresh the watchdog before 0 4 sec refresh watchdog pci tmc12 c2 0xb6 0xff 0xff mode 3 CNT2 CH3 f return NoError void interrupt irq service watchdogt if wIrq gt 8 outportb A2 8259 0x20 PCI TMC12 User Manual Ver 1 0 42 outporth 1_8259 0x20 Refer to Sec 3 3 5 for more information PCI TMC12 User Manual Ver 1 0 5 8 8 Pulse Width Measure demo 8 Pulse Width Measure step 1 219 select EXTG1 0722 select CLOCL1 8M hz step 2 connect pin20 of 1 to pinl of CON2 step 3 connect external signal to pin20 pin19 step 4 run demo8 exe the width of active high pulse will be shown the screen 8 ms max xy include PCITMC12 H void pci tmc12 di WORD wDi WORD pci tmc12 select8254 char cChip WORD pci tmc
37. rator for CH10 to CH12 pci tmcl12 select8254 3 select 8254 chip 4 pci tmcl12 c0 0x36 0 4 10 3 low 0 high 4 cout 8K pci tmcl12 1 0 76 0 8 11 3 low 0 high 8 cout 4K pci 12 c2 0xb6 0 160 CH 12 mode 3 low 0 high 16 cout 2K PTMC12 DriverClose WORD pci tmci2 select8254 char cChip outportb wBaseAddr 0x10 cChip return NoError WORD pci tmci2 cO char cConfig char cLow char cHigh outportb wBaseAddr 0x0C cConfig outportb wBaseAddr CLOW outportb wBaseAddr CHigh return NoError WORD pci 12 1 cConfig char cLow char cHigh outportb wBaseAddr 0x0C cConfig outportb wBaseAddr 4 CLOW outportb wBaseAddr 4 cHigh return NoError WORD pci 12 c2 char cConfig char cLow char cHigh outportb wBaseAddr 0x0C cConfig outportb wBaseAddr 8 CLOW outportb wBaseAddr 8 CHigh return NoError PCI TMC12 User Manual Ver 1 0 33 57 472 5 4 4 Delay One Ms e 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
38. scribed as following Read Write Active 8254 Counter 0 Active 8254 Counter 0 Active 8254 Counter 1 Active 8254 Counter 1 Active 8254 Counter 2 Active 8254 Counter 2 Active 8254 Control word Active 8254 Control word Reserved Select the active 8254 chip Digital input channel 0 15 Digital output channel 0 15 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 card Only one 8254 is active at the same time Before using the active 8254 use wBase 0x10 to select the active 8254 WRITE 10 select the active 8254 chip xs k k k k p Note Refer to Sec 3 1 for more information about wBase D0 0 D1 0 8254 chip 1 is active 1 D1 0 8254 chip 2 is active DO 0 D1 1 8254 chip 3 is active 1 D1 1 8254 chip 4 is active outportb wBase 0x 10 0 select the 8254 chip 1 CNT1 CNT3 outportb wBase 0x 10 2 select the 8254 chip 3 CNT10 CNTI2 PCI TMCI2 User Manual Ver 1 0 20 3 3 2 8254 Timer Counter Control There are four 8254 chips in PCI TMC12 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 WwBase O through For detailed programming information about 8254 please refer to Chapter 4 amp Intel s Microsystem Components Handbook Read Write Acti
39. tal output 9 13 Digital output 12 14 Digital output 13 17 PCB ground 18 PCB ground 0 20 PCI TMC12 User Manual Ver 1 0 16 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 card in the power on stage The Ids of PCI TMC12 are given as following Vendor ID 10B5 Device ID 9050 e Sub vendor ID 2129 e Sub device ID 9912 We provide all necessary functions as following 1 PTMC12_DriverInit amp wBoard This function can detect how many PCI TMCI2 cards in the system It is implemented based on the PCI plug amp play mechanism 1 It will find all PCI TMC12 cards installed in this system amp save all their resource in the library e wBoard 1 gt only one PCI TMCI2 in this PC system e wBoard 2 gt there are two PCI TMCI2 in this PC system 2 PTMC12_GetConfigAddressSpace wBoardNo wBase wlIrq wPLX The user can use this function to save resource of all PCI TMC12 installed in this system Then the application program can control all functions of PCI TMC12 directly wBoardNo 0 to gt totally N 1 cards of PCI TMC12 e wBase gt base address of the board control word e gt allocated IRQ channel number of this board e wPLX gt base address of PCI interface IC PCI TMC12 User Manual Ver 1 0 17 sample program source is given as following
40. ume initial level Low Initial Low Ly Y 5 1 Initial sub now_int_state 0 _outpd wPLX 0x4c 0x43 INT signal is active_High 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 are 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 application codes are given here _outpd wPLX 0x4c 0x43 active High j if wIrq 8 outportb A2 8259 0x20 y outportb Al 8259 0x20 So the ISR_sub will be active on the rising edge amp falling edge of the interrupt signal Refer to demo7 c demol1 c 12 amp 13 for more information PCI TMC12 User Manual Ver 1 0 24 4 8254 Programming 41 Control Word Format D7 D6 D5 D4 D3 D2 D1 DO SCO RWO M2 1 BCD SCO Description Select counter 0 Select counter 1 1 0 Select counter_2 1 Read back command M2 1 Working mode 0 Mode 0 0 Don t care Mode 2 1 1 Mode 4 Mode 5 lt 1 Binary coded decimal BCD counter 4 decades PCI TMC12 User Manual Ver 1 0 25 4 2 Counter latch command D7 D6 D5 D4 D3 D2 DI DO SCI 5 0 0 0 X X X X SCO Des
41. ve 8254 Counter 0 Active 8254 Counter 0 Active 8254 Counter 1 Active 8254 Counter 1 Active 8254 Counter 2 Active 8254 Counter 2 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 _ _ Bi2 DI6 DI5 DI4 DB DD Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 DI15 014 DI12 Dil DI9 DI8 Note Refer to Sec 3 1 for more information about wBase wDiValue inport wBase 0x14 read the D I states PCI TMC12 User Manual Ver 1 0 21 3 3 4 Digital Output WRITE wBase 0x 14 set the digital output channel 0 to 15 Biro _ Bi2 DO7 DO6 DOS5 DO4 DO3 DO2 DOI poo Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 DOI5 14 DO13 DOI2 DOII 2010 209 DOS Note Refer to Sec 3 1 for more information about wBase outport wBase40x14 wDoValue control the D O states 3 3 5 interrupt control status register READ WRITE wPLX 0x4C interrupt control status register Description INTERRUPT enable O disable 1 enable POLARITY 1 active HIGH LOW INTERRUPT status O int not active 1 int is active Bit B3 reserved 5 7 reserved reserved PCI interrupt enable 0 disable 1 enable Software
42. x07 putch 0x07 printf 1 There are no PCI TMC12 card in this PC n 0 BaseAddr amp wIrq amp wPLX card 0 ntf n 3 Card 0 wBaseAddr x wBaseAddr select 8254 0 K pri printf n 4 detect the pulse width of low pulse pci tmcl12 select8254 0 for printf npress any key to continue c getch if c Q Q to stop goto ret label PCI TMC12 User Manual Ver 1 0 55 COUNT3 20 init CH3 while COUNT3 4 if kbhit 0 getch break _ 256 Oxf CNT_L 2 COUTO 1 ms low_pulse_width float count 1 0 printf nCNT_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 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 xJ WORD init CH3 DWORD dwVal disable pci tmc12 c2 0xb6 0xff 0xff mode 3 CNT2 CH3 Kf 80K 65536_count 0 8192 sec gt high_width 0 4096 sec gt high_width 0 4 sec low_width 0 4 sec pci tmc12 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

Download Pdf Manuals

image

Related Search

Related Contents

Dossier PPE Pfsense  bedienung - Sander Fördertechnik  Community Edition dieser Ausgabe  Case Logic eBook Case  MANUAL DEL OPERADOR  IRS Factors Calculator  取扱説明書 - Panasonic  Ariens 929002 User's Manual  Targus Notebook Ultralite LapDesk  User Manual - Hatteland Display AS  

Copyright © All rights reserved.
Failed to retrieve file