Omega Vehicle Security OME-PIO-D56 manual DEMO3, COUNT=0

Page 45

4.4DEMO3

/* demo 3

: Count high pulse of PC0

*/

/*

(initial Low & active High)

*/

/* step 1

: run DEMO3.EXE

*/

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

 

*/

#include "PIO.H"

 

 

#define A1_8259

0x20

 

#define A2_8259

0xA0

 

#define EOI

0x20

 

WORD init_low();

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_low();

 

 

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

 

for (;;)

 

 

{

 

 

gotoxy(1,8);

 

 

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_low()

 

 

{

 

 

disable();

/* disable all interrupt */

outportb(wBase+5,0);

if (wIrq<8)

 

 

{

 

 

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

---- 43

Image 45
Contents User’sGuide Mexico CanadaBenelux Czech RepublicOME-PIO-D56/D24 Table of Contents Introduction FeaturesSpecifications Order DescriptionOptions Product Checklist PCI Data Acquisition FamilyOME-PISO-series cost-effective generation, isolated cards Board Layout Hardware configurationI/O Port Location Enabling I/O Operation1 DI/DO Port Architecture CON3 Select Sec RESET\ Sec DI Port Architecture CON2 Do Port Architecture CON1 If INT signal is Low now Æ select the non-inverted input Interrupt OperationMake 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 PIOGetConfigAddressSpace Enable all D/I/O operations of card0Enable 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 MapRESET\ Control Register AUX 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