Dev - C++ - no me declara el int dentro del lcd

 
Vista:

no me declara el int dentro del lcd

Publicado por antonio (2 intervenciones) el 30/04/2015 05:17:43
donde dice funcion principal es donde no me jala,me marca el error en el int
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
#include <16F876.h>
#fuses XT,NOWDT
#use delay(clock= 4000000)
#include <lcd.c>
#include <1wire.c>
#include <ds18b20.c>
#include <DHT22.h>
#use standard_io(B)
#use standard_io(A)
 
int dia=1;                   // Dias de incubacion
int tent=37;                 // Parte entera de la temperatura  
int tdec=5;                  // Parte decimal de la temperatura
int hum=60;                  // Humedad relativa
char volteo='S';             // Volteo 'S' o 'N'
int cursor=1;                // Cursor para desplazarse en menu
int mem_pos=0;               // Posicion en la memoria eeprom
int1 masuno=0;               // Cursor+1
long mseg=0;                 // Reloj de incubacion (resolucion medio segundo)
int hora=0;                  // Horas de incubacion
int ss=0;                    // Temporizador medicion
float t_real;                // Temperatura medida
float temperatura;           // Temperatura programada para comparar la T medida
float humedad;               // Humedad programada para comparar con la RH medida
 
//////////////////////////////////////////////////////
// DECLARACION DE FUNCIONES                         //
//////////////////////////////////////////////////////
 
void lectura();              // Lectura de parametros en eeprom
void incubacion();           // Incubacion
void mostrar();              // Muestra parametros en LCD
void paramet();              // Escritura de parametros en eeprom
 
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
// FUNCION PRINCIPAL                                //
//////////////////////////////////////////////////////
 
void main(){
   lcd_init();                                                   // Inicializa LCD  
   int n;
   if (input(ok) == 1){                                         // Si mantenemos pulsado OK en el
   printf(lcd_putc,"fPARAMETRIZANDO\nMEMORIA EEPROM..");         // inicio llenamos la memoria    
   for( n=1;n<=16;n++){                                          // eeprom con valores por defecto.
   write_eeprom(mem_pos,tent);
   mem_pos++;
   write_eeprom(mem_pos,tdec);
   mem_pos++;
   write_eeprom(mem_pos,hum);
   mem_pos++;
   write_eeprom(mem_pos,volteo);
   mem_pos++;
   }
   mem_pos=0;
   delay_ms(1000);
   }
   while(1){
   lcd_send_byte(0,0x0c);                                       // Anulamos el cursor y parpadeo del
   printf(lcd_putc,"\f** xxxxxxxxx **\n* ELECTRONICA *");       // mismo en el LCD y mostramos una
   delay_ms(1000);                                              // intro.
   printf(lcd_putc,"\f** xxxxxxxxxx **\n TLF. xxxxxxxxx");
   delay_ms(1000);
   printf(lcd_putc,"\fOK para comenzar\n< + > configurar");
    while(1){
    if (input(right) == 1 && input(left) == 1){                 // Si pulsamos IZQ + DER leemos las
   delay_ms(300);                                               // 4 primeras posiciones de la  
    tent=read_eeprom(mem_pos);                                  // eeprom,
   mem_pos++;
   tdec=read_eeprom(mem_pos);
   mem_pos++;
   hum=read_eeprom(mem_pos);
   mem_pos++;
   volteo=read_eeprom(mem_pos);
   mem_pos=0;
   mostrar();                                                   // las mostramos en pantalla,
   paramet();                                                   // y entramos en el menu de confi- 
    }                                                           // racion de parametros.
   if (input(ok) == 1){                                         // Si pulsamos OK entramos en el 
   incubacion();                                                // programa de incubacion.
    }
   }
    }
    }
 
//////////////////////////////////////////////////////
// FUNCION LECTURA EEPROM                           //
//////////////////////////////////////////////////////
 
void lectura(){
if (dia<=16){                          // Si estamos dentro de los dias de incubacion programados,
   tent=read_eeprom(mem_pos);          // leemos los parametros en eeprom.
   mem_pos++;
   tdec=read_eeprom(mem_pos);
   mem_pos++;
   hum=read_eeprom(mem_pos);
   mem_pos++;
   volteo=read_eeprom(mem_pos);
   mem_pos++;
   temperatura=tdec;                   // Unimos la parte entera y decimal de la temperatura
   temperatura=temperatura/10;         // programada y la guardamos en variable flotante.
   temperatura+=tent;
   humedad=hum;                        // Guardamos la humedad en variable flotante.
   }
   }
 
//////////////////////////////////////////////////////
// FUNCION INCUBACION                               //
//////////////////////////////////////////////////////
 
