Autor Tema: Como compactar programa? Maximo nivel de RAM alcanzado.  (Leído 2292 veces)

0 Usuarios y 3 Visitantes están viendo este tema.

Desconectado lopb

  • PIC12
  • **
  • Mensajes: 77
    • contactos lopb
Como compactar programa? Maximo nivel de RAM alcanzado.
« en: 17 de Noviembre de 2010, 10:21:56 »
Hola, estaba haciendo un preliminar y no pude ni terminarlo que ya me quede sin ram.
Tienen idea de como compactarlo? Lo que mas consume son las variables del tipo char hay alguna forma de imprimir en el lcd sin necesidad de llamar a una variable char?

dejo el codigo

gracias
Código: C
  1. #include <16F877A.h>
  2.  
  3. #FUSES NOWDT                    //No Watch Dog Timer
  4. #FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
  5. #FUSES NOPUT                    //No Power Up Timer
  6. #FUSES NOPROTECT                //Code not protected from reading
  7. #FUSES NODEBUG                  //No Debug mode for ICD
  8. #FUSES NOBROWNOUT               //No brownout reset
  9. #FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
  10. #FUSES NOCPD                    //No EE protection
  11. #FUSES NOWRT                    //Program memory not write protected
  12.  
  13. #use delay(clock=20000000)
  14.  
  15. #include "HDM64GS12_scanbang.c"
  16. #include "C:\Program Files\PICC\Drivers\graphics.c"
  17. #include "C:\Program Files\PICC\Drivers\math.h"
  18. #include "24256.c"
  19.  
  20.  
  21. int m;
  22. float SensorY0, SensorY1, SensorY2, SensorY3, SensorY4, SensorY5, SensorY6, SensorY7;
  23.  
  24.  
  25. char CharY0[5] = "0.0";
  26. char CharY1[5] = "0.0";
  27. char CharY2[5] = "0.0";
  28. char CharY3[5] = "0.0";
  29.  
  30. short int dbutton4, dbutton5, dbutton6, dbutton7;
  31.  
  32. float read_analog(int a);
  33.  
  34.  
  35. void start(){
  36.  
  37.         char Empresa[10] = "PRESENTACION";
  38.         char Desc[16] = "bla bla";
  39.         glcd_text57(0, 0, Empresa, 2, ON);
  40.         glcd_text57(0, 20, Desc, 2, ON);
  41. }
  42. void Pantalla_1(){
  43.  
  44.  
  45.         extern float SensorY0, SensorY1, SensorY2, SensorY3, SensorY4, SensorY5, SensorY6, SensorY7;
  46.         extern float read_analog(int a);
  47.  
  48.         extern char CharY0[];
  49.         extern char CharY1[];
  50.         extern char CharY2[];
  51.         extern char CharY3[];
  52.  
  53.         char TempEXT[20] = "Temp. Externa:";
  54.         char TempMOT[20] = "Temp. Motor:";
  55.         char TempALT[20] = "Temp. Alternad:";
  56.         char TempINT[20] = "Temp. Interna:";
  57.  
  58.         glcd_text57(0, 10, TempEXT, 1, ON);
  59.         glcd_text57(0, 20, TempMOT, 1, ON);
  60.         glcd_text57(0, 30, TempALT, 1, ON);
  61.         glcd_text57(0, 40, TempINT, 1, ON);
  62.  
  63.         SensorY0 =      read_analog(0) * (5.0 * 100.0 / 1024.0);
  64.         SensorY1 =      read_analog(1) * (5.0 * 100.0 / 1024.0);
  65.         SensorY2 =      read_analog(2) * (5.0 * 100.0 / 1024.0);
  66.         SensorY3 =      read_analog(3) * (5.0 * 100.0 / 1024.0);
  67.  
  68.         glcd_text57(95, 10, CharY0, 1, OFF);
  69.         sprintf(CharY0,"%2.1f",SensorY0);
  70.         glcd_text57(95, 10, CharY0, 1, ON);
  71.  
  72.         glcd_text57(95, 20, CharY1, 1, OFF);
  73.         sprintf(CharY1,"%2.1f",SensorY1);
  74.         glcd_text57(95, 20, CharY1, 1, ON);
  75.  
  76.         glcd_text57(95, 30, CharY2, 1, OFF);
  77.         sprintf(CharY2,"%2.1f",SensorY2);
  78.         glcd_text57(95, 30, CharY2, 1, ON);
  79.  
  80.         glcd_text57(95, 40, CharY3, 1, OFF);
  81.         sprintf(CharY3,"%2.1f",SensorY3);
  82.         glcd_text57(95, 40, CharY3, 1, ON);
  83.  
  84.        
  85. }
  86. int menu(int p){
  87. char Menu[27] = "TEMP | GRUPO | MONIT | --";
  88. if (p == 0){
  89.         glcd_rect(0, 54, 127, 63, YES, ON);
  90.         glcd_line(0,63,30,63,ON);
  91.         glcd_text57(0, 55, Menu, 1, OFF);
  92.         return(0);
  93.         }
  94. if (p == 1){
  95.         glcd_rect(0, 54, 127, 63, YES, ON);
  96.         glcd_line(30,63,70,63,ON);
  97.         glcd_text57(0, 55, Menu, 1, OFF);
  98.         return(1);
  99.         }
  100. if (p == 10){
  101.         glcd_rect(0, 54, 127, 63, YES, ON);
  102.         glcd_line(70,63,110,63,ON);
  103.         glcd_text57(0, 55, Menu, 1, OFF);
  104.         return(10);
  105.         }      
  106. }
  107. float read_analog(int a)
  108. {
  109.         float ADC_Value;
  110.  
  111. if (a == 0){
  112.         output_low(PIN_A1);
  113.         output_low(PIN_A2);
  114.         output_low(PIN_A3);
  115.         }
  116. if (a == 1){
  117.         output_high(PIN_A1);
  118.         output_low(PIN_A2);
  119.         output_low(PIN_A3);
  120.  
  121.         }
  122. if (a == 2){
  123.         output_low(PIN_A1);
  124.         output_high(PIN_A2);
  125.         output_low(PIN_A3);
  126.        
  127.         }
  128. if (a == 3){
  129.         output_high(PIN_A1);
  130.         output_high(PIN_A2);
  131.         output_low(PIN_A3);
  132.      
  133.         }
  134. if (a == 4){
  135.         output_low(PIN_A1);
  136.         output_low(PIN_A2);
  137.         output_high(PIN_A3);
  138.      
  139.         }
  140. if (a == 5){
  141.         output_high(PIN_A1);
  142.         output_low(PIN_A2);
  143.         output_high(PIN_A3);
  144.      
  145.         }
  146. if (a == 6){
  147.         output_low(PIN_A1);
  148.         output_high(PIN_A2);
  149.         output_high(PIN_A3);
  150.      
  151.         }
  152. if (a == 7){
  153.         output_high(PIN_A1);
  154.         output_high(PIN_A2);
  155.         output_high(PIN_A3);
  156.         }
  157.         delay_ms(100);
  158.         set_adc_channel (0); //Elige canal a medir RA0
  159.         delay_us (20);
  160.         ADC_Value=read_adc(); //Capturamos señal analógica que entra por el canal previamente seleccionado (RA0)
  161.      
  162. return(ADC_Value);
  163. }
  164.  
  165. #int_rb
  166. void test_detect_rb_change() {
  167.    
  168.  
  169.    set_tris_b(0xF0);
  170.    //current=input_b();
  171.  
  172.         if (input(PIN_B4)) {dbutton4=1;}
  173.         else {dbutton4=0;}
  174.  
  175. }
  176. void clear_delta() {
  177.    dbutton4=0;
  178.    dbutton5=0;
  179.    dbutton6=0;
  180.    dbutton7=0;
  181. }
  182.  
  183. void main(void)
  184. {
  185.         m = 0;
  186.         clear_delta();
  187.  
  188.    enable_interrupts(INT_RB);
  189.    enable_interrupts(GLOBAL);                                  
  190.  
  191.         glcd_init(ON);   // iniciamos la lcd
  192.         glcd_fillScreen(OFF); //LIMPIAMOS LA PANTALLA
  193.         delay_ms(100);
  194.         start();
  195.         delay_ms(2000);
  196.         glcd_fillScreen(OFF); //LIMPIAMOS LA PANTALLA
  197.  
  198.    setup_adc_ports(RA0_ANALOG);
  199.    setup_adc(ADC_CLOCK_INTERNAL);
  200.    setup_spi(SPI_SS_DISABLED);
  201.    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
  202.    setup_timer_1(T1_DISABLED);
  203.    setup_timer_2(T2_DISABLED,0,1);
  204.    setup_ccp1(CCP_OFF);
  205.    setup_comparator(NC_NC_NC_NC);
  206.    setup_vref(FALSE);
  207.  
  208.  
  209.         set_tris_a(0xEF);
  210.    while (TRUE)
  211.    {
  212.         if(dbutton4) {
  213.                 delay_ms(15);
  214.                 if(dbutton4) {
  215.                                 if (m == 1)     {m = menu(10);}
  216.                                 else if (m == 10) {m = menu(0);}
  217.                                         else
  218.                                                 m = menu(1);
  219.                                
  220.                                 }
  221.                 }
  222.         else if(!dbutton4){
  223.                 delay_ms(20);
  224.                 if(!dbutton4) {
  225.                         //printf("nothing");
  226.                         }
  227.                 }                      
  228.  
  229.  
  230.                                
  231.         delay_ms(100);
  232.         Pantalla_1();
  233.  
  234.  
  235.         }
  236.                
  237. }

