/* DIO.c : Write DO and read DI.(text file)(advanced) Compiler: BC++ 3.1, Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) MSC 6.0, MSVC 1.52. Compile mode: large Project: DIO.c ..\Lib\(8000E.Lib,7188XAL.Lib,7188XBL.Lib,7188XL.Lib or 7188EL.Lib) Hardware: 7188/8000 [24 May,2005] by Bill */ #include"..\lib\7188Xc.h" void ShowDI(void); void SetDo(int Do1,int Do2,int Do3); char buf[9]; void main() { InitLib(); SetDo(1,1,1); //DO1 ON, DO2 ON, DO3 ON ShowDI(); Getch(); SetDo(1,1,0); //DO1 ON, DO2 ON, DO3 OFF ShowDI(); Getch(); SetDo(1,0,1); //DO1 ON, DO2 OFF, DO3 ON ShowDI(); Getch(); SetDo(1,0,0); //DO1 ON, DO2 OFF, DO3 OFF ShowDI(); Getch(); SetDo(0,1,1); //DO1 OFF, DO2 ON, DO3 ON ShowDI(); Getch(); SetDo(0,1,0); //DO1 OFF, DO2 ON, DO3 OFF ShowDI(); Getch(); SetDo(0,0,1); //DO1 OFF, DO2 OFF, DO3 ON ShowDI(); Getch(); SetDo(0,0,0); //DO1 OFF, DO2 OFF, DO3 OFF ShowDI(); Getch(); } void ShowDI(void) { Print("\n\r-->\n\r"); Print("DI1=%s\n\r",ReadInitPin()?"Low":"High"); Print("DI2=%s\n\r",GetDi2()?"High":"Low"); Print("DI3=%s\n\r",GetDi3()?"High":"Low"); Print("Press any key to continue..."); } void SetDo(int Do1,int Do2,int Do3) { Print("\n\rSet DO1 to %s",Do1?"High":"Low"); if(Do1) { SetDo1High(); } else { SetDo1Low(); } Print("\n\rSet DO2 to %s",Do2?"High":"Low"); if(Do2) { SetDo2High(); } else { SetDo2Low(); } Print("\n\rSet DO3 to %s",Do3?"High":"Low"); if(Do3) { SetDo3High(); } else { SetDo3Low(); } }