Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 25, 2024, 12:36:58 00:36


Login with username, password and session length


Pages: [1]
Print
Author Topic: help:warning with conditional preprocessor directive  (Read 3243 times)
0 Members and 1 Guest are viewing this topic.
jeniusj
Junior Member
**
Offline Offline

Posts: 38

Thank You
-Given: 11
-Receive: 7


« on: June 12, 2008, 03:27:45 15:27 »

I have the following code to interface the NS-45/P inclinometer to interface with Atmega48 and I am using IMAGECRAFT ICCAVR but on conditional compilation (I am using conditional compilation to test my code on Hyyperterminal as well i.e. I have two testing modes "Debug" mode in which I am receiving data on Hyper-terminal and release mode through I have I am receiving data through controller)I have got the following warnings which I cant understand:
!W .\TEST002..c(6): extra token "RELEASE" in preprocessor directive
!W .\TEST002..c(51): extra token "DEBUG" in preprocessor directive
!W .\TEST002..c(92): extra token "DEBUG" in preprocessor directive
!W .\TEST002..c(96): extra token "RELEASE" in preprocessor directive
C:\PROGRA~1\iccv7avr\bin\imakew -f TEST002.mak
    iccavr -o TEST002 -g -e:0x1000 -bfunc_lit:0x34.0x1000 -dram_end:0x2ff -bdata:0x100.0x2ff -dhwstk_size:30 -beeprom:0.256 -fihx_coff -S2 @TEST002.lk   -lcatmega
Device 21% full.
Done. Thu Jun 12 20:24:35 2008

My Code is as Follows:

#include <iom48v.h>
//To go in DEBUG Mode, comment the following line
//#define RELEASE
#ifndef RELEASE
#define DEBUG
#endif RELEASE

#pragma interrupt_handler USART_interrupt_UDRE:iv_USART0_UDRE
#pragma interrupt_handler USART_interrupt_TX:iv_USART0_TXC
#pragma interrupt_handler USART_interrupt_RX:iv_USART0_RXC

int bPacketReady = 0;//Setting false as default
int iRecieveBuffer [10];
int iOutputBuffer [10];
int i, j, k, l;
const int iLEDCodes [10] = { 0x03, 0x9F, 0x25, 0x0D, 0x99, 0x49, 0x41, 0x1F, 0x01, 0x09 };
const int iMUXCodes [6] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20 };
int main ( void )
{
   //Setting up General purpose Configuration
   PRR = PRR & 0b11111101;   //Enable USART0

   //Setting up USART Configuration
   UCSR0B = 0x00;      //Transmit Enable, Recieve Enable
   UCSR0A = 0x02;      //U2X = 1
   UCSR0C = 0x06;      //Transmit 8-bit Data
   UBRR0L = 0x0C;      //
   UBRR0H = 0x00;      //Baud Rate
   UCSR0B = 0xF8;      //Transmit Enable, Recieve Enable

   //Port Direction Registers
   DDRB = 0xFF;
   DDRC = 0xFF;
   asm("sei");   //Enable all interrupts
   
   k = 0;
   l = 0;
   while ( 1 )
   {
      //Code Body here   
      if  ( bPacketReady == 1 )
      {
         //Uncomment the following block when in DEBUG Mode
#ifdef DEBUG
         for( j = 0; j < 9; j++ )
         {
            while (!(UCSR0A & 0x20));
             UDR0 = iRecieveBuffer[j];
            iOutputBuffer [j] = iRecieveBuffer [j];
         }
#endif DEBUG
         bPacketReady = 0;
      }

      if ( k == 0 )    //Checking sign of the Packet
      {
         if ( iOutputBuffer
  • == '-' )
         {
            PORTC = 0x01;
            PORTB = 0xFD;
         }

         k++; l++;
         continue;
      }
          
      if ( k == 3 )
         l++;      //i think this block is not required... kh//
      
      iOutputBuffer [l] &= 0x0F;
      PORTB = 0xFF;
      PORTC = iMUXCodes [k++];

      if ( k == 3 )
         PORTB = iLEDCodes [iOutputBuffer[l++]] & 0xFE;   
      else
         PORTB = iLEDCodes [iOutputBuffer[l++]];


      if ( k == 6 ) k = 0;
      if ( l == 7 ) l = 0;
   }

   return 1;
}
void USART_interrupt_RX(void)
{
   //USART Reception complete routine
   //USART Reception complete routine
   #ifdef DEBUG
         iRecieveBuffer [i++] = UDR0;
   #endif DEBUG
      
   #ifdef RELEASE
         iOutputBuffer [i++] = UDR0;
   #endif RELEASE
   
   iOutputBuffer [i++] = UDR0;
   if( i == 9 )
   {   
      bPacketReady = 1;
      i = 0;
   }
}
void USART_interrupt_TX(void)
{
;
}
void USART_interrupt_UDRE(void)
{
;
}

Please Help me to solve the following to avoid following warnings
Thanks in Advance

Logged
sam_des
Senior Member
****
Offline Offline

Posts: 253

Thank You
-Given: 124
-Receive: 146


« Reply #1 on: June 12, 2008, 07:15:36 19:15 »

Hi,

Just remove the trailing 'RELEASE', 'DEBUG' from #endif.
e.g. Instead of,
Quote
#ifndef RELEASE
#define DEBUG
#endif RELEASE

Use,
Quote
#ifndef RELEASE
#define DEBUG
#endif

reagards,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
jeniusj
Junior Member
**
Offline Offline

Posts: 38

Thank You
-Given: 11
-Receive: 7


« Reply #2 on: June 13, 2008, 07:27:53 07:27 »

Hi
thanks buddy for the help................
Now the compiler not throwing a warning
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC