@@ -0,0 +1,324 | |||
|
1 | /* | |
|
No newline at end of file | ||
|
2 | * Servidor.c | |
|
No newline at end of file | ||
|
3 | * | |
|
No newline at end of file | ||
|
4 | * Created on: Nov 3, 2009 | |
|
No newline at end of file | ||
|
5 | * Author: Jose Francisco Quenta | |
|
No newline at end of file | ||
|
6 | * | |
|
No newline at end of file | ||
|
7 | * Se implementa: | |
|
No newline at end of file | ||
|
8 | * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO | |
|
No newline at end of file | ||
|
9 | * -Cambio de apunte. | |
|
No newline at end of file | ||
|
10 | * -Lectura del estado actual del apunte y grabado del mismo en un archivo | |
|
No newline at end of file | ||
|
11 | */ | |
|
No newline at end of file | ||
|
12 | ||
|
No newline at end of file | ||
|
13 | #include <stdio.h> | |
|
No newline at end of file | ||
|
14 | #include <stdlib.h> | |
|
No newline at end of file | ||
|
15 | #include <string.h> | |
|
No newline at end of file | ||
|
16 | #include <unistd.h> | |
|
No newline at end of file | ||
|
17 | #include <errno.h> | |
|
No newline at end of file | ||
|
18 | ||
|
No newline at end of file | ||
|
19 | #include <sys/types.h> | |
|
No newline at end of file | ||
|
20 | #include <sys/socket.h> | |
|
No newline at end of file | ||
|
21 | #include <netinet/in.h> | |
|
No newline at end of file | ||
|
22 | #include <arpa/inet.h> | |
|
No newline at end of file | ||
|
23 | #include <netdb.h> | |
|
No newline at end of file | ||
|
24 | ||
|
No newline at end of file | ||
|
25 | #include "./Librerias/AT91gpio_Funciones.h" | |
|
No newline at end of file | ||
|
26 | #include "./Librerias/Mensajes.h" | |
|
No newline at end of file | ||
|
27 | ||
|
No newline at end of file | ||
|
28 | #define PUERTO_SERVIDOR 5500 | |
|
No newline at end of file | ||
|
29 | #define TAM_BUFFER 100 | |
|
No newline at end of file | ||
|
30 | ||
|
No newline at end of file | ||
|
31 | #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE | |
|
No newline at end of file | ||
|
32 | ||
|
No newline at end of file | ||
|
33 | #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION | |
|
No newline at end of file | ||
|
34 | ||
|
No newline at end of file | ||
|
35 | #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB | |
|
No newline at end of file | ||
|
36 | #define bit_up_1 0x00040000 | |
|
No newline at end of file | ||
|
37 | #define bit_up_0 0x00100000 | |
|
No newline at end of file | ||
|
38 | #define bit_dow_2 0x40000000 | |
|
No newline at end of file | ||
|
39 | #define bit_dow_1 0x01000000 | |
|
No newline at end of file | ||
|
40 | #define bit_dow_0 0x00400000 | |
|
No newline at end of file | ||
|
41 | ||
|
No newline at end of file | ||
|
42 | #define MyID 11 | |
|
No newline at end of file | ||
|
43 | ||
|
No newline at end of file | ||
|
44 | char *buff_experimento= NULL; | |
|
No newline at end of file | ||
|
45 | ||
|
No newline at end of file | ||
|
46 | AT91S_PIO *pioc; | |
|
No newline at end of file | ||
|
47 | AT91S_PIO *piob; | |
|
No newline at end of file | ||
|
48 | ||
|
No newline at end of file | ||
|
49 | /* | |
|
No newline at end of file | ||
|
50 | * Zona de declaracion de cabeceras. | |
|
No newline at end of file | ||
|
51 | */ | |
|
No newline at end of file | ||
|
52 | void inicializa_gpio(); | |
|
No newline at end of file | ||
|
53 | int procesa_peticion(char *buff_peticion); | |
|
No newline at end of file | ||
|
54 | int cambia_apuntamiento(char *puntero_char); | |
|
No newline at end of file | ||
|
55 | int carga_experimento(char *nombre_archivo); | |
|
No newline at end of file | ||
|
56 | int chequeo_sistema(char *numero_muestras); | |
|
No newline at end of file | ||
|
57 | ||
|
No newline at end of file | ||
|
58 | /* | |
|
No newline at end of file | ||
|
59 | * | |
|
No newline at end of file | ||
|
60 | */ | |
|
No newline at end of file | ||
|
61 | int main(){ | |
|
No newline at end of file | ||
|
62 | ||
|
No newline at end of file | ||
|
63 | int conexion_servidorFd; | |
|
No newline at end of file | ||
|
64 | struct sockaddr_in inf_servidor; | |
|
No newline at end of file | ||
|
65 | struct sockaddr_storage inf_cliente; | |
|
No newline at end of file | ||
|
66 | int resultado; | |
|
No newline at end of file | ||
|
67 | int numbytes_recibidos; | |
|
No newline at end of file | ||
|
68 | int rpta; | |
|
No newline at end of file | ||
|
69 | ||
|
No newline at end of file | ||
|
70 | char *buff_peticion = (char *) malloc(TAM_BUFFER); | |
|
No newline at end of file | ||
|
71 | ||
|
No newline at end of file | ||
|
72 | size_t addr_len; | |
|
No newline at end of file | ||
|
73 | ||
|
No newline at end of file | ||
|
74 | memset(&inf_servidor, 0, sizeof(inf_servidor)); | |
|
No newline at end of file | ||
|
75 | inf_servidor.sin_family= AF_INET; | |
|
No newline at end of file | ||
|
76 | inf_servidor.sin_port= htons(PUERTO_SERVIDOR); | |
|
No newline at end of file | ||
|
77 | inf_servidor.sin_addr.s_addr= INADDR_ANY; | |
|
No newline at end of file | ||
|
78 | ||
|
No newline at end of file | ||
|
79 | /* Se establece el socket */ | |
|
No newline at end of file | ||
|
80 | conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0); | |
|
No newline at end of file | ||
|
81 | if (conexion_servidorFd == -1){ | |
|
No newline at end of file | ||
|
82 | ERROR_FATAL("No se establecio correctamente el socket: socket()"); | |
|
No newline at end of file | ||
|
83 | } | |
|
No newline at end of file | ||
|
84 | ||
|
No newline at end of file | ||
|
85 | /* Se asocia el socket a un puerto y una IP */ | |
|
No newline at end of file | ||
|
86 | resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor)); | |
|
No newline at end of file | ||
|
87 | if (resultado== -1){ | |
|
No newline at end of file | ||
|
88 | ERROR_FATAL("No se establecio correctamente el socket: bind()"); | |
|
No newline at end of file | ||
|
89 | } | |
|
No newline at end of file | ||
|
90 | ||
|
No newline at end of file | ||
|
91 | /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */ | |
|
No newline at end of file | ||
|
92 | inicializa_gpio(); | |
|
No newline at end of file | ||
|
93 | ||
|
No newline at end of file | ||
|
94 | while(1){ | |
|
No newline at end of file | ||
|
95 | LOG_SERVIDOR("Esperando solicitud de cliente...\n"); | |
|
No newline at end of file | ||
|
96 | ||
|
No newline at end of file | ||
|
97 | /* Se espera hasta que un cliente se conecte */ | |
|
No newline at end of file | ||
|
98 | addr_len = sizeof(inf_cliente); | |
|
No newline at end of file | ||
|
99 | numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len); | |
|
No newline at end of file | ||
|
100 | if (numbytes_recibidos == -1){ | |
|
No newline at end of file | ||
|
101 | ERROR_FATAL("Error en la recepcion de datos: recvfrom()"); | |
|
No newline at end of file | ||
|
102 | } | |
|
No newline at end of file | ||
|
103 | ||
|
No newline at end of file | ||
|
104 | /* Se procede a procesar los datos recibidos */ | |
|
No newline at end of file | ||
|
105 | buff_peticion[numbytes_recibidos]= '\0'; | |
|
No newline at end of file | ||
|
106 | ||
|
No newline at end of file | ||
|
107 | /* procesamiento de la peticion */ | |
|
No newline at end of file | ||
|
108 | rpta = procesa_peticion(buff_peticion); | |
|
No newline at end of file | ||
|
109 | ||
|
No newline at end of file | ||
|
110 | //Respuesta del modulo de control | |
|
No newline at end of file | ||
|
111 | // | |
|
No newline at end of file | ||
|
112 | ||
|
No newline at end of file | ||
|
113 | ||
|
No newline at end of file | ||
|
114 | } | |
|
No newline at end of file | ||
|
115 | } | |
|
No newline at end of file | ||
|
116 | ||
|
No newline at end of file | ||
|
117 | ||
|
No newline at end of file | ||
|
118 | ||
|
No newline at end of file | ||
|
119 | /* | |
|
No newline at end of file | ||
|
120 | * Esta funcion incializa el puerto GPIO | |
|
No newline at end of file | ||
|
121 | */ | |
|
No newline at end of file | ||
|
122 | void inicializa_gpio(){ | |
|
No newline at end of file | ||
|
123 | ||
|
No newline at end of file | ||
|
124 | // Configuracion de los pines de APUNTE | |
|
No newline at end of file | ||
|
125 | pioc = pio_map(PIOC_BASE); | |
|
No newline at end of file | ||
|
126 | pio_enable(pioc, maskc_out); | |
|
No newline at end of file | ||
|
127 | pio_disable_irq(pioc, maskc_out); | |
|
No newline at end of file | ||
|
128 | pio_disable_multiple_driver(pioc, maskc_out); | |
|
No newline at end of file | ||
|
129 | pio_disable_pull_ups(pioc, maskc_out); | |
|
No newline at end of file | ||
|
130 | pio_synchronous_data_output(pioc, maskc_out); | |
|
No newline at end of file | ||
|
131 | pio_output_enable(pioc, maskc_out); | |
|
No newline at end of file | ||
|
132 | ||
|
No newline at end of file | ||
|
133 | // Configuracion de los pines de VERIFICACION | |
|
No newline at end of file | ||
|
134 | piob = pio_map(PIOB_BASE); | |
|
No newline at end of file | ||
|
135 | pio_enable(piob, maskb_in); | |
|
No newline at end of file | ||
|
136 | pio_disable_irq(piob, maskb_in); | |
|
No newline at end of file | ||
|
137 | pio_disable_multiple_driver(piob, maskb_in); | |
|
No newline at end of file | ||
|
138 | pio_disable_pull_ups(piob, maskb_in); | |
|
No newline at end of file | ||
|
139 | pio_input_enable(piob, maskb_in); | |
|
No newline at end of file | ||
|
140 | ||
|
No newline at end of file | ||
|
141 | } | |
|
No newline at end of file | ||
|
142 | ||
|
No newline at end of file | ||
|
143 | /* | |
|
No newline at end of file | ||
|
144 | * Esta funcion procesa el mensaje de peticion y genera respuesta | |
|
No newline at end of file | ||
|
145 | */ | |
|
No newline at end of file | ||
|
146 | int procesa_peticion(char *buff_peticion){ | |
|
No newline at end of file | ||
|
147 | int rpta; | |
|
No newline at end of file | ||
|
148 | // char *header = strtok(buff_peticion, ":"); | |
|
No newline at end of file | ||
|
149 | // char *ipSource = strtok(buff_peticion, ":"); | |
|
No newline at end of file | ||
|
150 | // char *ipDestino = strtok(buff_peticion, ":"); | |
|
No newline at end of file | ||
|
151 | char *comando = strtok(buff_peticion, ":"); | |
|
No newline at end of file | ||
|
152 | char *valor = strtok(NULL, ":"); | |
|
No newline at end of file | ||
|
153 | ||
|
No newline at end of file | ||
|
154 | if ((comando == NULL) || (valor == NULL)){ | |
|
No newline at end of file | ||
|
155 | ERROR("procesarPeticion: formato de mensaje incorrecto"); | |
|
No newline at end of file | ||
|
156 | } | |
|
No newline at end of file | ||
|
157 | else{ | |
|
No newline at end of file | ||
|
158 | if(strcmp(comando,"CARGA") == 0) | |
|
No newline at end of file | ||
|
159 | rpta = carga_experimento(valor); | |
|
No newline at end of file | ||
|
160 | else if(strcmp(comando,"CAMBIA") == 0) | |
|
No newline at end of file | ||
|
161 | rpta = cambia_apuntamiento(valor); | |
|
No newline at end of file | ||
|
162 | else if(strcmp(comando,"CHEQUEO") == 0) | |
|
No newline at end of file | ||
|
163 | rpta = chequeo_sistema(valor); | |
|
No newline at end of file | ||
|
164 | else | |
|
No newline at end of file | ||
|
165 | ERROR("procesa_peticion: comando no reconocido"); | |
|
No newline at end of file | ||
|
166 | } | |
|
No newline at end of file | ||
|
167 | ||
|
No newline at end of file | ||
|
168 | return rpta; | |
|
No newline at end of file | ||
|
169 | } | |
|
No newline at end of file | ||
|
170 | ||
|
No newline at end of file | ||
|
171 | ||
|
No newline at end of file | ||
|
172 | /* | |
|
No newline at end of file | ||
|
173 | * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego | |
|
No newline at end of file | ||
|
174 | * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato | |
|
No newline at end of file | ||
|
175 | * que sera usado en el cambio de apuntamiento. | |
|
No newline at end of file | ||
|
176 | */ | |
|
No newline at end of file | ||
|
177 | int carga_experimento(char *nombre_archivo){ | |
|
No newline at end of file | ||
|
178 | ||
|
No newline at end of file | ||
|
179 | FILE *Archivo_Fd; | |
|
No newline at end of file | ||
|
180 | ||
|
No newline at end of file | ||
|
181 | char *cadena = (char *) malloc(25); | |
|
No newline at end of file | ||
|
182 | ||
|
No newline at end of file | ||
|
183 | int longitud_cadena; | |
|
No newline at end of file | ||
|
184 | int num_bytes= 0; | |
|
No newline at end of file | ||
|
185 | int num_filas= 0; | |
|
No newline at end of file | ||
|
186 | ||
|
No newline at end of file | ||
|
187 | char ruta_archivo[50]; // Se crea la ruta para abrir el archivo | |
|
No newline at end of file | ||
|
188 | strcpy(ruta_archivo,"/mnt/sd/archivos/"); | |
|
No newline at end of file | ||
|
189 | strcat(ruta_archivo,nombre_archivo); | |
|
No newline at end of file | ||
|
190 | ||
|
No newline at end of file | ||
|
191 | Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada | |
|
No newline at end of file | ||
|
192 | if(!Archivo_Fd){ | |
|
No newline at end of file | ||
|
193 | ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n"); | |
|
No newline at end of file | ||
|
194 | return -1; | |
|
No newline at end of file | ||
|
195 | }else{ | |
|
No newline at end of file | ||
|
196 | ||
|
No newline at end of file | ||
|
197 | while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria | |
|
No newline at end of file | ||
|
198 | fgets(cadena,20,Archivo_Fd); | |
|
No newline at end of file | ||
|
199 | longitud_cadena= strlen(cadena); | |
|
No newline at end of file | ||
|
200 | cadena[longitud_cadena-1] = '\0'; | |
|
No newline at end of file | ||
|
201 | num_bytes = num_bytes + longitud_cadena; | |
|
No newline at end of file | ||
|
202 | num_filas++; | |
|
No newline at end of file | ||
|
203 | } | |
|
No newline at end of file | ||
|
204 | ||
|
No newline at end of file | ||
|
205 | rewind(Archivo_Fd); // Se reinicia el puntero del archivo | |
|
No newline at end of file | ||
|
206 | ||
|
No newline at end of file | ||
|
207 | char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun | |
|
No newline at end of file | ||
|
208 | // la longitud del archivo | |
|
No newline at end of file | ||
|
209 | fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); | |
|
No newline at end of file | ||
|
210 | ||
|
No newline at end of file | ||
|
211 | char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo | |
|
No newline at end of file | ||
|
212 | puntero= puntero + 12; | |
|
No newline at end of file | ||
|
213 | ||
|
No newline at end of file | ||
|
214 | buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); | |
|
No newline at end of file | ||
|
215 | strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo | |
|
No newline at end of file | ||
|
216 | ||
|
No newline at end of file | ||
|
217 | fclose(Archivo_Fd); | |
|
No newline at end of file | ||
|
218 | ||
|
No newline at end of file | ||
|
219 | cambia_apuntamiento("0"); // Se apunta a la direccion 0 | |
|
No newline at end of file | ||
|
220 | ||
|
No newline at end of file | ||
|
221 | return 1; | |
|
No newline at end of file | ||
|
222 | } | |
|
No newline at end of file | ||
|
223 | } | |
|
No newline at end of file | ||
|
224 | ||
|
No newline at end of file | ||
|
225 | /* | |
|
No newline at end of file | ||
|
226 | * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en | |
|
No newline at end of file | ||
|
227 | * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta | |
|
No newline at end of file | ||
|
228 | * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a | |
|
No newline at end of file | ||
|
229 | * traves del puerto GPIO. | |
|
No newline at end of file | ||
|
230 | */ | |
|
No newline at end of file | ||
|
231 | int cambia_apuntamiento(char *puntero_char){ | |
|
No newline at end of file | ||
|
232 | ||
|
No newline at end of file | ||
|
233 | /*MSB-UP-LSB MSB-DOWN-LSB*/ | |
|
No newline at end of file | ||
|
234 | int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara | |
|
No newline at end of file | ||
|
235 | // al dato que ingresa para formar el número | |
|
No newline at end of file | ||
|
236 | // entero que se le pasara al puerto GPIO | |
|
No newline at end of file | ||
|
237 | // Estos números son los pines del puerto GPIO | |
|
No newline at end of file | ||
|
238 | // que se estan usando para el control | |
|
No newline at end of file | ||
|
239 | ||
|
No newline at end of file | ||
|
240 | int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero | |
|
No newline at end of file | ||
|
241 | ||
|
No newline at end of file | ||
|
242 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero | |
|
No newline at end of file | ||
|
243 | // cantidad de bytes es el numero de bytes que | |
|
No newline at end of file | ||
|
244 | printf("%i\n",puntero); // contiene cada dato, para este caso es 7 | |
|
No newline at end of file | ||
|
245 | // porque es 6 bits de datos + 1 bit del cambio | |
|
No newline at end of file | ||
|
246 | // de linea. | |
|
No newline at end of file | ||
|
247 | char valor_char; | |
|
No newline at end of file | ||
|
248 | unsigned long valor; | |
|
No newline at end of file | ||
|
249 | unsigned long acumulado_ceros=0; | |
|
No newline at end of file | ||
|
250 | unsigned long acumulado_unos=0; | |
|
No newline at end of file | ||
|
251 | ||
|
No newline at end of file | ||
|
252 | int offset; // Defino offset para el desplazamiento a traves | |
|
No newline at end of file | ||
|
253 | for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" | |
|
No newline at end of file | ||
|
254 | ||
|
No newline at end of file | ||
|
255 | valor_char= buff_experimento[base+offset]; // Obtengo el dato | |
|
No newline at end of file | ||
|
256 | ||
|
No newline at end of file | ||
|
257 | if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno | |
|
No newline at end of file | ||
|
258 | valor= 0; | |
|
No newline at end of file | ||
|
259 | acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]); | |
|
No newline at end of file | ||
|
260 | }else{ | |
|
No newline at end of file | ||
|
261 | valor= 1; | |
|
No newline at end of file | ||
|
262 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); | |
|
No newline at end of file | ||
|
263 | } | |
|
No newline at end of file | ||
|
264 | ||
|
No newline at end of file | ||
|
265 | } | |
|
No newline at end of file | ||
|
266 | ||
|
No newline at end of file | ||
|
267 | pio_out(pioc, maskc_out, acumulado_unos, 1); | |
|
No newline at end of file | ||
|
268 | pio_out(pioc, maskc_out, acumulado_ceros, 0); | |
|
No newline at end of file | ||
|
269 | ||
|
No newline at end of file | ||
|
270 | return 1; | |
|
No newline at end of file | ||
|
271 | ||
|
No newline at end of file | ||
|
272 | } | |
|
No newline at end of file | ||
|
273 | ||
|
No newline at end of file | ||
|
274 | /* | |
|
No newline at end of file | ||
|
275 | * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el | |
|
No newline at end of file | ||
|
276 | * archivo Verificacion. | |
|
No newline at end of file | ||
|
277 | */ | |
|
No newline at end of file | ||
|
278 | ||
|
No newline at end of file | ||
|
279 | int chequeo_sistema(char *numero_muestras){ | |
|
No newline at end of file | ||
|
280 | ||
|
No newline at end of file | ||
|
281 | char valor[7]; | |
|
No newline at end of file | ||
|
282 | int i,cnt; | |
|
No newline at end of file | ||
|
283 | unsigned int entradac= 0; | |
|
No newline at end of file | ||
|
284 | FILE *fd; | |
|
No newline at end of file | ||
|
285 | fd=fopen("/mnt/sd/archivos/Verificacion","w"); | |
|
No newline at end of file | ||
|
286 | fprintf(fd,"%s\n","Verificacion"); | |
|
No newline at end of file | ||
|
287 | fprintf(fd,"%s\n","------------"); | |
|
No newline at end of file | ||
|
288 | cnt=0; | |
|
No newline at end of file | ||
|
289 | do | |
|
No newline at end of file | ||
|
290 | { | |
|
No newline at end of file | ||
|
291 | //Inicializando arreglo | |
|
No newline at end of file | ||
|
292 | for(i=0;i<6;i++) | |
|
No newline at end of file | ||
|
293 | valor[i]='0'; | |
|
No newline at end of file | ||
|
294 | ||
|
No newline at end of file | ||
|
295 | valor[6]='\0'; | |
|
No newline at end of file | ||
|
296 | ||
|
No newline at end of file | ||
|
297 | //Lectura de puerto | |
|
No newline at end of file | ||
|
298 | entradac= pio_in(piob,maskb_in); | |
|
No newline at end of file | ||
|
299 | ||
|
No newline at end of file | ||
|
300 | //Dandole formato al dato | |
|
No newline at end of file | ||
|
301 | if (!(entradac & bit_up_2)) | |
|
No newline at end of file | ||
|
302 | valor[0] = '1'; | |
|
No newline at end of file | ||
|
303 | if (!(entradac & bit_up_1)) | |
|
No newline at end of file | ||
|
304 | valor[1] = '1'; | |
|
No newline at end of file | ||
|
305 | if (!(entradac & bit_up_0)) | |
|
No newline at end of file | ||
|
306 | valor[2] = '1'; | |
|
No newline at end of file | ||
|
307 | if (!(entradac & bit_dow_2)) | |
|
No newline at end of file | ||
|
308 | valor[3] = '1'; | |
|
No newline at end of file | ||
|
309 | if (!(entradac & bit_dow_1)) | |
|
No newline at end of file | ||
|
310 | valor[4] = '1'; | |
|
No newline at end of file | ||
|
311 | if (!(entradac & bit_dow_0)) | |
|
No newline at end of file | ||
|
312 | valor[5] = '1'; | |
|
No newline at end of file | ||
|
313 | ||
|
No newline at end of file | ||
|
314 | //Escribiendo en archivo | |
|
No newline at end of file | ||
|
315 | fprintf(fd,"%s\n",valor); | |
|
No newline at end of file | ||
|
316 | cnt=cnt+1; | |
|
No newline at end of file | ||
|
317 | usleep(1*1000*1000); | |
|
No newline at end of file | ||
|
318 | ||
|
No newline at end of file | ||
|
319 | }while(cnt < atoi(numero_muestras)); | |
|
No newline at end of file | ||
|
320 | ||
|
No newline at end of file | ||
|
321 | fclose(fd); | |
|
No newline at end of file | ||
|
322 | ||
|
No newline at end of file | ||
|
323 | return 1; | |
|
No newline at end of file | ||
|
324 | } No newline at end of file |
@@ -1,219 +1,224 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> No newline at end of file |
|
2 | 2 | <?fileVersion 4.0.0?> No newline at end of file |
|
3 | 3 | No newline at end of file |
|
4 | 4 | <cproject> No newline at end of file |
|
5 | 5 | <storageModule moduleId="org.eclipse.cdt.core.settings"> No newline at end of file |
|
6 | 6 | <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1568263498"> No newline at end of file |
|
7 | 7 | <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1568263498" moduleId="org.eclipse.cdt.core.settings" name="Release"> No newline at end of file |
|
8 | 8 | <externalSettings/> No newline at end of file |
|
9 | 9 | <extensions> No newline at end of file |
|
10 | 10 | <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> No newline at end of file |
|
11 | 11 | <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file |
|
12 | 12 | <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file |
|
13 | 13 | <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file |
|
14 | 14 | <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> No newline at end of file |
|
15 | 15 | </extensions> No newline at end of file |
|
16 | 16 | </storageModule> No newline at end of file |
|
17 | 17 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
|
18 | No newline at end of file | |
|
18 | <configuration artifactName="Control_Module" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1568263498" name="Release" parent="cdt.managedbuild.config.gnu.exe.release"> No newline at end of file | |
|
19 | 19 | <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1568263498." name="/" resourcePath=""> No newline at end of file |
|
20 | 20 | <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.785297601" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release"> No newline at end of file |
|
21 | 21 | <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1008424557" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/> No newline at end of file |
|
22 | 22 | <builder buildPath="${workspace_loc:/Control_Module/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.365458410" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/> No newline at end of file |
|
23 | 23 | <tool id="cdt.managedbuild.tool.gnu.archiver.base.1343949145" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> No newline at end of file |
|
24 | 24 | <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.57926565" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"> No newline at end of file |
|
25 | 25 | <option id="gnu.cpp.compiler.exe.release.option.optimization.level.35312113" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> No newline at end of file |
|
26 | 26 | <option id="gnu.cpp.compiler.exe.release.option.debugging.level.936269591" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> No newline at end of file |
|
27 | 27 | </tool> No newline at end of file |
|
28 | 28 | <tool command="arm-unknown-linux-gnu-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1796829929" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"> No newline at end of file |
|
29 | 29 | <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.499243164" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/> No newline at end of file |
|
30 | 30 | <option id="gnu.c.compiler.exe.release.option.debugging.level.1960011250" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/> No newline at end of file |
|
31 | 31 | <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1347535566" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> No newline at end of file |
|
32 | 32 | </tool> No newline at end of file |
|
33 | 33 | <tool command="arm-unknown-linux-gnu-gcc" id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1288648685" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"> No newline at end of file |
|
34 | 34 | <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2046701530" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> No newline at end of file |
|
35 | 35 | <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> No newline at end of file |
|
36 | 36 | <additionalInput kind="additionalinput" paths="$(LIBS)"/> No newline at end of file |
|
37 | 37 | </inputType> No newline at end of file |
|
38 | <outputType id="cdt.managedbuild.tool.gnu.c.linker.output.439510446" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.c.linker.output"/> No newline at end of file | |
|
38 | 39 | </tool> No newline at end of file |
|
39 | 40 | <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1068281678" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"/> No newline at end of file |
|
40 | 41 | <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.796779267" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"> No newline at end of file |
|
41 | 42 | <inputType id="cdt.managedbuild.tool.gnu.assembler.input.690094510" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> No newline at end of file |
|
42 | 43 | </tool> No newline at end of file |
|
43 | 44 | </toolChain> No newline at end of file |
|
44 | 45 | </folderInfo> No newline at end of file |
|
45 | 46 | </configuration> No newline at end of file |
|
46 | 47 | </storageModule> No newline at end of file |
|
48 | ||
|
No newline at end of file | ||
|
49 | <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | |
|
No newline at end of file | ||
|
50 | <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> | |
|
No newline at end of file | ||
|
51 | <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> | |
|
No newline at end of file | ||
|
52 | <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> No newline at end of file | |
|
47 | 53 | <storageModule moduleId="scannerConfiguration"> No newline at end of file |
|
48 | 54 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> No newline at end of file |
|
49 | 55 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> No newline at end of file |
|
50 | 56 | <buildOutputProvider> No newline at end of file |
|
51 | 57 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
52 | 58 | <parser enabled="true"/> No newline at end of file |
|
53 | 59 | </buildOutputProvider> No newline at end of file |
|
54 | 60 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
55 | 61 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file |
|
56 | 62 | <parser enabled="true"/> No newline at end of file |
|
57 | 63 | </scannerInfoProvider> No newline at end of file |
|
58 | 64 | </profile> No newline at end of file |
|
59 | 65 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> No newline at end of file |
|
60 | 66 | <buildOutputProvider> No newline at end of file |
|
61 | 67 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
62 | 68 | <parser enabled="true"/> No newline at end of file |
|
63 | 69 | </buildOutputProvider> No newline at end of file |
|
64 | 70 | <scannerInfoProvider id="makefileGenerator"> No newline at end of file |
|
65 | 71 | <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> No newline at end of file |
|
66 | 72 | <parser enabled="true"/> No newline at end of file |
|
67 | 73 | </scannerInfoProvider> No newline at end of file |
|
68 | 74 | </profile> No newline at end of file |
|
69 | 75 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> No newline at end of file |
|
70 | 76 | <buildOutputProvider> No newline at end of file |
|
71 | 77 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
72 | 78 | <parser enabled="true"/> No newline at end of file |
|
73 | 79 | </buildOutputProvider> No newline at end of file |
|
74 | 80 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
75 | 81 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file |
|
76 | 82 | <parser enabled="true"/> No newline at end of file |
|
77 | 83 | </scannerInfoProvider> No newline at end of file |
|
78 | 84 | </profile> No newline at end of file |
|
79 | 85 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> No newline at end of file |
|
80 | 86 | <buildOutputProvider> No newline at end of file |
|
81 | 87 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
82 | 88 | <parser enabled="true"/> No newline at end of file |
|
83 | 89 | </buildOutputProvider> No newline at end of file |
|
84 | 90 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
85 | 91 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file |
|
86 | 92 | <parser enabled="true"/> No newline at end of file |
|
87 | 93 | </scannerInfoProvider> No newline at end of file |
|
88 | 94 | </profile> No newline at end of file |
|
89 | 95 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> No newline at end of file |
|
90 | 96 | <buildOutputProvider> No newline at end of file |
|
91 | 97 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
92 | 98 | <parser enabled="true"/> No newline at end of file |
|
93 | 99 | </buildOutputProvider> No newline at end of file |
|
94 | 100 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
95 | 101 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file |
|
96 | 102 | <parser enabled="true"/> No newline at end of file |
|
97 | 103 | </scannerInfoProvider> No newline at end of file |
|
98 | 104 | </profile> No newline at end of file |
|
99 | 105 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> No newline at end of file |
|
100 | 106 | <buildOutputProvider> No newline at end of file |
|
101 | 107 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
102 | 108 | <parser enabled="true"/> No newline at end of file |
|
103 | 109 | </buildOutputProvider> No newline at end of file |
|
104 | 110 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
105 | 111 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file |
|
106 | 112 | <parser enabled="true"/> No newline at end of file |
|
107 | 113 | </scannerInfoProvider> No newline at end of file |
|
108 | 114 | </profile> No newline at end of file |
|
109 | 115 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> No newline at end of file |
|
110 | 116 | <buildOutputProvider> No newline at end of file |
|
111 | 117 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
112 | 118 | <parser enabled="true"/> No newline at end of file |
|
113 | 119 | </buildOutputProvider> No newline at end of file |
|
114 | 120 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
115 | 121 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file |
|
116 | 122 | <parser enabled="true"/> No newline at end of file |
|
117 | 123 | </scannerInfoProvider> No newline at end of file |
|
118 | 124 | </profile> No newline at end of file |
|
119 | 125 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> No newline at end of file |
|
120 | 126 | <buildOutputProvider> No newline at end of file |
|
121 | 127 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
122 | 128 | <parser enabled="true"/> No newline at end of file |
|
123 | 129 | </buildOutputProvider> No newline at end of file |
|
124 | 130 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
125 | 131 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file |
|
126 | 132 | <parser enabled="true"/> No newline at end of file |
|
127 | 133 | </scannerInfoProvider> No newline at end of file |
|
128 | 134 | </profile> No newline at end of file |
|
129 | 135 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1568263498;cdt.managedbuild.config.gnu.exe.release.1568263498.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1796829929;cdt.managedbuild.tool.gnu.c.compiler.input.1347535566"> No newline at end of file |
|
130 | 136 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> No newline at end of file |
|
131 | 137 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> No newline at end of file |
|
132 | 138 | <buildOutputProvider> No newline at end of file |
|
133 | 139 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
134 | 140 | <parser enabled="true"/> No newline at end of file |
|
135 | 141 | </buildOutputProvider> No newline at end of file |
|
136 | 142 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
137 | 143 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file |
|
138 | 144 | <parser enabled="true"/> No newline at end of file |
|
139 | 145 | </scannerInfoProvider> No newline at end of file |
|
140 | 146 | </profile> No newline at end of file |
|
141 | 147 | <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> No newline at end of file |
|
142 | 148 | <buildOutputProvider> No newline at end of file |
|
143 | 149 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
144 | 150 | <parser enabled="true"/> No newline at end of file |
|
145 | 151 | </buildOutputProvider> No newline at end of file |
|
146 | 152 | <scannerInfoProvider id="makefileGenerator"> No newline at end of file |
|
147 | 153 | <runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> No newline at end of file |
|
148 | 154 | <parser enabled="true"/> No newline at end of file |
|
149 | 155 | </scannerInfoProvider> No newline at end of file |
|
150 | 156 | </profile> No newline at end of file |
|
151 | 157 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> No newline at end of file |
|
152 | 158 | <buildOutputProvider> No newline at end of file |
|
153 | 159 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
154 | 160 | <parser enabled="true"/> No newline at end of file |
|
155 | 161 | </buildOutputProvider> No newline at end of file |
|
156 | 162 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
157 | 163 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file |
|
158 | 164 | <parser enabled="true"/> No newline at end of file |
|
159 | 165 | </scannerInfoProvider> No newline at end of file |
|
160 | 166 | </profile> No newline at end of file |
|
161 | 167 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> No newline at end of file |
|
162 | 168 | <buildOutputProvider> No newline at end of file |
|
163 | 169 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
164 | 170 | <parser enabled="true"/> No newline at end of file |
|
165 | 171 | </buildOutputProvider> No newline at end of file |
|
166 | 172 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
167 | 173 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file |
|
168 | 174 | <parser enabled="true"/> No newline at end of file |
|
169 | 175 | </scannerInfoProvider> No newline at end of file |
|
170 | 176 | </profile> No newline at end of file |
|
171 | 177 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> No newline at end of file |
|
172 | 178 | <buildOutputProvider> No newline at end of file |
|
173 | 179 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
174 | 180 | <parser enabled="true"/> No newline at end of file |
|
175 | 181 | </buildOutputProvider> No newline at end of file |
|
176 | 182 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
177 | 183 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file |
|
178 | 184 | <parser enabled="true"/> No newline at end of file |
|
179 | 185 | </scannerInfoProvider> No newline at end of file |
|
180 | 186 | </profile> No newline at end of file |
|
181 | 187 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> No newline at end of file |
|
182 | 188 | <buildOutputProvider> No newline at end of file |
|
183 | 189 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
184 | 190 | <parser enabled="true"/> No newline at end of file |
|
185 | 191 | </buildOutputProvider> No newline at end of file |
|
186 | 192 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
187 | 193 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> No newline at end of file |
|
188 | 194 | <parser enabled="true"/> No newline at end of file |
|
189 | 195 | </scannerInfoProvider> No newline at end of file |
|
190 | 196 | </profile> No newline at end of file |
|
191 | 197 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> No newline at end of file |
|
192 | 198 | <buildOutputProvider> No newline at end of file |
|
193 | 199 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
194 | 200 | <parser enabled="true"/> No newline at end of file |
|
195 | 201 | </buildOutputProvider> No newline at end of file |
|
196 | 202 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
197 | 203 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> No newline at end of file |
|
198 | 204 | <parser enabled="true"/> No newline at end of file |
|
199 | 205 | </scannerInfoProvider> No newline at end of file |
|
200 | 206 | </profile> No newline at end of file |
|
201 | 207 | <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> No newline at end of file |
|
202 | 208 | <buildOutputProvider> No newline at end of file |
|
203 | 209 | <openAction enabled="true" filePath=""/> No newline at end of file |
|
204 | 210 | <parser enabled="true"/> No newline at end of file |
|
205 | 211 | </buildOutputProvider> No newline at end of file |
|
206 | 212 | <scannerInfoProvider id="specsFile"> No newline at end of file |
|
207 | 213 | <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> No newline at end of file |
|
208 | 214 | <parser enabled="true"/> No newline at end of file |
|
209 | 215 | </scannerInfoProvider> No newline at end of file |
|
210 | 216 | </profile> No newline at end of file |
|
211 | 217 | </scannerConfigBuildInfo> No newline at end of file |
|
212 | 218 | </storageModule> |
|
No newline at end of file | ||
|
213 | <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> No newline at end of file | |
|
214 | 219 | </cconfiguration> No newline at end of file |
|
215 | 220 | </storageModule> No newline at end of file |
|
216 | 221 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> No newline at end of file |
|
217 | 222 | <project id="Control_Module.cdt.managedbuild.target.gnu.exe.1941602615" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> No newline at end of file |
|
218 | 223 | </storageModule> No newline at end of file |
|
219 | 224 | </cproject> No newline at end of file |
@@ -1,322 +1,339 | |||
|
1 | 1 | /* No newline at end of file |
|
2 | 2 | * Servidor.c No newline at end of file |
|
3 | 3 | * No newline at end of file |
|
4 | 4 | * Created on: Nov 3, 2009 No newline at end of file |
|
5 | 5 | * Author: Jose Francisco Quenta No newline at end of file |
|
6 | 6 | * No newline at end of file |
|
7 | 7 | * Se implementa: No newline at end of file |
|
8 | 8 | * -Carga en memoria los apuntes contenidos en un archivo de experimentos: apunte0 -> GPIO No newline at end of file |
|
9 | 9 | * -Cambio de apunte. No newline at end of file |
|
10 | 10 | * -Lectura del estado actual del apunte y grabado del mismo en un archivo No newline at end of file |
|
11 | 11 | */ No newline at end of file |
|
12 | 12 | No newline at end of file |
|
13 | 13 | #include <stdio.h> No newline at end of file |
|
14 | 14 | #include <stdlib.h> No newline at end of file |
|
15 | 15 | #include <string.h> No newline at end of file |
|
16 | 16 | #include <unistd.h> No newline at end of file |
|
17 | 17 | #include <errno.h> No newline at end of file |
|
18 | 18 | No newline at end of file |
|
19 | 19 | #include <sys/types.h> No newline at end of file |
|
20 | 20 | #include <sys/socket.h> No newline at end of file |
|
21 | 21 | #include <netinet/in.h> No newline at end of file |
|
22 | 22 | #include <arpa/inet.h> No newline at end of file |
|
23 | 23 | #include <netdb.h> No newline at end of file |
|
24 | 24 | No newline at end of file |
|
25 | 25 | #include "./Librerias/AT91gpio_Funciones.h" No newline at end of file |
|
26 | 26 | #include "./Librerias/Mensajes.h" No newline at end of file |
|
27 | 27 | No newline at end of file |
|
28 | 28 | #define PUERTO_SERVIDOR 5500 No newline at end of file |
|
29 | 29 | #define TAM_BUFFER 100 No newline at end of file |
|
30 | 30 | No newline at end of file |
|
31 | 31 | #define maskc_out PC30+PC28+PC26+PC24+PC22+PC20 //MSB-UP-LSB MSB-DOWN-LSB //APUNTE No newline at end of file |
|
32 | 32 | No newline at end of file |
|
33 | 33 | #define maskb_in PB16+PB18+PB20+PB30+PB24+PB22 //MSB-UP-LSB MSB-DOWN-LSB //VERIFICACION No newline at end of file |
|
34 | 34 | No newline at end of file |
|
35 | 35 | #define bit_up_2 0x00010000 //Mascara de cada bit a revisar: bit_up_2 es MSB No newline at end of file |
|
36 | 36 | #define bit_up_1 0x00040000 No newline at end of file |
|
37 | 37 | #define bit_up_0 0x00100000 No newline at end of file |
|
38 | 38 | #define bit_dow_2 0x40000000 No newline at end of file |
|
39 | 39 | #define bit_dow_1 0x01000000 No newline at end of file |
|
40 | 40 | #define bit_dow_0 0x00400000 No newline at end of file |
|
41 | 41 | No newline at end of file |
|
42 | 42 | #define MyID 11 No newline at end of file |
|
43 | 43 | No newline at end of file |
|
44 | 44 | char *buff_experimento= NULL; No newline at end of file |
|
45 | 45 | No newline at end of file |
|
46 | 46 | AT91S_PIO *pioc; No newline at end of file |
|
47 | 47 | AT91S_PIO *piob; No newline at end of file |
|
48 | 48 | No newline at end of file |
|
49 | 49 | /* No newline at end of file |
|
50 | 50 | * Zona de declaracion de cabeceras. No newline at end of file |
|
51 | 51 | */ No newline at end of file |
|
52 | 52 | void inicializa_gpio(); |
|
53 | No newline at end of file | |
|
53 | int procesa_peticion(char *buff_peticion); | |
|
No newline at end of file | ||
|
54 | No newline at end of file | |
|
54 | int cambia_apuntamiento(char *puntero_char); | |
|
No newline at end of file | ||
|
55 | No newline at end of file | |
|
55 | int carga_experimento(char *nombre_archivo); | |
|
No newline at end of file | ||
|
56 | No newline at end of file | |
|
56 | int chequeo_sistema(char *numero_muestras); No newline at end of file | |
|
No newline at end of file | ||
|
57 | //int carga_experimento(char *nombre_archivo); | |
|
No newline at end of file | ||
|
58 | void carga_experimento(char *nombre_archivo); | |
|
No newline at end of file | ||
|
59 | //int chequeo_sistema(char *numero_muestras); | |
|
No newline at end of file | ||
|
60 | void chequeo_sistema(char *numero_muestras); No newline at end of file | |
|
57 | 61 | No newline at end of file |
|
58 | 62 | /* No newline at end of file |
|
59 | 63 | * No newline at end of file |
|
60 | 64 | */ No newline at end of file |
|
61 | 65 | int main(){ No newline at end of file |
|
62 | 66 | No newline at end of file |
|
63 | 67 | int conexion_servidorFd; No newline at end of file |
|
64 | 68 | struct sockaddr_in inf_servidor; No newline at end of file |
|
65 | 69 | struct sockaddr_storage inf_cliente; No newline at end of file |
|
66 | 70 | int resultado; No newline at end of file |
|
67 | 71 | int numbytes_recibidos; |
|
72 | No newline at end of file | |
|
68 | int rpta; No newline at end of file | |
|
69 | 73 | No newline at end of file |
|
70 | 74 | char *buff_peticion = (char *) malloc(TAM_BUFFER); No newline at end of file |
|
71 | 75 | No newline at end of file |
|
72 | 76 | size_t addr_len; No newline at end of file |
|
73 | 77 | No newline at end of file |
|
74 | 78 | memset(&inf_servidor, 0, sizeof(inf_servidor)); No newline at end of file |
|
75 | 79 | inf_servidor.sin_family= AF_INET; No newline at end of file |
|
76 | 80 | inf_servidor.sin_port= htons(PUERTO_SERVIDOR); No newline at end of file |
|
77 | 81 | inf_servidor.sin_addr.s_addr= INADDR_ANY; No newline at end of file |
|
78 | 82 | No newline at end of file |
|
79 | 83 | /* Se establece el socket */ No newline at end of file |
|
80 | 84 | conexion_servidorFd = socket(AF_INET,SOCK_DGRAM,0); No newline at end of file |
|
81 | 85 | if (conexion_servidorFd == -1){ No newline at end of file |
|
82 | 86 | ERROR_FATAL("No se establecio correctamente el socket: socket()"); No newline at end of file |
|
83 | 87 | } No newline at end of file |
|
84 | 88 | No newline at end of file |
|
85 | 89 | /* Se asocia el socket a un puerto y una IP */ No newline at end of file |
|
86 | 90 | resultado = bind(conexion_servidorFd,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor)); No newline at end of file |
|
87 | 91 | if (resultado== -1){ No newline at end of file |
|
88 | 92 | ERROR_FATAL("No se establecio correctamente el socket: bind()"); No newline at end of file |
|
89 | 93 | } No newline at end of file |
|
90 | 94 | No newline at end of file |
|
91 | 95 | /* Inicializamos el puerto GPIO del sistema embebido GSBC-9260S */ No newline at end of file |
|
92 | 96 | inicializa_gpio(); No newline at end of file |
|
93 | 97 | No newline at end of file |
|
94 | 98 | while(1){ No newline at end of file |
|
95 | 99 | LOG_SERVIDOR("Esperando solicitud de cliente...\n"); No newline at end of file |
|
96 | 100 | No newline at end of file |
|
97 | 101 | /* Se espera hasta que un cliente se conecte */ No newline at end of file |
|
98 | 102 | addr_len = sizeof(inf_cliente); No newline at end of file |
|
99 | 103 | numbytes_recibidos = recvfrom(conexion_servidorFd, buff_peticion, TAM_BUFFER-1, 0, (struct sockaddr *)&inf_cliente, &addr_len); No newline at end of file |
|
100 | 104 | if (numbytes_recibidos == -1){ No newline at end of file |
|
101 | 105 | ERROR_FATAL("Error en la recepcion de datos: recvfrom()"); |
|
106 | No newline at end of file | |
|
102 | } No newline at end of file | |
|
No newline at end of file | ||
|
107 | printf("Recibidos: %i\n",numbytes_recibidos); No newline at end of file | |
|
103 | 108 | No newline at end of file |
|
104 | 109 | /* Se procede a procesar los datos recibidos */ No newline at end of file |
|
105 | 110 | buff_peticion[numbytes_recibidos]= '\0'; No newline at end of file |
|
111 | printf("%s\n",buff_peticion); No newline at end of file | |
|
106 | 112 | No newline at end of file |
|
107 | 113 | /* procesamiento de la peticion */ |
|
114 | No newline at end of file | |
|
108 | rpta = procesa_peticion(buff_peticion); No newline at end of file | |
|
No newline at end of file | ||
|
115 | procesa_peticion(buff_peticion); No newline at end of file | |
|
109 | 116 | No newline at end of file |
|
110 | 117 | //Respuesta del modulo de control No newline at end of file |
|
111 | 118 | // No newline at end of file |
|
112 | 119 | No newline at end of file |
|
113 | 120 | No newline at end of file |
|
114 | 121 | } No newline at end of file |
|
115 | 122 | } No newline at end of file |
|
116 | 123 | No newline at end of file |
|
117 | 124 | /* No newline at end of file |
|
118 | 125 | * Esta funcion incializa el puerto GPIO No newline at end of file |
|
119 | 126 | */ No newline at end of file |
|
120 | 127 | void inicializa_gpio(){ No newline at end of file |
|
121 | 128 | No newline at end of file |
|
122 | 129 | // Configuracion de los pines de APUNTE No newline at end of file |
|
123 | 130 | pioc = pio_map(PIOC_BASE); No newline at end of file |
|
124 | 131 | pio_enable(pioc, maskc_out); No newline at end of file |
|
125 | 132 | pio_disable_irq(pioc, maskc_out); No newline at end of file |
|
126 | 133 | pio_disable_multiple_driver(pioc, maskc_out); No newline at end of file |
|
127 | 134 | pio_disable_pull_ups(pioc, maskc_out); No newline at end of file |
|
128 | 135 | pio_synchronous_data_output(pioc, maskc_out); No newline at end of file |
|
129 | 136 | pio_output_enable(pioc, maskc_out); No newline at end of file |
|
130 | 137 | No newline at end of file |
|
131 | 138 | // Configuracion de los pines de VERIFICACION No newline at end of file |
|
132 | 139 | piob = pio_map(PIOB_BASE); No newline at end of file |
|
133 | 140 | pio_enable(piob, maskb_in); No newline at end of file |
|
134 | 141 | pio_disable_irq(piob, maskb_in); No newline at end of file |
|
135 | 142 | pio_disable_multiple_driver(piob, maskb_in); No newline at end of file |
|
136 | 143 | pio_disable_pull_ups(piob, maskb_in); No newline at end of file |
|
137 | 144 | pio_input_enable(piob, maskb_in); No newline at end of file |
|
138 | 145 | No newline at end of file |
|
139 | 146 | } No newline at end of file |
|
140 | 147 | No newline at end of file |
|
141 | 148 | /* No newline at end of file |
|
142 | 149 | * Esta funcion procesa el mensaje de peticion y genera respuesta No newline at end of file |
|
143 | 150 | */ |
|
151 | No newline at end of file | |
|
144 | int procesa_peticion(char *buff_peticion){ | |
|
No newline at end of file | ||
|
152 | No newline at end of file | |
|
145 | int rpta; No newline at end of file | |
|
No newline at end of file | ||
|
153 | //int rpta = 0; | |
|
No newline at end of file | ||
|
154 | No newline at end of file | |
|
146 | 155 | // char *header = strtok(buff_peticion, ":"); No newline at end of file |
|
147 | 156 | // char *ipSource = strtok(buff_peticion, ":"); No newline at end of file |
|
148 | 157 | // char *ipDestino = strtok(buff_peticion, ":"); No newline at end of file |
|
149 | 158 | char *comando = strtok(buff_peticion, ":"); No newline at end of file |
|
150 | 159 | char *valor = strtok(NULL, ":"); No newline at end of file |
|
151 | 160 | No newline at end of file |
|
161 | printf("Testpoint_1\n"); No newline at end of file | |
|
152 | 162 | if ((comando == NULL) || (valor == NULL)){ No newline at end of file |
|
153 | 163 | ERROR("procesarPeticion: formato de mensaje incorrecto"); No newline at end of file |
|
154 | 164 | } No newline at end of file |
|
155 | 165 | else{ No newline at end of file |
|
156 | 166 | if(strcmp(comando,"CARGA") == 0) |
|
167 | No newline at end of file | |
|
157 | rpta = carga_experimento(valor); No newline at end of file | |
|
No newline at end of file | ||
|
168 | carga_experimento(valor); No newline at end of file | |
|
158 | 169 | else if(strcmp(comando,"CAMBIA") == 0) |
|
170 | No newline at end of file | |
|
159 | rpta = cambia_apuntamiento(valor); No newline at end of file | |
|
No newline at end of file | ||
|
171 | cambia_apuntamiento(valor); No newline at end of file | |
|
160 | 172 | else if(strcmp(comando,"CHEQUEO") == 0) |
|
173 | No newline at end of file | |
|
161 | rpta = chequeo_sistema(valor); No newline at end of file | |
|
No newline at end of file | ||
|
174 | chequeo_sistema(valor); No newline at end of file | |
|
162 | 175 | else No newline at end of file |
|
163 | 176 | ERROR("procesa_peticion: comando no reconocido"); No newline at end of file |
|
164 | 177 | } No newline at end of file |
|
165 | 178 | |
|
179 | No newline at end of file | |
|
166 | return rpta; No newline at end of file | |
|
167 | 180 | } No newline at end of file |
|
168 | 181 | No newline at end of file |
|
169 | 182 | No newline at end of file |
|
170 | 183 | /* No newline at end of file |
|
171 | 184 | * Esta funcion carga un archivo en un buffer que esta ubicado en memoria, luego No newline at end of file |
|
172 | 185 | * este buffer es usado en la funcion "cambia_apuntamiento" para obtener el dato No newline at end of file |
|
173 | 186 | * que sera usado en el cambio de apuntamiento. No newline at end of file |
|
174 | 187 | */ |
|
188 | No newline at end of file | |
|
175 | int carga_experimento(char *nombre_archivo){ No newline at end of file | |
|
No newline at end of file | ||
|
189 | void carga_experimento(char *nombre_archivo){ No newline at end of file | |
|
176 | 190 | No newline at end of file |
|
177 | 191 | FILE *Archivo_Fd; No newline at end of file |
|
178 | 192 | No newline at end of file |
|
179 | 193 | char *cadena = (char *) malloc(25); No newline at end of file |
|
180 | 194 | No newline at end of file |
|
181 | 195 | int longitud_cadena; No newline at end of file |
|
182 | 196 | int num_bytes= 0; No newline at end of file |
|
183 | 197 | int num_filas= 0; No newline at end of file |
|
184 | 198 | No newline at end of file |
|
185 | 199 | char ruta_archivo[50]; // Se crea la ruta para abrir el archivo No newline at end of file |
|
186 | 200 | strcpy(ruta_archivo,"/mnt/sd/archivos/"); No newline at end of file |
|
187 | 201 | strcat(ruta_archivo,nombre_archivo); No newline at end of file |
|
188 | 202 | No newline at end of file |
|
189 | 203 | Archivo_Fd = fopen(ruta_archivo,"r"); // Se procede a abrir el archivo, segun la ruta especificada No newline at end of file |
|
190 | 204 | if(!Archivo_Fd){ No newline at end of file |
|
191 | 205 | ERROR("carga_archivo: No se pudo abrir el archivo!!! --> fopen()\n"); |
|
206 | No newline at end of file | |
|
192 | return -1; No newline at end of file | |
|
193 | 207 | }else{ |
|
208 | No newline at end of file | |
|
194 | No newline at end of file | |
|
195 | 209 | while(!feof(Archivo_Fd)){ // Se procede a calcular la longitud del archivo para separar memoria No newline at end of file |
|
196 | 210 | fgets(cadena,20,Archivo_Fd); No newline at end of file |
|
197 | 211 | longitud_cadena= strlen(cadena); No newline at end of file |
|
198 | 212 | cadena[longitud_cadena-1] = '\0'; No newline at end of file |
|
199 | 213 | num_bytes = num_bytes + longitud_cadena; No newline at end of file |
|
200 | 214 | num_filas++; No newline at end of file |
|
201 | 215 | } No newline at end of file |
|
202 | 216 | No newline at end of file |
|
203 | 217 | rewind(Archivo_Fd); // Se reinicia el puntero del archivo No newline at end of file |
|
204 | 218 | No newline at end of file |
|
205 | 219 | char *buffer_temporal = (char *) malloc(num_bytes+1); // Se separa espacio de memoria segun No newline at end of file |
|
206 | 220 | // la longitud del archivo No newline at end of file |
|
207 | 221 | fread(buffer_temporal, sizeof(char), num_bytes, Archivo_Fd); No newline at end of file |
|
208 | 222 | |
|
223 | No newline at end of file | |
|
209 | char *puntero= strstr(buffer_temporal,".abs"); // Se procede a eliminar la cabecera del archivo No newline at end of file | |
|
No newline at end of file | ||
|
224 | char *puntero= strstr(buffer_temporal,".ab1"); // Se procede a eliminar la cabecera del archivo No newline at end of file | |
|
210 | 225 | puntero= puntero + 12; No newline at end of file |
|
211 | 226 | No newline at end of file |
|
212 | 227 | buff_experimento = (char *) malloc(7*(num_filas-3)); // num_bytes_fila*(num_filas-3); No newline at end of file |
|
213 | 228 | strncpy(buff_experimento,puntero,7*(num_filas-3)); // Se carga en memoria la informacion del archivo No newline at end of file |
|
214 | 229 | No newline at end of file |
|
215 | 230 | fclose(Archivo_Fd); No newline at end of file |
|
216 | 231 | |
|
232 | No newline at end of file | |
|
217 | cambia_apuntamiento("0"); // Se apunta a la direccion 0 | |
|
No newline at end of file | ||
|
233 | No newline at end of file | |
|
218 | ||
|
No newline at end of file | ||
|
234 | No newline at end of file | |
|
219 | return 1; No newline at end of file | |
|
220 | 235 | } No newline at end of file |
|
221 | 236 | } No newline at end of file |
|
222 | 237 | No newline at end of file |
|
223 | 238 | /* No newline at end of file |
|
224 | 239 | * Esta funcion recibe un numero en formato char, el dato se transforma a su equivalente en No newline at end of file |
|
225 | 240 | * un numero entero, que sera usado para sacar un dato del buffer "buff_experimento", esta No newline at end of file |
|
226 | 241 | * dato es el valor que se enviara al sistema de conmutacion RF para el cambio de apunte a No newline at end of file |
|
227 | 242 | * traves del puerto GPIO. No newline at end of file |
|
228 | 243 | */ |
|
244 | No newline at end of file | |
|
229 | int cambia_apuntamiento(char *puntero_char){ No newline at end of file | |
|
No newline at end of file | ||
|
245 | void cambia_apuntamiento(char *puntero_char){ No newline at end of file | |
|
230 | 246 | No newline at end of file |
|
231 | 247 | /*MSB-UP-LSB MSB-DOWN-LSB*/ No newline at end of file |
|
232 | 248 | int desplazamiento[6]={30,28,26,24,22,20}; // Defino los dezplazamientos que se aplicara No newline at end of file |
|
233 | 249 | // al dato que ingresa para formar el número No newline at end of file |
|
234 | 250 | // entero que se le pasara al puerto GPIO No newline at end of file |
|
235 | 251 | // Estos números son los pines del puerto GPIO No newline at end of file |
|
236 | 252 | // que se estan usando para el control No newline at end of file |
|
237 | 253 | No newline at end of file |
|
238 | 254 | int puntero= atoi(puntero_char); // Se convierte a entero la direccion del puntero No newline at end of file |
|
239 | 255 | No newline at end of file |
|
240 | 256 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero No newline at end of file |
|
241 | 257 | // cantidad de bytes es el numero de bytes que No newline at end of file |
|
242 | 258 | printf("%i\n",puntero); // contiene cada dato, para este caso es 7 No newline at end of file |
|
243 | 259 | // porque es 6 bits de datos + 1 bit del cambio No newline at end of file |
|
244 | 260 | // de linea. No newline at end of file |
|
245 | 261 | char valor_char; No newline at end of file |
|
246 | 262 | unsigned long valor; No newline at end of file |
|
247 | 263 | unsigned long acumulado_ceros=0; No newline at end of file |
|
248 | 264 | unsigned long acumulado_unos=0; No newline at end of file |
|
249 | 265 | No newline at end of file |
|
250 | 266 | int offset; // Defino offset para el desplazamiento a traves No newline at end of file |
|
251 | 267 | for(offset=0;offset<6;offset++){ // de cada dato que se obtiene del "buff_experimento" No newline at end of file |
|
252 | 268 | No newline at end of file |
|
253 | 269 | valor_char= buff_experimento[base+offset]; // Obtengo el dato No newline at end of file |
|
254 | 270 | No newline at end of file |
|
255 | 271 | if (valor_char == '0'){ // Obtengo el número acumulado segun sea un cero o un uno No newline at end of file |
|
256 | 272 | valor= 0; No newline at end of file |
|
257 | 273 | acumulado_ceros= acumulado_ceros + (1 << desplazamiento[offset]); No newline at end of file |
|
258 | 274 | }else{ No newline at end of file |
|
259 | 275 | valor= 1; No newline at end of file |
|
260 | 276 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); No newline at end of file |
|
261 | 277 | } No newline at end of file |
|
262 | 278 | No newline at end of file |
|
263 | 279 | } No newline at end of file |
|
264 | 280 | No newline at end of file |
|
265 | 281 | pio_out(pioc, maskc_out, acumulado_unos, 1); No newline at end of file |
|
266 | 282 | pio_out(pioc, maskc_out, acumulado_ceros, 0); No newline at end of file |
|
267 | 283 | |
|
284 | No newline at end of file | |
|
268 | return 1; No newline at end of file | |
|
269 | 285 | No newline at end of file |
|
270 | 286 | } No newline at end of file |
|
271 | 287 | No newline at end of file |
|
272 | 288 | /* No newline at end of file |
|
273 | 289 | * Esta funcion lee "n" veces el estado del APUNTE actual y lo guarda en el No newline at end of file |
|
274 | 290 | * archivo Verificacion. No newline at end of file |
|
275 | 291 | */ No newline at end of file |
|
276 | 292 | |
|
293 | No newline at end of file | |
|
277 | int chequeo_sistema(char *numero_muestras){ No newline at end of file | |
|
No newline at end of file | ||
|
294 | void chequeo_sistema(char *numero_muestras){ No newline at end of file | |
|
278 | 295 | No newline at end of file |
|
279 | 296 | char valor[7]; No newline at end of file |
|
280 | 297 | int i,cnt; No newline at end of file |
|
281 | 298 | unsigned int entradac= 0; No newline at end of file |
|
282 | 299 | FILE *fd; No newline at end of file |
|
283 | 300 | fd=fopen("/mnt/sd/archivos/Verificacion","w"); No newline at end of file |
|
284 | 301 | fprintf(fd,"%s\n","Verificacion"); No newline at end of file |
|
285 | 302 | fprintf(fd,"%s\n","------------"); No newline at end of file |
|
286 | 303 | cnt=0; No newline at end of file |
|
287 | 304 | do No newline at end of file |
|
288 | 305 | { No newline at end of file |
|
289 | 306 | //Inicializando arreglo No newline at end of file |
|
290 | 307 | for(i=0;i<6;i++) No newline at end of file |
|
291 | 308 | valor[i]='0'; No newline at end of file |
|
292 | 309 | No newline at end of file |
|
293 | 310 | valor[6]='\0'; No newline at end of file |
|
294 | 311 | No newline at end of file |
|
295 | 312 | //Lectura de puerto No newline at end of file |
|
296 | 313 | entradac= pio_in(piob,maskb_in); No newline at end of file |
|
297 | 314 | No newline at end of file |
|
298 | 315 | //Dandole formato al dato No newline at end of file |
|
299 | 316 | if (!(entradac & bit_up_2)) No newline at end of file |
|
300 | 317 | valor[0] = '1'; No newline at end of file |
|
301 | 318 | if (!(entradac & bit_up_1)) No newline at end of file |
|
302 | 319 | valor[1] = '1'; No newline at end of file |
|
303 | 320 | if (!(entradac & bit_up_0)) No newline at end of file |
|
304 | 321 | valor[2] = '1'; No newline at end of file |
|
305 | 322 | if (!(entradac & bit_dow_2)) No newline at end of file |
|
306 | 323 | valor[3] = '1'; No newline at end of file |
|
307 | 324 | if (!(entradac & bit_dow_1)) No newline at end of file |
|
308 | 325 | valor[4] = '1'; No newline at end of file |
|
309 | 326 | if (!(entradac & bit_dow_0)) No newline at end of file |
|
310 | 327 | valor[5] = '1'; No newline at end of file |
|
311 | 328 | No newline at end of file |
|
312 | 329 | //Escribiendo en archivo No newline at end of file |
|
313 | 330 | fprintf(fd,"%s\n",valor); No newline at end of file |
|
314 | 331 | cnt=cnt+1; No newline at end of file |
|
315 | 332 | usleep(1*1000*1000); No newline at end of file |
|
316 | 333 | |
|
334 | No newline at end of file | |
|
317 | }while(cnt < atoi(numero_muestras)); No newline at end of file | |
|
318 | 335 | No newline at end of file |
|
319 | 336 | fclose(fd); No newline at end of file |
|
320 | 337 | |
|
338 | No newline at end of file | |
|
321 | return 1; | |
|
No newline at end of file | ||
|
339 | No newline at end of file | |
|
322 | } No newline at end of file |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now