/* Demo1.c: The Demo1 program is output for X104 8 channels DI/O board. (single channel programmable) Compiler: BC++ 3.1, Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) Compile mode: large Project: Demo1.c ..\..\Lib\7188xcl.lib Hardware: 7188XC + X104 X104: 8 Channels, each channel can be programmed to D/I or D/O [26/July/2005] by Liam */ #include #include "..\..\lib\7188xc.h" void main(void) { int quit=0,c; Init5DigitLed(); // Set the mode is output SetTi0Dir(0); // pin 1: output SetTi1Dir(0); // pin 2: output SetTo0Dir(0); // pin 3: output SetDio4Dir(0); // pin 4: output SetDio9Dir(0); // pin 5: output SetDio14Dir(0); // pin 6: output SetTo1Dir(0); // pin 8: output while(!quit) { Print("\r\nThe demo1 is output for x104 board.\r\n"); Print("\r\n1. The pin 1~6 & pin 8 is output high.\r\n"); outp(0, 0xff); Show5DigitLed(1, 15); Show5DigitLed(2, 15); // Set the output is high SetTi0High(); // pin 1: output high SetTi1High(); // pin 2: output high SetTo0High(); // pin 3: output high SetDio4High(); // pin 4: output high SetDio9High(); // pin 5: output high SetDio14High(); // pin 6: output high SetTo1High(); // pin 8: output high c=Getch(); if( c=='q') quit=1; Print("\r\n2. The pin 1~6 & pin 8 is output low.\r\n"); outp(0, 0x00); Show5DigitLed(1, 0); Show5DigitLed(2, 0); // Set the output is high SetTi0Low(); // pin 1: output low SetTi1Low(); // pin 2: output low SetTo0Low(); // pin 3: output low SetDio4Low(); // pin 4: output low SetDio9Low(); // pin 5: output low SetDio14Low(); // pin 6: output low SetTo1Low(); // pin 8: output low c=Getch(); if( c=='q') quit=1; } }