00001 /*************************************************************************** 00002 * Copyright (C) 30.4.2004 by * 00003 * Matthias Kranz (matthias.kranz@ifi.lmu.de) * 00004 * Paul Holleis (paul.holleis@ifi.lmu.de) * 00005 * * 00006 * header file for standard SmartITs definitions. * 00007 * * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the * 00021 * Free Software Foundation, Inc., * 00022 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00023 **************************************************************************/ 00024 /****************************************************************************** 00025 * defines 00026 *****************************************************************************/ 00027 #ifndef __GP2D120 00028 #define __GP2D120 00029 #endif 00030 00032 #define GP2D120_MAX 1024 00033 00034 #define GP2D120_MIN 0 00035 /****************************************************************************** 00036 * global variables 00037 *****************************************************************************/ 00038 00039 /****************************************************************************** 00040 * function signatures 00041 *****************************************************************************/ 00042 long read_gp2d120_raw(); 00043 00044 /****************************************************************************** 00045 * Code 00046 *****************************************************************************/ 00052 long read_gp2d120_raw() 00053 { 00054 long distance_raw = 0; 00055 // adc channel 2 (port a2) for the new distscroller board, 0 for the old. 00056 set_adc_channel(2); 00057 delay_ms(2); 00058 distance_raw = read_adc(); 00059 return(distance_raw); 00060 }
1.3.9.1