void incubacion(){
   lectura();                                    // Leemos parametros del 1º dia.
   dht_init();                                   // Inicializa Sensor de Humedad.
   setup_timer_1(T1_INTERNAL | T1_DIV_BY_8);     // Timer1 configurado para 0.5 segundos.
   set_timer1(3036);
   enable_interrupts(INT_TIMER1);                // Interrupcion por desbordamiento de Timer1
   //enable_interrupts(int_ext);                   // Interrupcion externa en RB0
   //ext_int_edge(H_TO_L);                         // Interrupcion cambio de estado alto a bajo en RB0
   enable_interrupts(GLOBAL);                    // Activamos las interrupciones.
   while(1){
   if (hora >= 24){                              // Si ha pasado un dia (24 horas),
   hora=0;                                       // reseteamos hora,
   dia++;                                        // pasamos al siguiente dia
   lectura();                                    // y leemos los parametros correspondientes.
   }
   if (ss == 3){                                 // Cada 2 segundos
   t_real=ds1820_read();                         // medimos la resistencia
   if (t_real<temperatura-0.2)                   // y activamos la resistencia T si bajamos de 0.2ºC
   output_high(rtemp);                           // con respecto a la temperatura programada,
   if (t_real>temperatura+0.3)                   // o desactivamos la resistencia T si subimos de
   output_low(rtemp);                            // 0.3ºC con respecto a la temperatura programada,
   leer_dht22(dhthum, dhttemp);                  // y medimos la humedad
   if (dhthum<humedad-5.0)                       // y activamos la resistencia RH si bajamos de 5%
   output_high(rhum);                            // con respecto a la humedad programada,
   if (dhthum>humedad+5.0)                       // o desactivamos la resistencia RH si subimos de 
   output_low(rhum);                             // 5% con respecto a la humedad.
   lcd_gotoxy(1,1);                              // 1ª fila del LCD mostramos el programa de ese dia.
   if (dia>9)
   printf(lcd_putc,"D%u %2.1f%cC %2.0f%% %c"
   ,dia,temperatura,223,humedad,volteo);
   else
   printf(lcd_putc,"D%u %2.1f%cC %2.0f%%  %c"
   ,dia,temperatura,223,humedad,volteo);
   lcd_gotoxy(1,2);                              // 2ª fila del LCD mostramos T y RH medidas.
   printf(lcd_putc,"T=%2.1f%cC H=%2.1f%%"
   //lcd_gotoxy(12,2);
   //printf(lcd_putc,"%2.1f",dhttemp);
   ,t_real,223,dhthum);
   }
   }
}
 
//////////////////////////////////////////////////////
// FUNCION MOSTRAR PARAMETROS EN LCD                //
//////////////////////////////////////////////////////
 
void mostrar(){
      lcd_send_byte(0,0x0f);                     // Activamos cursor y parpadeo en el LCD
      printf(lcd_putc, "\fD  TEMP  HUM  VT\n");
      printf(lcd_putc, "%u %u.%u%cC %u%%  %c"
     ,dia,tent,tdec,0xDF,hum,volteo);
      if (dia>9)                                 // Si dia pasa de un digito a dos desplazamos el 
      masuno=1;                                  // cursor una posicion a la derecha.
      if (cursor == 1 && dia<10)
      lcd_gotoxy(1,2);                           // Cursor en dia.
      if (cursor == 1 && dia>9)
      lcd_gotoxy(2,2);
      if (cursor == 2)
      lcd_gotoxy(4+masuno,2);
      if (cursor == 3)                           // Cursor en la parte entera de temperatura.
      lcd_gotoxy(6+masuno,2);
      if (cursor == 4)                           // Cursor en la parte decimal de temperatura.
      lcd_gotoxy(11+masuno,2);
      if (cursor == 5)                           // Cursor en humedad.
      lcd_gotoxy(15+masuno,2);
      masuno=0;                                  // Cursor en volteo.
      }
 
//////////////////////////////////////////////////////
// FUNCION PARAMETRIZACION DE INCUBACION            //
//////////////////////////////////////////////////////
 
