Greetings to all.
sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.9.1 #5467 (Jun 12 2009) (UNIX)
sdcc --debug -mpic14 -p16f84a regado.c

I made all the changes that occur to me but I could not solve the problem.
I have sought information on the Internet concerning the subject but
have not found the solution.

The code in question is marked with /********code error********/

The following code compiles without any problem.

/****************************************************************************/
/*  LICENCIA GPL                                                             */
/*************************************************************
; PATILLAS
;*************************************************************
;                                     ___________
;                  Salida 3 <- RA,2 -|1   \__/  18|- RA,1 -> Salida  2
;                  Salida 4 <- RA,3 -|2         17|- RA,0 -> Salida 1
;                                NC -|3 16F84A  16|- XT
;                             MCLR/ -|4         15|- XT
;                               G5              14|- Vcc
;                        RX -> RB,0 -|          13|- RB,7
;                        TX -> RB,1 -|7         12|- RB,6
;                              RB,2 -|8         11|- RB,5
;                              RB,3 -|9________ 10|- RB,4
;
    Compile:    sdcc --debug -mpic14 -p16f84 reloj_semanal.c
    Simulate:   gpsim -pp16f84 -s reloj_semanal.cod reloj_semanal.asm
    picprog --burn --device=pic16f84 --input reloj_semanal.hex --pic /dev/ttyS0

//almacenamiento en eeprom

dia;hora;min;duracion;salida

*/
#include <pic16f84a.h>


//-- Definiciones
#define cont0 0xFA  // Valor con el que inicializar contador para #250
                      // consegir 1 segundo
                      //relog 4Mhz/4 =1Mhz
                      //1Mhz/32=31.250Hz
                      //31.250/250=125
                      //esto signufica cargar cont0 con 250 y cont1 con 125
#define cont1 0x7D    //#125    


/************************************/
/* Configurar el temporizador 0     */
/************************************/
void timer0_configurar()
{
  /*/-- Usarlo en modo temporizador, prescaler = 32*/
  OPTION_REG=0x84;
}



void init() {
        TRISA = 0x00;
        TRISB = 0x00;
        PORTA = 0x00;
        PORTB = 0x00;
        RP1=1;
}
void on(char triac)
{
switch ( triac )
  {
    case 0: PORTA=0x80;
                    break;
    case 1: PORTA=0x40;
                    break;
    default : PORTA=0x00;
     }
}

void off( char  triac)
{
switch ( triac )
  {
    case 0: PORTA=0x00;
                    break;
    case 1: PORTA=0x00;
                    break;
    default : PORTA=0x00;
     }
}

unsigned char read_16f84_eeprom(unsigned char adr)
{
        EEADR=adr;
        RD=1; // set the read bit
        return(EEDATA);
}

void write_16f84_eeprom(unsigned char adr, unsigned char d)
{
        EEADR = adr;
        EEDATA = d;

        WREN = 1;  // write enable
        EECON2 = 0x55; // protection sequence
        EECON2 = 0xaa;

        WR = 1;  // begin programming sequnce
        //esperar a que termina
        WREN = 0;  // disable write enable
}


void main()
{
/*
Formato memoria //dias;hora;min;duracion;salida//
Dia de la semana 0 todos los dias;1 Lunes 2 martes 3miercoles 4jueves
y 5 viernes
Hora 0-23.
Minutos 0-59.
Duracion 1-256 minutos cero para todos los dias.
salida 0-3
*/
 int at 0x2007 __config = _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF;
 char length=14;
 char regar[]={0,0,1,5,0,
               3,0,1,1,1,
               3,0,5,5,1};
 char tmp=0;
 char seg=0;//0-59
 char min=0;//0-59
 char hrs=0;//0-23
 char dia=0;//0-7
 // regar=[]={dia,hora,min,duracion,salida}
 //n= total de datos
 //duracion en minutos
 //0 todos los dias, 1 lunes
//unsigned char size = sizeof(regar)/sizeof(unsigned char);
 char i,H,D,M,duracion,triac;

init();
timer0_configurar();

 TMR0=cont0;   // Inicializar contador
 T0IF=0;         // Quitar flag overflow


  while(1) {

    if (T0IF & !tmp) {
        TMR0=cont1;
        tmp=!tmp;
      }
    if (T0IF & tmp) {
        TMR0=cont0;
        tmp=!tmp;
        seg=(seg+1)%60;
        if ( !seg ) {
          min=(min+1)%60;
          if (!min){
            hrs=(hrs+1)%24;
            if (!hrs){
            dia=(dia+1)%7;}
          }
          i=-1;

          while ( i<=length)
          {D=regar[++i];
          H=regar[++i];
          M=regar[++i];
          duracion=regar[++i];
          triac=regar[++i];
          /**********************************code
error*******************************************************/
          /*((0==D) || (D==dia)) && (H==hrs) && (M >= min) && (M <= 
min+duracion);*/
          if ((1)!=0) { on(1);}
          else { off(1);}
          /***********************************code
error******************************************************/
          }
        }
     }

   }
 }