Desconectado migsantiago

  • Colaborador
  • DsPIC33
  • *****
  • Mensajes: 8257
    • Sitio de MigSantiago
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #1 en: 17 de Noviembre de 2010, 10:24:56 »
Hola, usa const chars y los datos se guardarán en ROM.

Desconectado djdapinrmx

  • PIC10
  • *
  • Mensajes: 6
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #2 en: 17 de Noviembre de 2010, 11:28:12 »
Usa define.

Desconectado Suky

  • Moderador Local
  • DsPIC33
  • *****
  • Mensajes: 6758
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #3 en: 17 de Noviembre de 2010, 13:16:46 »
Usa un solo Buffer para formatear a string mediante sprintf. ¿Para crear varios?
No contesto mensajes privados, las consultas en el foro

Desconectado cristian_elect

  • PIC18
  • ****
  • Mensajes: 453
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #4 en: 17 de Noviembre de 2010, 13:21:39 »
En los atmega tambien me faltaba RAM las variable que no cambia lo declare como tipo flash.
Las variable de tipo const tambien me consume memoria eso pasa en los compilador c para atmel.

Desconectado Suky

  • Moderador Local
  • DsPIC33
  • *****
  • Mensajes: 6758
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #5 en: 17 de Noviembre de 2010, 13:53:08 »
Las variable de tipo const tambien me consume memoria eso pasa en los compilador c para atmel.

