![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
carapinha
Joined: 31 May 2013 Posts: 2
|
[ERROR] - Identifier is already used in this scope |
Posted: Fri May 31, 2013 11:43 am |
|
|
Hi,
I am trying to compile in MPLAB some code developed under PCW IDE but i am having some problems :/
I already did this thing of putting only the main C file in the Source Files and the other ones in Other Files.
I am getting this ERRORS when compiling with MPLAB..
ERRORS
--- Info 300 "C:\Users\Flávio\Desktop\Nova pasta\Nova pasta\decodeeib.h" Line 28(1,11): More info: First Declaration of TABELA_EIS
*** Error 31 "C:\Users\Flávio\Desktop\Nova pasta\Nova pasta\decodeeib.h" Line 28(1,11): Identifier is already used in this scope
Here is part of my decodeeib.h
Code: |
#define NumEstores 5 //Numero de estores existentes
#define NumDispositivos 10
#define NumBEstores 3 //Numero de par de botões para estores
#define NumLampadas 5
#define NumEntradas 20
#define NumSaidas 15
#define RESET_ALL 15
#define RESET_CONFIG 11
void GroupValueW_REQ( int8 SubFunc,int8 CD, int8 valor );
void Proc_TimeEstoreMoving(void);
void Proc_EIB_DecodeFrame(void);
void Proc_EIB_FindFrame(void);
void Proc_VerifyCAN(void);
void iniciarModuloCan(void);
void GET_ID_BOARD(void);
void send_reset_ok(void);
void define_Table_associ(void);
typedef struct //Tabela que contém EIS
{
unsigned int8 EIS; // EIS TYPE
unsigned int8 COD; // CÓDIGO DO DISPOSITIVO
}
TABELA_EIS;
|
Here is part of my decodeeib.c
Code: |
#include "setup.h"
#include "main.h"
#include "sched.h"
#include "megaEIBdecode.h"
#include "decodeeib.h"
#include <can-18f4580.c>
int32 BOARD_ID=0x10;
unsigned int8 i;
unsigned int8 byDataLen; //Guarda o comprimento dos dados
unsigned int8 wMsgCode1;
unsigned int8 wMsgCode2;
unsigned int8 wCmdCode;
unsigned int8 Za,La,Na; // guarda valor endereço: Zona, Linha, Nó e Main Group
int16 Ag;//Addr group
int16 As; //Endereço de origem (pode ser físico ou de grupo)
unsigned int8 TxBuf[MaxTamTramaEIB];
unsigned int8 Estado_dispositivos[NumDispositivos];/*={OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF,OFF}; /*Guarda o estado do valor dos dispositivos(luzes,estores e comando IV) que pode ser OFF, ON, DOWN, UP */
unsigned int8 estado_drive[NumEstores]={0,0,0,0,0};
unsigned int8 Time_Step_Out[NumEstores]={0,0,0,0,0}; /*Vector para guardar o valor dos tempos de step_up e step_down dos estores*/
unsigned int16 Time_Moving_Out[NumEstores]={0,0,0,0,0}; /*Vector para guardar o valor dos tempos de step_up e step_down dos estores*/
unsigned int8 wValue[6];
#define tamanho_associacao 33
#define qnt_elements_grupo 5 //indica a quantidade máxima de dispositivos que pode ter cada end grupo
TABELA_ASSOCIACAO Tab_associacao[tamanho_associacao];
void define_Table_associ(){
int8 i=0,j=0;
int8 cd=0,gp=0,fc=0;
printf("Bytes recebidos por CAN %d\n",read_eeprom(ADDR_BYTES));
//******** Endereços que ligam saídas uma a uma ***************************************
for(i=0;i<tamanho_associacao;i++){
Tab_associacao[i].GROUP_ID=read_eeprom(CONFIG_FILE_ADDR+j);
printf("%d,",read_eeprom(CONFIG_FILE_ADDR+j));
j++;
Tab_associacao[i].COD_DISP=read_eeprom(CONFIG_FILE_ADDR+j);
printf("%d,",read_eeprom(CONFIG_FILE_ADDR+j));
j++;
Tab_associacao[i].SUBFUNCAO=read_eeprom(CONFIG_FILE_ADDR+j);
printf("%d",read_eeprom(CONFIG_FILE_ADDR+j));
j++;
printf("\n");
}
} |
Here is part of my main.c
Code: |
#include <18F4685.h>
#device ADC=8
#include "main.h"
#include "sched.h"
#include "setup.h"
#include "ir.c"
#include "decodeeib.c"
#include "readinput.h"
/******************************************************************************/
/* */
/* CICLO INFINITO - FUNÇÃO MAIN - PROGRAMA PRINCIPAL */
/* */
/******************************************************************************/
#define Ciclo1 2 //define o tempo de refrescamento das entradas 1*13.6=13.6ms
#define Ciclo2 2 //define o tempo de refrescamento das saidas 2*13.6=27.2ms
#define Ciclo3 1 //define o tempo de verificação de dados disponiveis no barramento CAN 1*13.6=27.2ms
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,UART1)
void main(void) // Programa principal
{
int8 i=0;
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
//setup_timer_0(RTCC_INTERNAL);
setup_timer_0(RTCC_INTERNAL| RTCC_DIV_128|RTCC_8_BIT);//interrupeção a cada (1/20000000)*4*128*256 =6.554ms
setup_timer_1(T1_DISABLED);
// setup_timer_2(T2_DISABLED,0,1);
setup_timer_2(T2_DIV_BY_16,0xFF,16);//interrupeção a cada (1/20000000)*4*16*256*16 =13.1ms
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
setup_uart(9600);
Proc_ClrReady(ProcID_EIB_FindFrame);
Proc_ClrReady(ProcID_EIB_DecodeFrame);
Proc_ClrReady(ProcID_ReadInputs);
Proc_ClrReady(ProcID_WriteOutputs);
Proc_ClrReady(ProcID_EIB_SendFrame);
Proc_ClrReady(ProcID_IRHandleInstruction);
////////////////////////////////////////////////////////////////////////////
//verifica se existe algum ficheiro em memória e emcaso de nao haver limpa a eeprom
/* if(read_eeprom(ADDR_FILE_READY)!=0){
printf("Nao existe FILE-> Apaga Memoria EEPROM");
for(i=0;i<CONFIG_FILE_MAX_TAM;i++){
write_eeprom(CONFIG_FILE_ADDR+i,0);
}
}
*/
///////////////////////////////////////////////////////////////////////////
// Funções deinicialização
iniciarModuloCan();// inicializar o modulo de CAN
GET_ID_BOARD();// obter o endereço da placa dos switchs
send_reset_ok();
define_Table_associ();
//////////////////////////////////////////////////////////////////////////////////
//Activa as interrupções necessarias
enable_interrupts(GLOBAL);
disable_interrupts(INT_CANRX0);
disable_interrupts(INT_CANRX1);
enable_interrupts(INT_TIMER0);
enable_interrupts(INT_TIMER2);
enable_interrupts(INT_RB);
///////////////////////////////////////////////////////////////////////////
while(TRUE){
output_low(PIN_B6);
|
I am going crazy with this! can somebody help me please??
Thanks a lot |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19365
|
|
Posted: Fri May 31, 2013 12:34 pm |
|
|
It sounds as if you are including the same file multiple times somewhere.
The standard way to prevent this being a problem, is to have the files set a flag when they are loader. So, at the start of each include file:
Code: |
#ifndef FLAGFORTHISFILE
#define FLAGFORTHISFILE
//Now all the code in this file
#endif
|
Have 'flagforthisfile' unique for each file, then if a file includes it again, variables won't be declared twice.
Otherwise you are going to have to work through the 'tree' of all your includes, and find the one that is including the file a second time....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
carapinha
Joined: 31 May 2013 Posts: 2
|
|
Posted: Tue Jun 04, 2013 4:18 pm |
|
|
Tks a lot Ttelmah it worked just fine ;)
Just another thing! Do you know how can i check my CCS compiler version? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19365
|
|
Posted: Wed Jun 05, 2013 12:21 am |
|
|
When you compile something, a .lst file is generated. This as the top line, has the version.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|