Chemtrail .PDF

Page 124

/* DT2801.C */ #define Base Ox2EC #define Command (Base + 1) #define Status Command #define Data Base #define Command_Wait 0x04 #define Write_Wait 0x02 #define Read_Wait 0x05 #define DataInFull 0x02 #define Ready 0x04 #define Data_Out_Ready 0x01 #include <conio.h> /* #include "b:\modular\struct.h" */ void InitDT2801(void); float DTVIn(unsigned char channel); void DTVOut(unsigned char channel,float voltage); void InitDT2801(void) { unsigned char byte; /* Stop board from whatever it's doing */ outp(Command,0x0F); /* Read Data Register to Clear Data Out Flag */ byte = inp(Data); /* Wait for Data in Full flag to clear and Ready flag to set. */ /* Then write RESET command */ /* Wait for Data in Full flag to clear and Ready flag to set. */ /* Then write Clear command */

do { byte = inp(Status); } while((byte & Data_In_Full) I (!(byte & Ready))); outp(Command,0x01); /* Clear Command*/

void DTVOut(unsigned char channel, float voltage) { unsigned char byte,low,high; low = ((short)(voltage/10.0*4096)) % 0x100; high = ((short)(voltage/10.0*4096)) / 0x100; /* Wait for Data in Full flag to clear and Ready flag to set. */ /* Then write WRITE DAC IMMEDIATE command */

do { byte = inp(Status); (!(byte & Ready))); } while((byte & Data_In_Full) outp(Command,0x08); /* WRITE DAC Immediate */ /* Wait for Data in Full flag to clear. */ /* Then write DAC SELECT BYTE */

do { byte = inp(Status); } while(byte & Data_In_Full); outp(Data,channel); /* 0 means output channel 0 */ /* Wait for Data in Full flag to clear. */

124


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.