Exacto, pasa en los atmel... En CCS solo alcanza con colocar const.
No contesto mensajes privados, las consultas en el foro

Desconectado lopb

  • PIC12
  • **
  • Mensajes: 77
    • contactos lopb
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #6 en: 17 de Noviembre de 2010, 14:05:51 »
Las variable de tipo const tambien me consume memoria eso pasa en los compilador c para atmel.

Exacto, pasa en los atmel... En CCS solo alcanza con colocar const.
ya solucione el problema de la ram... estoy usando un solo arreglo llamado Texto[30]
y luego lo llamo de las funciones internas

Ahora el problema ahora es que exepto en una funcion en particular, cuando cambio el valor de texto no se graba bien y se imprime basura
estoy poniendole datos asi
Texto = "algun texto";
y luego se lo mando a glcd_text. pero me imprime basura, tienen idea porque?
pongo el codigo?
« Última modificación: 17 de Noviembre de 2010, 14:19:36 por lopb »

Desconectado lopb

  • PIC12
  • **
  • Mensajes: 77
    • contactos lopb
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #7 en: 17 de Noviembre de 2010, 14:33:34 »
hola, a ver si pueden darme una mano. Me esta escribiendo basura sobre texto en la funcion welcome.
En la funcion pantalla_1 anda bien. Imprime perfecto, no entiendo porque. Pasa lo mismo que imprime mal en la funcion menu.
No veo diferencia entre pantalla_1 y menu, wellcome.

