/* X300Demo.c: Demo program for X300 Compiler: BC++ 3.1 Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) Compile mode: large Project: X300Demo.c ..\..\lib\7188xcl.lib ..\..\lib\XBoard\X300.lib Hardware: 7188XC + X300 X300: 2 channel 12-Bit D/A (Analog output) 0~4.095 V [25/July/2005] by Liam */ #include #include "..\..\LIB\7188xc.h" #include "..\..\LIB\XBoard\X300.h" void main(void) { int iAction, iValue, quit; InitLib(); X300_Init(); //Initialize the X300 Puts("\r\n Demo program for 7188XC + X300\r\n"); while(iAction!=3) { quit=0; iAction=0; Puts("\r\n"); Puts("1)Channel 0 D/A (Analog output)\r\n"); Puts("2)Channel 1 D/A (Analog output)\r\n"); Puts("\r\n"); Puts("3)Quits demo program\r\n\r\n"); Puts("Choose an option and press [Enter]:"); Scanf("%d", &iAction); Puts("\r\n"); switch(iAction) { // D/A Channel 0 case 1: Print("Please input data(0-4095): "); Scanf("%d", &iValue); X300_AnalogOut(0, iValue); Print("AO[%d] %d OK.\r\n", 0, iValue); break; // D/A Channel 1 case 2: Print("Please input data(0-4095): "); Scanf("%d", &iValue); X300_AnalogOut(1, iValue); Print("AO[%d] %d OK.\r\n", 1, iValue); break; case 3: quit=1; X300_AnalogOut(0, 0); X300_AnalogOut(1, 0); break; default: quit=1; break; } if(!quit) { Puts("Press any key to continue...\r\n"); Getch(); } } }