however this code does not compile and has the error: linker script
has no definition that matches the type of section "ID_idata_0"


/****************************************************************************/
/*  LICENCIA GPL                                                             */
/*************************************************************
; PATILLAS
;*************************************************************
;                                     ___________
;                  Salida 3 <- RA,2 -|1   \__/  18|- RA,1 -> Salida  2
;                  Salida 4 <- RA,3 -|2         17|- RA,0 -> Salida 1
;                                NC -|3 16F84A  16|- XT
;                             MCLR/ -|4         15|- XT
;                               G5              14|- Vcc
;                        RX -> RB,0 -|          13|- RB,7
;                        TX -> RB,1 -|7         12|- RB,6
;                              RB,2 -|8         11|- RB,5
;                              RB,3 -|9________ 10|- RB,4
;
    Compile:    sdcc --debug -mpic14 -p16f84 reloj_semanal.c
    Simulate:   gpsim -pp16f84 -s reloj_semanal.cod reloj_semanal.asm
    picprog --burn --device=pic16f84 --input reloj_semanal.hex --pic /dev/ttyS0

//almacenamiento en eeprom

dia;hora;min;duracion;salida

*/
#include <pic16f84a.h>


//-- Definiciones
#define cont0 0xFA  // Valor con el que inicializar contador para #250
                      // consegir 1 segundo
                      //relog 4Mhz/4 =1Mhz
                      //1Mhz/32=31.250Hz
                      //31.250/250=125
                      //esto signufica cargar cont0 con 250 y cont1 con 125
#define cont1 0x7D    //#125    


/************************************/
/* Configurar el temporizador 0     */
/************************************/
void timer0_configurar()
{
  /*/-- Usarlo en modo temporizador, prescaler = 32*/
  OPTION_REG=0x84;
}



void init() {
        TRISA = 0x00;
        TRISB = 0x00;
        PORTA = 0x00;
        PORTB = 0x00;
        RP1=1;
}
void on(char triac)
{
switch ( triac )
  {
    case 0: PORTA=0x80;
                    break;
    case 1: PORTA=0x40;
                    break;
    default : PORTA=0x00;
     }
}

void off( char  triac)
{
switch ( triac )
  {
    case 0: PORTA=0x00;
                    break;
    case 1: PORTA=0x00;
                    break;
    default : PORTA=0x00;
     }
}

unsigned char read_16f84_eeprom(unsigned char adr)
{
        EEADR=adr;
        RD=1; // set the read bit
        return(EEDATA);
}

void write_16f84_eeprom(unsigned char adr, unsigned char d)
{
        EEADR = adr;
        EEDATA = d;

        WREN = 1;  // write enable
        EECON2 = 0x55; // protection sequence
        EECON2 = 0xaa;

        WR = 1;  // begin programming sequnce
        //esperar a que termina
        WREN = 0;  // disable write enable
}


void main()
{
/*
Formato memoria //dias;hora;min;duracion;salida//
Dia de la semana 0 todos los dias;1 Lunes 2 martes 3miercoles 4jueves
y 5 viernes
Hora 0-23.
Minutos 0-59.
Duracion 1-256 minutos cero para todos los dias.
salida 0-3
*/
 int at 0x2007 __config = _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF;
 char length=14;
 char regar[]={0,0,1,5,0,
               3,0,1,1,1,
               3,0,5,5,1};
 char tmp=0;
 char seg=0;//0-59
 char min=0;//0-59
 char hrs=0;//0-23
 char dia=0;//0-7
 // regar=[]={dia,hora,min,duracion,salida}
 //n= total de datos
 //duracion en minutos
 //0 todos los dias, 1 lunes
//unsigned char size = sizeof(regar)/sizeof(unsigned char);
 char i,H,D,M,duracion,triac;

init();
timer0_configurar();

 TMR0=cont0;   // Inicializar contador
 T0IF=0;         // Quitar flag overflow


  while(1) {

    if (T0IF & !tmp) {
        TMR0=cont1;
        tmp=!tmp;
      }
    if (T0IF & tmp) {
        TMR0=cont0;
        tmp=!tmp;
        seg=(seg+1)%60;
        if ( !seg ) {
          min=(min+1)%60;
          if (!min){
            hrs=(hrs+1)%24;
            if (!hrs){
            dia=(dia+1)%7;}
          }
          i=-1;
          while ( i<=length)
          {D=regar[++i];
          H=regar[++i];
          M=regar[++i];
          duracion=regar[++i];
          triac=regar[++i];
 /********************************code
error********************************************************/
          /*((0==D) || (D==dia)) && (H==hrs) && (M >= min) && (M <= 
min+duracion);*/
          if (triac) { on(1);}
          else { off(1);}
/*********************************code
error********************************************************/
          }
        }
     }

   }
 }

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to