5.3 Example Program

DEMO_01.C

/* ============== Using OME-A-822 / connect one OME-DB-889D

=================*/

#include <stdio.h> #include “A822.h”

main(void)

{int data1,data2; float vol1,vol2;

A822_Initialize(0,0x220,-1,-1);

/* OME-A-822 Base address in 0x220 ref. OME-A-822 Software manual */

for(;;)

{

/*===============reading OME-DB-889D Channel 0 , Gain =1

=============*/

A822_AD_SetChGainMode(0,0,1);

 

/* Setup OME-A-822 A/D channel 0, Gain = 1 , Polling mode

 

*/

A822_DO(0x0010);

 

/* Send D/O data to OME-DB-889D , Channel 0, Gain=1 */

delay(10);

/* delay about 43u sec . Ref. Page 3 Settling time */

data1=A822_AD_PollingVar();

/* Reading OME-A-822 A/D data */ vol1=(float)((data1-2048)*5/2048); printf(“OME-DB-889D channel 0= %6.4f V\n”,vol1);

/*===========reading OME-DB-889D Channel 1 , Gain=10

===============*/

A822_AD_SetChGainMode(0,0,1);

/* Setup OME-A-822 A/D channel 0, Gain = 1 , Polling mode */

OME-DB-889D User’s Manual

21

Page 23
Image 23
Omega Speaker Systems OME-DB-889D manual Example Program, DEMO01.C