CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Internal Error when using printf and lcd_putc

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MegatroniC



Joined: 08 Dec 2009
Posts: 35

View user's profile Send private message ICQ Number

Internal Error when using printf and lcd_putc
PostPosted: Thu Jun 30, 2011 10:20 am     Reply with quote

Please for help,
in this subroutine I get the following error when compiling:

Error 44 "main.c" Line 269(1,1), internal error - Contact CCS LABEL SCR=1677

LCD Driver http://www.ccsinfo.com/forum/viewtopic.php?t=24661&highlight=lcd
SWITCHES - http://www.ccsinfo.com/forum/viewtopic.php?t=22145&highlight=button

subroutine




Code:

void main_menu(void)                                                           
{
 int1 exit=0;
 int8 menu_marker=0;
 
 lcd_gotoxy(1,1);
 lcd_putc("Setting \n");
 lcd_putc(" times  ");
 delay_ms(1500);
 
 lcd_putc("\f");       
                         
 do{
    switch(menu_marker){
     
      case 0: lcd_gotoxy(1,1);                                                         
              lcd_putc("Time 1i\n");
              printf(lcd_putc, "%3d sec", time1);        //line 269
              delay_ms(30);
              while(!scroll_click && !set_click);
              if(set_click) {incrdecr1(time1,59,1,1,2,2); write_eeprom(0,time1); menu_marker=0;}
               else if(scroll_click) menu_marker=1;
        break; 
       
     case 1: lcd_gotoxy(1,1);                                                       
             lcd_putc("Time 1p\n");           
             printf(lcd_putc, "%3d sec", time1p);
             delay_ms(30);
             while(!scroll_click && !set_click);
             if(set_click) {incrdecr1(time1p,59,1,1,2,2); write_eeprom(1,time1p); menu_marker=1;}
              else if(scroll_click) menu_marker=2;
       break;
       
     case 2: lcd_gotoxy(1,1);                     
             lcd_putc("Time 2i\n");
             printf(lcd_putc, "%3d sec", time2);
             delay_ms(30);
             while(!scroll_click && !set_click);
             if(set_click) {incrdecr1(time2,59,1,1,2,2); write_eeprom(2,time2); menu_marker=2;}
              else if(scroll_click) menu_marker=3;
       break;
       
     case 3: lcd_gotoxy(1,1);                                                             
             lcd_putc("Time 2p\n");
             printf(lcd_putc, "%3d sec", time2p);
             delay_ms(30);               
             while(!scroll_click && !set_click);
             if(set_click) {incrdecr1(time2p,59,1,1,2,2); write_eeprom(3,time2p); menu_marker=3;}
              else if(scroll_click) menu_marker=4;
             
       break;
       
     case 4: lcd_gotoxy(1,1);                                     
             lcd_putc("Time 3i\n");           
             printf(lcd_putc, "%3d min", time3);
             delay_ms(30);           
             while(!scroll_click && !set_click);
             if(set_click) {incrdecr1(time3,59,1,1,2,2); write_eeprom(4,time3); menu_marker=4;} 
              else if(scroll_click) menu_marker=5; 
       break;     
    }             
     
    if(scroll_click && menu_marker==5)                                           
     {menu_marker=0;
      lcd_gotoxy(1,1);
      lcd_putc(" Exit? \n");
      lcd_putc("push set");
      delay_ms(30);
      while(!scroll_click && !set_click);
      if(set_click) exit=1;
      else exit=0;
     }
     
   }While(!exit);
    lcd_gotoxy(1,1);
    lcd_putc("  Save  \n");
    lcd_putc("settings");
    delay_ms(2000);
    read_store_value_and_start();                             
    enable_interrupts(INT_TIMER0); 
}


The error appears on lines with lcd_putc and printf, I think it gets in conflict with lcd_gotoxy(1,1) and \n, but it exists and where the use lcd_goto(1,2) instead of \n.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 30, 2011 11:30 am     Reply with quote

Post your PIC and #fuses and #use delay(), and your compiler version
so a test program can be made.
MegatroniC



Joined: 08 Dec 2009
Posts: 35

View user's profile Send private message ICQ Number

PostPosted: Thu Jun 30, 2011 11:54 am     Reply with quote

Compiler version 4.114

Code:
#include <18F2520.h>
#device adc=8
#OPT 11                         //Optimization level

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT8192                  //Watch Dog Timer 30s
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES PROTECT                  //Code protected from reads
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES BORV20                   //Brownout reset at 2.0V
#FUSES PUT                      //Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES NOSTVREN                 //Stack full/underflow will not cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES NOPBADEN                 //PORTB pins are configured as digital I/O on RESET
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOLPT1OSC                //Timer1 configured for higher power operation
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)

#use delay(clock=4MHz)


Not for the first time using such a short menu, but my first time going to an error. Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 30, 2011 12:50 pm     Reply with quote

I put together a test program and I am getting the Internal Error message.
I'll look at it and see if I can find the problem.
MegatroniC



Joined: 08 Dec 2009
Posts: 35

View user's profile Send private message ICQ Number

PostPosted: Thu Jun 30, 2011 1:32 pm     Reply with quote

Thank you very much for your attention.
Still learning and I will be interested to know if the problem is me.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 30, 2011 1:48 pm     Reply with quote

Quote:
#include <18F2520.h>
#device adc=8
// #OPT 11 //Optimization level


BUILD SUCCEEDED: Thu Jun 30 12:49:43 2011

The error message disappears if I comment out the #opt 11, which is
sort of to be expected. My basic rule is "don't push the compiler".
MegatroniC



Joined: 08 Dec 2009
Posts: 35

View user's profile Send private message ICQ Number

PostPosted: Thu Jun 30, 2011 3:02 pm     Reply with quote

So I wrote the code that is not efficient enough to be optimized ... Is this supposed to mean?
Thanks for the advice PCM programmer!
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Jun 30, 2011 3:11 pm     Reply with quote

NO, it means what he said. Don't push the limits of the compiler". If you
want that kind of optimization go buy the $1800 compiler.

Any compiler is going to have problems if you try to push the amount of
optimization to the extreme. Unless you are a professional programmer
writing critical code you very likely don't need it anyway. If you are a
student you certainly do not. If you want more optimization then code in
assembly..

My apologies for jumping in PCM, I just couldn't let this lie...
_________________
Google and Forum Search are some of your best tools!!!!
MegatroniC



Joined: 08 Dec 2009
Posts: 35

View user's profile Send private message ICQ Number

PostPosted: Thu Jun 30, 2011 3:33 pm     Reply with quote

I am not a student anymore. Smile
I am interested in programming, and teach myself as far as I can.


Thank you all.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group