void paramet(){
   while(1){
   if (input(up) == 1 && (cursor == 1)){         // Si pulsamos ARRIBA, el cursor esta en dia y 
   if (dia>1){                                   // llegamos al 1º dia, decrementamos dia, leemos 
   dia--;                                        // parametros correspondientes y mostramos en LCD.
   mem_pos--;
   volteo=read_eeprom(mem_pos);
   mem_pos--;
   hum=read_eeprom(mem_pos);
   mem_pos--;
   tdec=read_eeprom(mem_pos);
   mem_pos--;
   tent=read_eeprom(mem_pos);
   delay_ms(300);
   mostrar();
   }
   }
   if (input(up) == 1 && (cursor == 2)){         // Si pulsamos ARRIBA y el cursor esta en la parte
    if (tent<50)                                 // entera de la temperatura, la aumentamos hasta
    tent++;                                      // los 50ºC y mostramos en LCD.
    delay_ms(300);
    mostrar();
    }
    if (input(up) == 1 && (cursor == 3)){        // Si pulsamos ARRIBA y el cursor esta en la parte
    if (tdec<9)                                  // decimal de la temperatura, la aumentamos hasta
    tdec++;                                      // los 0.9ºC y mostramos en LCD.
    delay_ms(300);
    mostrar();
    }
    if (input(up) == 1 && (cursor == 4)){        // Si pulsamos ARRIBA y el cursor esta en humedad,
    if (hum<95)                                  // la aumentamos hasta el 95% y mostramos en LCD.
    hum+=5;
    delay_ms(300);
    mostrar();
    }
    if (input(up) == 1 && (cursor == 5)){        // Si pulsamos ARRIBA y el cursor esta en volteo,
    volteo='S';                                  // lo activamos y mostramos en LCD.
    delay_ms(300);
    mostrar();
    }
    if (input(down) == 1 && (cursor == 1)){      // Si pulsamos ABAJO, el cursor esta en dia y 
    if (dia<16){                                 // llegamos al 16º dia, incrementamos dia, leemos
   mem_pos+=4;                                   // parametros correspondientes y mostramos en LCD.
    dia++;
   tent=read_eeprom(mem_pos);
   mem_pos++;
   tdec=read_eeprom(mem_pos);
   mem_pos++;
   hum=read_eeprom(mem_pos);
   mem_pos++;
   volteo=read_eeprom(mem_pos);
   mem_pos-=3;
   delay_ms(300);
   mostrar();
   }
   }
   if (input(down) == 1 && (cursor == 2)){       // Si pulsamos ABAJO y el cursor esta en la parte
    if (tent>20)                                 // entera, la disminuimos hasta los 20ºC y mos-
    tent--;                                      // tramos en LCD.
    delay_ms(300);
    mostrar();
    }
    if (input(down) == 1 && (cursor == 3)){      // Si pulsamos ABAJO y el cursor esta en la parte
    if (tdec>0)                                  // decimal, la disminuimos hasta los 0.0ºC y mos-
    tdec--;                                      // tramos en LCD.
    delay_ms(300);
    mostrar();
    }
    if (input(down) == 1 && (cursor == 4)){      // Si pulsamos ABAJO y el cursor esta en humedad,
    if (hum>20)                                  // la disminuimos hasta el 20% y mostramos en LCD.
    hum-=5;
    delay_ms(300);
    mostrar();
    }
    if (input(down) == 1 && (cursor == 5)){      // Si pulsamos ABAJO y el cursor esta en volteo,
    volteo='N';                                  // lo desactivamos y mostramos en LCD.
    delay_ms(300);
    mostrar();
    }
    if (input(right) == 1){                      // Si pulsamos DERECHA movemos el cursor a la 
    if (cursor<5)                                // derecha hasta llegar a volteo.
   cursor++;
   delay_ms(300);
    mostrar();
   }
    if (input(left) == 1){                       // Si pulsamos IZQUIERDA movemos el cursor a la
    if (cursor>1)                                // izquierda hasta llegar a dia.
   cursor--;
   delay_ms(300);
    mostrar();
    }
    if (input(ok) == 1){                         // Si pulsamos OK guardamos los parametros en 
    printf(lcd_putc, "\fGUARDANDO\n");           // eeprom en la posicion de memoria que corres-
    printf(lcd_putc, "DATOS....");               // ponda segun dia y mostramos en LCD.
    write_eeprom(mem_pos,tent);
    mem_pos++;
    write_eeprom(mem_pos,tdec);
    mem_pos++;
    write_eeprom(mem_pos,hum);
    mem_pos++;
    write_eeprom(mem_pos,volteo);
    mem_pos-=3;
    delay_ms(500);
    cursor=1;
   mostrar();
    }
    }
   }
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 45
Ha disminuido su posición en 6 puestos en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

no me declara el int dentro del lcd

Publicado por xve (68 intervenciones) el 30/04/2015 08:06:04
Hola Antonio, el error puede estar en la linea de encima, cuando intentas llamar a la función: lcd_init();

Has probado a declarar primero la variable int y después llamar la función lcd_init() haber si te da el mismo error?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

no me declara el int dentro del lcd

Publicado por antonio (2 intervenciones) el 14/05/2015 05:43:50
ya lo hice,y si resulto ya me quedo terminado el trabajo muchas gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar