error compiling delays

Help
2012-11-04
2013-03-12
  • alexrlopez86
    alexrlopez86
    2012-11-04

    this is the code:

    #include <pic16f877.h>
    #define __16f877
    // quartz de 4MHz
    void tempo_4us(char);
    void tempo_ms( unsigned int);
    void tempo_s( unsigned char);
    void tempo_4us ( char a )
    {
    a;// pour eviter un warning de non referencement
    _asm //a est en fait dans le registre w
    sublw 1 //(1-a)
    boucle:
    ADDLW 1
    btfss 0x03,0 //test si w=0 carry=1
    goto boucle
    _endasm;
    } //temps=(4a+1)µs a>=2
    void tempo_ms( unsigned int t) {
    while (t) {
    tempo_4us(247);
    t-;
    }
    }
    void tempo_s( unsigned char t) {
    while (t) {
    tempo_ms(1000);
    t-;
    }
    }

    void main(void) {

    PORTA = 0;
    PORTB = 0;
    TRISB = 0;

    while(1) {
    unsigned char i;

    for(i = 0; i < 0xff; i++) {
    PORTB = i ;
    tempo_ms(1000);//PORTB = check();
    PORTB = 0 ;
    tempo_ms(1000);//PORTB = check();
    }
    }
    }

    mplabx output error and sdcc:

    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make: se ingresa al directorio «/home/alex/MPLABXProjects/alex.X»
    make  -f nbproject/Makefile-default.mk dist/default/production/alex.X.production.hex
    make: se ingresa al directorio «/home/alex/MPLABXProjects/alex.X»
    mkdir -p build/default/production/_ext/1226298417
    rm -f  build/default/production/_ext/1226298417/ejerext2.o
    "/usr/local/bin/sdcc" -debug-ralloc -use-non-free -pstack-model=small -c -mpic14 -p16f877 ../../sdcc\ ejercicios/ejerext2.c  -obuild/default/production/_ext/1226298417/ejerext2.o
    at 1: warning 117: unknown compiler option '-debug-ralloc' ignored
    at 1: warning 117: unknown compiler option '-pstack-model=small' ignored
    make: se sale del directorio «/home/alex/MPLABXProjects/alex.X»
    make: se sale del directorio «/home/alex/MPLABXProjects/alex.X»
    ../../sdcc ejercicios/ejerext2.c:11: syntax error: token -> 'sublw' ; column 5
    make: ***  Error 1
    make: ***  Error 2
    make: ***  Error 2

    BUILD FAILED (exit value 2, total time: 1m 3s)

    espero su ayuda

     
  • Maarten Brock
    Maarten Brock
    2012-11-04

    __asm and __endasm must start two underscores. The variants with one or no underscores are no longer supported.

     
  • alexrlopez86
    alexrlopez86
    2012-11-04

    many thanks all perfect