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 support@ccsinfo.com

interrupts disabled by compiler

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



Joined: 23 Jul 2006
Posts: 20

View user's profile Send private message

interrupts disabled by compiler
PostPosted: Mon Apr 16, 2007 1:12 am     Reply with quote

Hi,
I am using compiler 4.013.The only interrupt I am using is #int_rda.
The programs compiles sucessfullly but compiler disables the interrupt and show the warning:
" Interrupt disabled during call to prevent re-entrancy: [@DIV88]"
and line no. it shows, dont even exists in the code.Any ideas ?

Code:


#include <lcd.h>
#include <420_lcdd.c>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SIZE 80
#define COMMA 0x2C

#use rs232(baud=4800, xmit=PIN_C6, rcv=PIN_C7, stream=GPS, errors)

void parse();
void rmc();
void gga();
void rmb();
void show();

unsigned char *pChar,LastComaPos;
unsigned int j,k;
unsigned char inStr[SIZE];

float bearing=0.0;
int alt=0;
float latitude,longitude;
float speed=0.0,heading=0.0;
BYTE next_out = 0;
int index=0;
short int sentence;

#INT_RDA
void GPS_isr()
{
   int t;
   char char_rcvd;
   char_rcvd=fgetc(GPS);
   if(char_rcvd=='$')
    {
     index=0;
     sentence=true;
    }
    if((char_rcvd==10)||(char_rcvd==13))
      sentence=false;
if(sentence)
  {
   inStr[index]=char_rcvd;
   t=index;
   index=(index+1) % SIZE;
   if(index==next_out)
     index=t;
  }
}
/*#INT_TIMER0
void timer0_int()
{
   set_timer0(61); // 61 for 20 msec

}*/
void main()
{
   //lcd_init();
   //setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
   enable_interrupts(GLOBAL);
   enable_interrupts(INT_RDA);
   //enable_interrupts(INT_TIMER0);

   while(TRUE)
   {
     parse();
     show();
   }
}
void parse()
{
   if(inStr[0] != '$')
   printf("No Valid Data\n\r");
   // {
     // lcd_putc("\f");
     // lcd_gotoxy(1,1);
     // lcd_putc(" No Data");}
      if(inStr[3]=='R' && inStr[4]=='M' && inStr[5]=='C')
        {
         rmc();
        }
      else if(inStr[3]=='G' && inStr[4]=='G' && inStr[5]=='A')
        {
         gga();
        }
      else if(inStr[3]=='R' && inStr[4]=='M' && inStr[5]=='B')
        {
         rmb();
        }

}
void show()
{    //////////// To Get output on Terminal window uncomment the following ///////////////////
  //set_uart_speed(4800);
  printf("\n\r%3.6f",Latitude);
  printf("\n\r%3.6f",Longitude);
  printf("\n\r%3.2f",speed);
  printf("\n\r%3.2f",bearing);
  printf("\n\r%u",alt);
  printf("\n\r%3.2f",heading);
  getc();

  //////////// To Get output on LCD uncomment the following ///////////////////

  /*lcd_putc("\f");
  lcd_putc(inStr);
  lcd_gotoxy(2,1);
  printf(lcd_putc,"V %3.2f ", speed);
  lcd_gotoxy(8,1);
  printf(lcd_putc, "  BRG %3.2f",bearing);
  lcd_gotoxy(2,2);
  printf(lcd_putc,"\n ALT %3.2f", alt);
  lcd_gotoxy(11,2);
  printf(lcd_putc," HDG %3.2f", heading);
  lcd_gotoxy(2,3);
  printf(lcd_putc,"\n LAT.  %3.6f" ,Latitude);
  lcd_gotoxy(2,4);
  printf(lcd_putc,"\n LONG. %3.6f ",Longitude);*/
}
/////////GGA sentences needed to compute Altidute////////
/// found after 9 commas///////
void gga()
{
   unsigned int comacount,i=0;
   unsigned char altstr[5];

     pChar=inStr;
     k=0;
     comacount=0;
      while(comacount<10)
          {
            if (inStr[i]==COMMA)
                {
                   comacount++;
                   if (comacount==9)
                    {
                      j=i+1;
                      while(*(pChar+j) !=COMMA)
                          {
                           altstr[k]=inStr[j];
                           j++;
                           K++;
                          }
                    }

                }
           i++;
         }
 altstr[k]='\0';
 alt=atof(altstr);
 //printf("Altitude   ");
 //puts(altstr);delay_ms(250);
}