Me gustaria debuguearlo, pero el mplab sim me tira un error.
Código: C
  1. #include <16F877A.h>
  2.  
  3. #FUSES NOWDT                    //No Watch Dog Timer
  4. #FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
  5. #FUSES NOPUT                    //No Power Up Timer
  6. #FUSES NOPROTECT                //Code not protected from reading
  7. #FUSES NODEBUG                  //No Debug mode for ICD
  8. #FUSES NOBROWNOUT               //No brownout reset
  9. #FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
  10. #FUSES NOCPD                    //No EE protection
  11. #FUSES NOWRT                    //Program memory not write protected
  12.  
  13. #use delay(clock=20000000)
  14.  
  15. #include "HDM64GS12_scanbang.c"
  16. #include "C:\Program Files\PICC\Drivers\graphics.c"
  17. #include "C:\Program Files\PICC\Drivers\math.h"
  18. #include "24256.c"
  19.  
  20.  
  21. int m;
  22. float Values;
  23. char Texto[30] ;
  24. short int dbutton4, dbutton5, dbutton6, dbutton7;
  25.  
  26. float read_analog(int a);
  27.  
  28.  
  29. void welcome(void){
  30.  
  31.         extern char Texto[];
  32.         delay_ms(50);
  33.         Texto = "Empresa";
  34.         glcd_text57(0, 0, Texto, 2, ON);
  35.         Texto = "ELECTRONIC";
  36.         glcd_text57(0, 20, Texto, 2, ON);
  37. }
  38. void Pantalla_1(){
  39.  
  40.  
  41.         extern float Values;
  42.         extern float read_analog(int a);
  43.         extern char Texto[];
  44.  
  45.         Texto = "Temp. Externa:";
  46.         glcd_text57(0, 10, Texto, 1, ON);
  47.         Texto = "Temp. Motor";
  48.         glcd_text57(0, 20, Texto, 1, ON);
  49.         Texto = "Temp. Alternad:";
  50.         glcd_text57(0, 30, Texto, 1, ON);
  51.         Texto = "Temp. Interna:";
  52.         glcd_text57(0, 40, Texto, 1, ON);
  53.  
  54.         Values =        read_analog(0) * (5.0 * 100.0 / 1024.0);
  55.         sprintf(Texto,"%2.1f",Values);
  56.         glcd_rect(95, 17, 127, 10, YES, OFF);
  57.         glcd_text57(95, 10, Texto, 1, ON);
  58.        
  59.         Values =        read_analog(1) * (5.0 * 100.0 / 1024.0);
  60.         sprintf(Texto,"%2.1f",Values);
  61.         glcd_rect(95, 27, 127, 20, YES, OFF);
  62.         glcd_text57(95, 20, Texto, 1, ON);
  63.  
  64.         Values =        read_analog(2) * (5.0 * 100.0 / 1024.0);
  65.         sprintf(Texto,"%2.1f",Values);
  66.         glcd_rect(95, 37, 127, 30, YES, OFF);
  67.         glcd_text57(95, 30, Texto, 1, ON);
  68.  
  69.         Values =        read_analog(3) * (5.0 * 100.0 / 1024.0);
  70.         sprintf(Texto,"%2.1f",Values);
  71.         glcd_rect(95, 47, 127, 40, YES, OFF);
  72.         glcd_text57(95, 40, Texto, 1, ON);
  73.  
  74.        
  75. }
  76. int menu(int p){
  77. extern char texto[];
  78. Texto = "TEMP | GRUPO | MONIT";
  79. if (p == 0){
  80.         glcd_rect(25, 54, 127, 63, YES, ON);
  81.         glcd_text57(0, 55, Texto, 1, OFF);
  82.         Texto = "TEMP";
  83.         glcd_text57(0, 55, Texto, 1, ON);
  84.         return(0);
  85.         }
  86. if (p == 1){
  87.         glcd_rect(0, 54, 25, 63, YES, ON);
  88.         glcd_rect(65, 54, 127, 63, YES, ON);
  89.         glcd_text57(0, 55, Texto, 1, OFF);
  90.         return(1);
  91.         }
  92. if (p == 10){
  93.         glcd_rect(0, 54, 65, 63, YES, ON);
  94.         glcd_text57(0, 55, Texto, 1, OFF);
  95.         return(10);
  96.         }      
  97. }
  98. float read_analog(int a)
  99. {
  100.         float ADC_Value;
  101.  
  102. if (a == 0){
  103.         output_low(PIN_A1);
  104.         output_low(PIN_A2);
  105.         output_low(PIN_A3);
  106.         }
  107. if (a == 1){
  108.         output_high(PIN_A1);
  109.         output_low(PIN_A2);
  110.         output_low(PIN_A3);
  111.  
  112.         }
  113. if (a == 2){
  114.         output_low(PIN_A1);
  115.         output_high(PIN_A2);
  116.         output_low(PIN_A3);
  117.        
  118.         }
  119. if (a == 3){
  120.         output_high(PIN_A1);
  121.         output_high(PIN_A2);
  122.         output_low(PIN_A3);
  123.      
  124.         }
  125. if (a == 4){
  126.         output_low(PIN_A1);
  127.         output_low(PIN_A2);
  128.         output_high(PIN_A3);
  129.      
  130.         }
  131. if (a == 5){
  132.         output_high(PIN_A1);
  133.         output_low(PIN_A2);
  134.         output_high(PIN_A3);
  135.      
  136.         }
  137. if (a == 6){
  138.         output_low(PIN_A1);
  139.         output_high(PIN_A2);
  140.         output_high(PIN_A3);
  141.      
  142.         }
  143. if (a == 7){
  144.         output_high(PIN_A1);
  145.         output_high(PIN_A2);
  146.         output_high(PIN_A3);
  147.         }
  148.        
  149.         delay_ms(100);
  150.         set_adc_channel (0); //Elige canal a medir RA0
  151.         delay_us (20);
  152.         ADC_Value=read_adc(); //Capturamos señal analógica que entra por el canal previamente seleccionado (RA0)
  153.  
  154.              
  155. return(ADC_Value);
  156. }
  157.  
  158. #int_rb
  159. void test_detect_rb_change() {
  160.    
  161.  
  162.    set_tris_b(0xF0);
  163.    //current=input_b();
  164.  
  165.         if (input(PIN_B4)) {dbutton4=1;}
  166.         else {dbutton4=0;}
  167.  
  168. }
  169. void clear_delta() {
  170.    dbutton4=0;
  171.    dbutton5=0;
  172.    dbutton6=0;
  173.    dbutton7=0;
  174. }
  175.  
  176. void main(void)
  177. {
  178.         m = 0;
  179.         clear_delta();
  180.  
  181.    enable_interrupts(INT_RB);
  182.    enable_interrupts(GLOBAL);                                  
  183.  
  184.         glcd_init(ON);   // iniciamos la lcd
  185.         glcd_fillScreen(OFF); //LIMPIAMOS LA PANTALLA
  186.         delay_ms(200);
  187.         welcome();
  188.         delay_ms(2000);
  189.         glcd_fillScreen(OFF); //LIMPIAMOS LA PANTALLA
  190.    setup_adc_ports(RA0_ANALOG);
  191.    setup_adc(ADC_CLOCK_INTERNAL);
  192.    setup_spi(SPI_SS_DISABLED);
  193.    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
  194.    setup_timer_1(T1_DISABLED);
  195.    setup_timer_2(T2_DISABLED,0,1);
  196.    setup_ccp1(CCP_OFF);
  197.    setup_comparator(NC_NC_NC_NC);
  198.    setup_vref(FALSE);
  199.  
  200.  
  201.         set_tris_a(0xEF);
  202.    while (TRUE)
  203.    {
  204.         if(dbutton4) {
  205.                 delay_ms(15);
  206.                 if(dbutton4) {
  207.                                 if (m == 1)     {m = menu(10);}
  208.                                 else if (m == 10) {m = menu(0);}
  209.                                         else
  210.                                                 m = menu(1);
  211.                                
  212.                                 }
  213.                 }
  214.         else if(!dbutton4){
  215.                 delay_ms(20);
  216.                 if(!dbutton4) {
  217.                         //printf("nothing");
  218.                         }
  219.                 }                      
  220.  
  221.  
  222.                                
  223.         delay_ms(500);
  224.         Pantalla_1();
  225.  
  226.  
  227.         }
  228.                
  229. }
PD. Hace muy poco empece con c y no conozco el lenguage entero.
Por ejemplo, veran que hay muchos if cuando podria usar case jaja :(
« Última modificación: 17 de Noviembre de 2010, 14:36:28 por lopb »

Desconectado bmfranky

  • PIC16
  • ***
  • Mensajes: 165
    • La Tienda De Fran
Re: Como compactar programa? Maximo nivel de RAM alcanzado.
« Respuesta #8 en: 17 de Noviembre de 2010, 15:32:22 »
Hola lopb, porque defines tantas veces la variable texto? , pon una solo al principio del archivo y prueba el resultado.

Citar
   1.
      #include <16F877A.h>
   2.
       
   3.
      #FUSES NOWDT                    //No Watch Dog Timer
   4.
      #FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
   5.
      #FUSES NOPUT                    //No Power Up Timer
   6.
      #FUSES NOPROTECT                //Code not protected from reading
   7.
      #FUSES NODEBUG                  //No Debug mode for ICD
   8.
      #FUSES NOBROWNOUT               //No brownout reset
   9.
      #FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
  10.
      #FUSES NOCPD                    //No EE protection
  11.
      #FUSES NOWRT                    //Program memory not write protected
  12.
       
  13.
      #use delay(clock=20000000)
  14.
       
  15.
      #include "HDM64GS12_scanbang.c"
  16.
      #include "C:\Program Files\PICC\Drivers\graphics.c"
  17.
      #include "C:\Program Files\PICC\Drivers\math.h"
  18.
      #include "24256.c"
  19.
       
  20.
       
  21.
      int m;
  22.
      float Values;
  23.
      char Texto[30] ;
  24.
      short int dbutton4, dbutton5, dbutton6, dbutton7;
  25.
       
  26.
      float read_analog(int a);
  27.
       
  28.
       
  29.
      void welcome(void){
  30.
       
  31.
      extern char Texto[];//<-esta sobra, ya la definiste al principio,
  32.
      delay_ms(50);
  33.
      Texto = "Empresa";
  34.
      glcd_text57(0, 0, Texto, 2, ON);
  35.
      Texto = "ELECTRONIC";
  36.
      glcd_text57(0, 20, Texto, 2, ON);
  37.
      }
  38.
      void Pantalla_1(){
  39.
       
  40.
       
  41.
      extern float Values;
  42.
      extern float read_analog(int a);
  43.
      extern char Texto[];//<-idem sobra
  44.
       
  45.
      Texto = "Temp. Externa:";
  46.
      glcd_text57(0, 10, Texto, 1, ON);
  47.
      Texto = "Temp. Motor";
  48.
      glcd_text57(0, 20, Texto, 1, ON);
  49.
      Texto = "Temp. Alternad:";
  50.
      glcd_text57(0, 30, Texto, 1, ON);
  51.
      Texto = "Temp. Interna:";
  52.
      glcd_text57(0, 40, Texto, 1, ON);
  53.
       
  54.
      Values = read_analog(0) * (5.0 * 100.0 / 1024.0);
  55.
      sprintf(Texto,"%2.1f",Values);
  56.
      glcd_rect(95, 17, 127, 10, YES, OFF);
  57.
      glcd_text57(95, 10, Texto, 1, ON);
  58.
  59.
      Values = read_analog(1) * (5.0 * 100.0 / 1024.0);
  60.
      sprintf(Texto,"%2.1f",Values);
  61.
      glcd_rect(95, 27, 127, 20, YES, OFF);
  62.
      glcd_text57(95, 20, Texto, 1, ON);
  63.
       
  64.
      Values = read_analog(2) * (5.0 * 100.0 / 1024.0);
  65.
      sprintf(Texto,"%2.1f",Values);
  66.
      glcd_rect(95, 37, 127, 30, YES, OFF);
  67.
      glcd_text57(95, 30, Texto, 1, ON);
  68.
       
  69.
      Values = read_analog(3) * (5.0 * 100.0 / 1024.0);
  70.
      sprintf(Texto,"%2.1f",Values);
  71.
      glcd_rect(95, 47, 127, 40, YES, OFF);
  72.
      glcd_text57(95, 40, Texto, 1, ON);
  73.
       
  74.
  75.
      }
  76.
      int menu(int p){
  77.
      extern char texto[];// Y otra vez
  78.
      Texto = "TEMP | GRUPO | MONIT";
  79.
      if (p == 0){
  80.
      glcd_rect(25, 54, 127, 63, YES, ON);
  81.
      glcd_text57(0, 55, Texto, 1, OFF);
  82.
      Texto = "TEMP";
  83.
      glcd_text57(0, 55, Texto, 1, ON);
  84.
      return(0);
  85.
      }
  86.
      if (p == 1){
  87.
      glcd_rect(0, 54, 25, 63, YES, ON);
  88.
      glcd_rect(65, 54, 127, 63, YES, ON);
  89.
      glcd_text57(0, 55, Texto, 1, OFF);
  90.
      return(1);
  91.
      }
  92.
      if (p == 10){
  93.
      glcd_rect(0, 54, 65, 63, YES, ON);
  94.
      glcd_text57(0, 55, Texto, 1, OFF);
  95.
      return(10);
  96.
      }
  97.
      }
  98.
      float read_analog(int a)
  99.
      {
 100.
      float ADC_Value;
 101.
       
 102.
      if (a == 0){
 103.
      output_low(PIN_A1);
 104.
      output_low(PIN_A2);
 105.
      output_low(PIN_A3);
 106.
            }
 107.
      if (a == 1){
 108.
      output_high(PIN_A1);
 109.
      output_low(PIN_A2);
 110.
      output_low(PIN_A3);
 111.
       
 112.
      }
 113.
      if (a == 2){
 114.
      output_low(PIN_A1);
 115.
      output_high(PIN_A2);
 116.
      output_low(PIN_A3);
 117.
           
 118.
      }
 119.
      if (a == 3){
 120.
      output_high(PIN_A1);
 121.
      output_high(PIN_A2);
 122.
      output_low(PIN_A3);
 123.
           
 124.
      }
 125.
      if (a == 4){
 126.
      output_low(PIN_A1);
 127.
      output_low(PIN_A2);
 128.
      output_high(PIN_A3);
 129.
           
 130.
      }
 131.
      if (a == 5){
 132.
      output_high(PIN_A1);
 133.
      output_low(PIN_A2);
 134.
      output_high(PIN_A3);
 135.
           
 136.
      }
 137.
      if (a == 6){
 138.
      output_low(PIN_A1);
 139.
      output_high(PIN_A2);
 140.
      output_high(PIN_A3);
 141.
           
 142.
      }
 143.
      if (a == 7){
 144.
      output_high(PIN_A1);
 145.
      output_high(PIN_A2);
 146.
      output_high(PIN_A3);
 147.
      }
 148.
 149.
      delay_ms(100);
 150.
      set_adc_channel (0); //Elige canal a medir RA0
 151.
        delay_us (20);
 152.
        ADC_Value=read_adc(); //Capturamos señal analógica que entra por el canal previamente seleccionado (RA0)
 153.
       
 154.
           
 155.
      return(ADC_Value);
 156.
      }
 157.
       
 158.
      #int_rb
 159.
      void test_detect_rb_change() {
 160.
       
 161.
       
 162.
        set_tris_b(0xF0);
 163.
        //current=input_b();
 164.
       
 165.
        if (input(PIN_B4)) {dbutton4=1;}
 166.
      else {dbutton4=0;}
 167.
       
 168.
      }
 169.
      void clear_delta() {
 170.
        dbutton4=0;
 171.
        dbutton5=0;
 172.
        dbutton6=0;
 173.
        dbutton7=0;
 174.
      }
 175.
       
 176.
      void main(void)
 177.
      {
 178.
      m = 0;
 179.
      clear_delta();
 180.
       
 181.
        enable_interrupts(INT_RB);
 182.
        enable_interrupts(GLOBAL);
 183.
       
 184.
      glcd_init(ON);   // iniciamos la lcd
 185.
      glcd_fillScreen(OFF); //LIMPIAMOS LA PANTALLA
 186.
      delay_ms(200);
 187.
      welcome();
 188.
      delay_ms(2000);
 189.
      glcd_fillScreen(OFF); //LIMPIAMOS LA PANTALLA
 190.
        setup_adc_ports(RA0_ANALOG);
 191.
        setup_adc(ADC_CLOCK_INTERNAL);
 192.
        setup_spi(SPI_SS_DISABLED);
 193.
        setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
 194.
        setup_timer_1(T1_DISABLED);
 195.
        setup_timer_2(T2_DISABLED,0,1);
 196.
        setup_ccp1(CCP_OFF);
 197.
        setup_comparator(NC_NC_NC_NC);
 198.
        setup_vref(FALSE);
 199.
       
 200.
       
 201.
      set_tris_a(0xEF);
 202.
        while (TRUE)
 203.
        {
 204.
      if(dbutton4) {
 205.
      delay_ms(15);
 206.
      if(dbutton4) {
 207.
      if (m == 1) {m = menu(10);}
 208.
      else if (m == 10) {m = menu(0);}
 209.
      else
 210.
      m = menu(1);
 211.
 212.
      }
 213.
      }
 214.
      else if(!dbutton4){
 215.
      delay_ms(20);
 216.
      if(!dbutton4) {
 217.
      //printf("nothing");
 218.
      }
 219.
      }
 220.
       
 221.
       
 222.
 223.
        delay_ms(500);
 224.
      Pantalla_1();
 225.
       
 226.
       
 227.
      }
 228.
 229.
      }
prueba a quitarlos a ver si ya no te da error.

Por cierto , puedes adjuntar el archivo C , para que lo compilemos a ver que errores da...
Visiten La Tienda De Fran ;-) Aqui. y mi nueva Web Aqui.