This is my first program in KDS. I was adding functionalities in Processor Expert, but, after adding the serial communication components, I can no longer add lines of code.
#include "Cpu.h"
#include "Events.h"
#include "AD1.h"
#include "AdcLdd1.h"
#include "TI1.h"
#include "TimerIntLdd1.h"
#include "TU1.h"
#include "LED1.h"
#include "BitIoLdd1.h"
#include "LED2.h"
#include "BitIoLdd2.h"
#include "LED3.h"
#include "BitIoLdd3.h"
#include "LED4.h"
#include "BitIoLdd4.h"
#include "pnCargaCalda.h"
#include "BitIoLdd5.h"
#include "AS1.h"
#include "ASerialLdd1.h"
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
unsigned int nrCountTmr100ms = 0;
byte idMeasure, idGetVal;
bool idReadyADC = FALSE;
word vlAdcAlta[4], vlAdcBaixa[4];
unsigned int nrTempoLed[4] = {0x40,0x40,0x40,0x40};
unsigned int nrContTempoLED[4];
unsigned char nrCountTempNivel[4] = {0x0,0x0,0x0,0x0};
unsigned char idNivelCalda[4] = {0x0,0x0,0x0,0x0};
byte idSendMsg = 0;
bool idTmr1 = FALSE;
bool idLeituraAlta = FALSE;
int main(void)
{
PE_low_level_init();
for(;;){
if (idTmr1){
idTmr1 = FALSE;
if (idNivelCalda[0]){
if (++nrContTempoLED[0] >= nrTempoLed[0]){
LED1_NegVal();
nrContTempoLED[0] = 0;
}
} else {
LED1_SetVal();
}
if (idNivelCalda[1]){
if (++nrContTempoLED[1] >= nrTempoLed[1]){
LED2_NegVal();
nrContTempoLED[1] = 0;
}
} else {
LED2_SetVal();
}
if (idNivelCalda[2]){
if (++nrContTempoLED[2] >= nrTempoLed[2]){
LED3_NegVal();
nrContTempoLED[2] = 0;
}
} else {
LED3_SetVal();
}
if (idNivelCalda[3]){
if (++nrContTempoLED[3] >= nrTempoLed[3]){
LED4_NegVal();
nrContTempoLED[3] = 0;
}
} else {
LED4_SetVal();
}
}
if (nrCountTmr100ms >= 100){
nrCountTmr100ms = 0;
if (idLeituraAlta){
pnCargaCalda_SetVal();
} else {
pnCargaCalda_ClrVal();
}
idMeasure = AD1_Measure(FALSE);
}
if (idReadyADC){
if (idLeituraAlta){
idGetVal = AD1_GetValue16(vlAdcAlta);
} else {
idGetVal = AD1_GetValue16(vlAdcBaixa);
}
idLeituraAlta = !idLeituraAlta;
idReadyADC = FALSE;
}
if (idGetVal == 0x00U){
for (int i = 0; i <= 3; i++){
if (vlAdcAlta[i] > vlAdcBaixa[i]+20){
if (++nrCountTempNivel[i] >= 20){
idNivelCalda[i] = 1;
nrCountTempNivel[i] = 10;
}
} else {
if (--nrCountTempNivel[i] <= 0){
idNivelCalda[i] = 0;
nrCountTempNivel[i] = 10;
}
}
}
idGetVal = 0xFF;
}
}
#ifdef PEX_RTOS_START
PEX_RTOS_START();
#endif
for(;;){}
}
If I uncomment the line 145 of the code above, I get this error messages:


This is the image of my PE with the components added. Note that in the console window, the size of program with the line 145 commented.


My program really this big? Did I do something wrong? that caused this problem?
thanks in advance for your time
Original Attachment has been moved to: teste-ADC.zip