/////////RMB sentences needed to compute True Bearing////////
/// found after 11 commas///////
void rmb()
{
   unsigned int comacount,i=0;
   unsigned char bearstr[5];
     pChar=inStr;
     k=0;
     comacount=0;
      while(comacount<12)
          {
            if (inStr[i]==COMMA)
                {
                   comacount++;
                  if (comacount==11)
                    {
                      j=i+1;
                      while(*(pChar+j) !=COMMA)
                          {
                           bearstr[k]=inStr[j];
                           j++;
                           K++;
                          }
                    }

                }
           i++;
          }
 bearstr[k]='\0';
 bearing=atof(bearstr);
 //printf("\n Bearing   ");
 //printf(lcd_putc,"\n\%f",bearing);
}
void rmc()
   {
   unsigned char latiStr[8];
   unsigned char latiCard[1];
   unsigned char longiStr[9];
   unsigned char longiCard[1];
   unsigned char speedStr[6];
   unsigned char headingStr[6];

   Long  latDegrees;
   float latMin;
   Long  longDegrees;
   float longMin;

     /*Extracht Time*/
     pChar=inStr;
     j=7;
     k=0;
     while(*(pChar+j) !=COMMA)
        {
         //timeStr[k]= *(pChar+j);
    j++;
    k++;
        }
     //timeStr[k]='\0';

// Go to Next comma
 LastComaPos=j;
 pChar=inStr;
 j=LastComaPos+1;
 while(*(pChar+j) !=COMMA)
     {
      j++;
     }
/* Extract Latitude*/
 LastComaPos=j;
 pChar=inStr;
 j=LastComaPos+1;
 k=0;
 while(*(pChar+j) !=COMMA)
    {
     latiStr[k]=*(pChar+j);
     j++;
     k++;
    }
 latiStr[k]='\0';
 latitude = atof(latiStr);

//////////*Extract Latitude Cardinal*//////////////
 LastComaPos=j;
 pChar=inStr;
 j=LastComaPos+1;
 k=0;
 while(*(pChar+j) !=COMMA)
    {
     latiCard[k]=*(pChar+j);
     j++;
     k++;
    }
 latiCard[k]='\0';

 latDegrees = (long)(latitude/100);
 latMin = (float)(latitude-latDegrees*100);
 latMin=latMin/60;
 latitude=latDegrees;
 latitude+=latMin;

/* Extract Longitude*/
 LastComaPos=j;
 pChar=inStr;
 j=LastComaPos+1;
 k=0;
 while(*(pChar+j) !=COMMA)
    {
     longiStr[k]=*(pChar+j);
     j++;
     k++;
    }
 longiStr[k]='\0';

/*Extract Longitude Cardinal*/
 LastComaPos=j;
 pChar=inStr;
 j=LastComaPos+1;
 k=0;
 while(*(pChar+j) !=COMMA)
    {
     longiCard[k]=*(pChar+j);
     j++;
     k++;
    }
 longiCard[k]='\0';
 longitude = atof(longiStr);

 longDegrees = (Long)(longitude/100);
 longMin = (float)(longitude-longDegrees*100);
 longMin=longMin/60;
 longitude=longDegrees;
 longitude+=longMin;

////////////Extract speed///////////
 LastComaPos=j;
 pChar=inStr;
 j=LastComaPos+1;
 k=0;
 while(*(pChar+j) !=COMMA)
    {
     speedStr[k]=*(pChar+j);
     j++;
     k++;
    }
 speedStr[k]='\0';
 speed=atof(speedStr);

////////////Extract Heading////////////////
 LastComaPos=j;
 pChar=inStr;
 j=LastComaPos+1;
 k=0;
 while(*(pChar+j) !=COMMA)
    {
     headingStr[k]=*(pChar+j);
     j++;
     k++;
    }
 headingStr[k]='\0';
 heading=atof(headingStr);
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 16, 2007 1:30 am     Reply with quote

See the example code for using "#org default", near the end of each
of these threads:
http://www.ccsinfo.com/forum/viewtopic.php?t=25464&highlight=math+library
http://www.ccsinfo.com/forum/viewtopic.php?t=30018&highlight=org+default+wishes
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