Omega Vehicle Security OME-PIO-D56 manual DEMO4

Page 47

4.5DEMO4

/* demo 4

: Count high pulse of PC0

*/

/*

(initial High & active Low)

*/

/* step 1

: run DEMO4.EXE

*/

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

 

*/

#include "PIO.H"

 

 

#define A1_8259

0x20

 

#define A2_8259

0xA0

 

#define EOI

0x20

 

WORD init_high();

WORD wBase,wIrq;

static void interrupt irq_service(); int COUNT,irqmask,now_int_state;

int main()

{

int i,j;

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 */

COUNT=0;

 

 

init_high();

 

 

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

 

for (;;)

 

 

{

 

 

gotoxy(1,7);

 

 

printf("\nCOUNT=%d",COUNT);

 

 

if (kbhit()!=0) break;

 

 

}

/* disable all interrupt */

outportb(wBase+5,0);

PIO_DriverClose();

 

 

}

 

 

/* Use PC0 as external interrupt signal

 

*/

WORD init_high()

 

 

{

 

 

disable();

/* disable all interrupt */

outportb(wBase+5,0);

if (wIrq<8)

 

 

{

 

 

irqmask=inportb(A1_8259+1);

 

 

outportb(A1_8259+1,irqmask & 0xff ^ (1<<wIrq));

 

setvect(wIrq+8,irq_service);

 

 

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

---- 45

Image 47
Contents User’sGuide Czech Republic CanadaMexico BeneluxOME-PIO-D56/D24 Table of Contents Introduction FeaturesOptions SpecificationsOrder Description OME-PISO-series cost-effective generation, isolated cards Product ChecklistPCI Data Acquisition Family Board Layout Hardware configuration1 DI/DO Port Architecture CON3 I/O Port LocationEnabling I/O Operation Select Sec RESET\ Sec DI Port Architecture CON2 Do Port Architecture CON1 Make sure the initial level is High or Low If INT signal is Low now Æ select the non-inverted inputInterrupt Operation 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-8125 Daughter BoardsOME-DB-37 OME-DN-37OME-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 PC’s physical slot information How to Find the I/O AddressResource-allocated information PIO/PISO identification informationD56/D24 PIODriverInitPIODriverInit&wBoards, wSubVendor,wSubDevice,wSubAux WSubVendor=0x80 wSubDevice=1 wSubAux=0x40 ForPrintf\nThrer are %d Piopiso Cards in this PC,wBoards OME-PISO-P32C32 Enable all D/I/O operations of card1 PIOGetConfigAddressSpaceEnable all D/I/O operations of card0 ShowPIOPISOwSubVendor,wSubDevice,wSubAux ShowPIOPISOSlot5 0x0A Slot6 0x08 Slot7 0x09 Slot8 0x07 Assignment of I/O AddressAddress Read Write I/O Address MapAUX data Register RESET\ Control RegisterAUX Control 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