Omega Vehicle Security OME-PIO-D56 manual DEMO5, PC3

Page 49

4.6DEMO5

/* demo 5 : Four interrupt source

*/

/*

PC0

: initial Low

, active High

*/

/*

PC1

: initial High , active Low

*/

/*

PC2

: initial Low

, active High

*/

/*

PC3

: initial High , active Low

*/

/* step 1 : run DEMO5.EXE

 

*/

/* --------------------------------------------------------------

 

 

*/

#include "PIO.H"

 

 

 

#define A1_8259 0x20

 

 

#define A2_8259 0xA0

 

 

#define EOI

0x20

 

 

WORD init();

 

 

 

WORD wBase,wIrq;

 

 

 

static void interrupt irq_service();

 

int irqmask,now_int_state,new_int_state,invert,int_c,int_num;

 

int CNT_L1,CNT_L2,CNT_L3,CNT_L4;

 

 

int CNT_H1,CNT_H2,CNT_H3,CNT_H4;

 

 

int main()

 

 

 

{

i,j;

 

 

 

int

 

 

 

WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6;

 

WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;

 

char c;

 

 

 

clrscr();

 

 

 

/* step1 : find address-mapping of PIO/PISO cards

*/

 

.

 

 

 

 

.

 

/* select card_0 */

/* step2 : enable all D/I/O port

/* /RESET -> 1

*/

outportb(wBase,1);

*/

/* step3 : configure I/O direction

*/

outportb(wBase+0xcc,0x00);

/* set CON3 as D/I ports */

init();

 

 

 

printf("\n***** show the count of pulse *****\n");

for (;;)

{

gotoxy(1,7);

printf("\n(CNT_L,CNT_H)=(%d,%d) (%d,%d) (%d,%d) (%d,%d) %x",CNT_L1,CNT_H1,CNT_L2,CNT_H2,CNT_L3,CNT_H3,CNT_L4,CNT_H4,int_num);

if (kbhit()!=0) break;

}

outportb(wBase+5,0);

/* disable all interrupt */

PIO_DriverClose();

 

 

}

 

 

/* Use PC0, PC1, PC2 & PC3 as external interrupt signal

*/

WORD init()

 

 

{

 

 

disable();

/* disable all interrupt */

outportb(wBase+5,0);

OME-PIO-D56/OME-PIO-D24 User Manual (Ver.2.1, Oct/2003)

---- 47

Image 49
Contents User’sGuide Mexico CanadaBenelux Czech RepublicOME-PIO-D56/D24 Table of Contents Introduction FeaturesOrder Description SpecificationsOptions PCI Data Acquisition Family Product ChecklistOME-PISO-series cost-effective generation, isolated cards Board Layout Hardware configurationEnabling I/O Operation I/O Port Location1 DI/DO Port Architecture CON3 Select Sec RESET\ Sec DI Port Architecture CON2 Do Port Architecture CON1 Interrupt Operation If INT signal is Low now Æ select the non-inverted inputMake sure the initial level is High or Low Interrupt output signal of OME-PIO-D56/OME-PIO-D24, INT\ is Interrupt Block Diagram of OME-PIO D56/D24INTCHAN0/1/2/3 COUNTL++ Initialhigh, activelow Interrupt sourceInitiallow, activehigh Interrupt source PC0 PC1 PC2 PC3 Muliti-Interrupt SourceRead all interrupt state OME-DB-37 Daughter BoardsOME-DN-37 OME-DB-8125OME-ADP-20/PCI OME-DB-24PD Isolated Input Board OME-DB-24RD Relay Board OME-DB-24PRD, OME-DB-24POR, OME DB-24C Daughter Board Comparison Table Pin Assignment All signals are TTL compatibleDI0 DI1 DI2 DI3 DI4 DI5 DI6 DI7 DI8 DI9 Resource-allocated information How to Find the I/O AddressPIO/PISO identification information PC’s physical slot informationPIODriverInit&wBoards, wSubVendor,wSubDevice,wSubAux PIODriverInitWSubVendor=0x80 wSubDevice=1 wSubAux=0x40 For D56/D24Printf\nThrer are %d Piopiso Cards in this PC,wBoards OME-PISO-P32C32 Enable all D/I/O operations of card0 PIOGetConfigAddressSpaceEnable all D/I/O operations of card1 ShowPIOPISOwSubVendor,wSubDevice,wSubAux ShowPIOPISOSlot5 0x0A Slot6 0x08 Slot7 0x09 Slot8 0x07 Assignment of I/O AddressAddress Read Write I/O Address MapAUX Control Register RESET\ Control RegisterAUX data Register Aux Status Register INT Mask Control Register7 I/O Selection Control Register Interrupt Polarity Control RegisterRead/Write 8-bit data Register Demo program How to install software & utility?Piopiso PIOPISO.EXE for Windows DEMO1 DEMO2 COUNT=0 DEMO3COUNT++ DEMO4 COUNT++ PC3 DEMO5CNTL1=CNTL2=CNTL3=CNTL4=0 Page WARRANTY/DISCLAIMER Temperature