Omega 1002 manual Software Trigger and Polling Techniques

Page 41

Software Trigger and Polling Techniques

The steps below should be followed for software triggering and polling:

1.Send 00h to A/D mode control register (software trigger + polling transfer)

2.Send channel number to multiplexer control register.

3.Send the gain control code value to gain control register.

4.Send any value to software trigger control register to generate a software trigger signal.

5.Scan the READY bit of the A/D high byte data until READY=0

6.Read the 12 bits A/D data.

7.Convert the 12 bits binary data to the floating point value.

For example:

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

*/

/* DEMO 3: AdPolling

 

*/

/* Compiler: Borland C++ 3.1, Mode Large

*/

/* Output Code: HEX code

 

*/

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

*/

#include "P1002.H"

 

 

WORD wBaseAddr,wIrq;

 

 

//-------------------------------------------------------

 

WORD P1002_Delay(WORD wDownCount)

 

{

 

 

WORD h,l;

 

 

int count;

 

 

wDownCount &= 0x7fff;

 

 

if (wDownCount<1) wDownCount=1;

 

/* Clock in=4M --> count 4000 = 1 ms, count 1 = 0.25 us */

l=wDownCount&0xff;

 

 

wDownCount=wDownCount / 256;

 

h=wDownCount&0xff;

 

 

outp(wBaseAddr+3*4,0xB0);

/* mode_0, counter_2 */

outp(wBaseAddr+2*4,l);

/* counter_2 low byte first */

outp(wBaseAddr+2*4,h);

/* counter_2 high byte ,0x07D0=2000 */

outp(wBaseAddr+3*4,0x80);

/* latch counter_2 */

 

 

 

 

 

41

Image 41
Contents User’sGuide Servicing North America Table of Contents Software and Demo Program Diagnostic Program General Description IntroductionX86 System Block DiagramFeatures Analog Inputs SpecificationsPower Consumption 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