LLC2_API
|
00001 /* ------------------------------------------------------------------------- */ 00002 /* file example2.cpp */ 00003 /* ------------------------------------------------------------------------- */ 00004 /* Copyright (C) 2011 Peter Milne, D-TACQ Solutions Ltd 00005 * <Peter dot Milne at D hyphen TACQ dot com> 00006 * Created on: Sep 14, 2011 00007 * Author: pgm 00008 00009 http://www.d-tacq.com 00010 00011 This program is free software; you can redistribute it and/or modify 00012 it under the terms of Version 2 of the GNU General Public License 00013 as published by the Free Software Foundation; 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 00023 /* ------------------------------------------------------------------------- */ 00024 00025 /** @file example2.cpp Example app with multiple cards 00026 * 00027 */ 00028 #include <stdio.h> 00029 #include <sys/types.h> 00030 #include <sys/stat.h> 00031 #include <unistd.h> 00032 #include <stdlib.h> 00033 #include <errno.h> 00034 #include <assert.h> 00035 00036 #include "ll2.h" 00037 #include "testharness.h" 00038 00039 00040 00041 00042 int main(int argc, const char* argv[]) 00043 { 00044 LL_ControlSystem& the_system = LL_ControlSystem::create("example2"); 00045 #define SAMPLES (the_system.getSamples()) 00046 the_system.addCard(new ACQ196(2)); 00047 the_system.addCard(new ACQ196(3)); 00048 the_system.addCard(new AO32(4)); 00049 the_system.addCard(new AO32(5)); 00050 the_system.addCard(new AO32(6)); 00051 the_system.addCard(new AO32(7)); 00052 the_system.init(argc, argv); 00053 00054 Outputs outputs(the_system.getAO_count(), the_system.getDO_count()); 00055 Inputs inputs(SAMPLES, the_system.getAI_count(), the_system.getDI_count()); 00056 00057 the_system.Arm(outputs.getAO(0), outputs.getDO(0)); 00058 00059 for (int ii = 0; ii < SAMPLES; ++ii){ 00060 int rc = the_system.IO( 00061 outputs.getAO(ii), outputs.getDO(ii), 00062 inputs.getAI(ii), inputs.getDI(ii), inputs.getStatus(ii)); 00063 } 00064 00065 the_system.Stop(); 00066 LL_ControlSystem::closedown(the_system); 00067 }