Omega 1002 manual

Page 27

The sample program code is shown below:

/* Step1: Detect all OME-PCI-1002 card first */ wRetVal=P1002_DriverInit(&wBoards);

printf("There are %d OME-PCI-1002 Cards in this PC\n",wBoards);

/* Step2: save resource of all OME-PCI-1002 cards installed in this PC */

 

for (i=0; i<wBoards; i++)

 

 

{

 

 

P1002_GetConfigAddressSpace(i,&wBase,&wIrq,&wPLX);

 

printf("\nCard_%d: wBase=%x, wIrq=%x, wPLX=%x", i,wBase,wIrq,wPLX);

 

wConfigSpace[i][0]=wBaseAddress; /* save all resource of this card */

 

wConfigSpace[i][1]=wIrq;

/* save all resource of this card */

 

wConfigSpace[i][2]=wPLX;

/* save all resource of this card */

 

}

 

 

/* Step3: control the OME-PCI-1002 directly */

 

wBase=wConfigSpace[0][0];

/* get base address the card_0

*/

outpw(wBase+0x20,wDoValue);

/* control the D/O states of card_0

*/

wDiValue=inpw(wBase+0x20);

/* read the D/I states of card_0

*/

wBase=wConfigSpace[1][0];

/* get base address of card_1

*/

outpw(wBase+0x20,wDoValue);

/* control the D/O states of card_1

*/

wDiValue=inpw(wBase+0x20);

/* read the D/I states of card_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 interrupts

*/

27

Image 27
Contents User’sGuide Servicing North America Table of Contents Software and Demo Program Diagnostic Program General Description IntroductionX86 System Block DiagramFeatures Specifications Power ConsumptionAnalog Inputs 4 A/D Trigger Methods 3 D/I and D/OInterrupt Channel Programmable Timer/CounterOME-PCI-1002 series multifunction cards ApplicationsRelease Notes Product Check ListBoard Layout Hardware ConfigurationA/D Calibration Jumper SettingOME-PCI-1002 System Function Block System Block DiagramOME-DB-8225 OME-DB-37 Daughter BoardsOME-DB-16P Isolated Input Board OME-DB-16R Relay Board Analog Input Signal Connection Page Page Signal Shielding Jumper Settings Connectors Page O Registers How to Find the I/O AddressPage I/O Address Map Section 8254 Registers Status Register Clear Interrupt Interrupt Source Selection General Control RegisterTrigger Method Selection Digital I/O Function OperationA/D trigger 8254 TimerSymbol Name Minimum Maximum CPU A/D ConversionSuggested Settling Times 1 A/D Conversion Trigger Modes Software Trigger and Polling Techniques Page Page Software and Demo Program Driver Plug & Play Test Power-ON Plug & Play TestA/D Test D I/O TestWARRANTY/DISCLAIMER Temperature