• AVR Freaks

Hot!It was working, but now it's not!

Author
RogerAF
Super Member
  • Total Posts : 248
  • Reward points : 0
  • Joined: 2007/06/30 20:48:04
  • Location: 0
  • Status: offline
2019/04/20 12:27:14 (permalink)
0

It was working, but now it's not!

I have a dsPIC30F4011 on a solderless breadboard, a PICKit3, and MPLABX version 5.10. I wrote a little program to blink an LED and was successful in building it and programming the chip. I'm using __delay_ms in libpic30.h. I initially set the delay time to 1000 and that is running fine. Then I decided to change the Delay to 500. When I tried to build the program again I got the following error:
In file included from newmain.c:43:0:
nbproject/Makefile-default.mk:106: recipe for target 'build/default/production/newmain.o' failed
C:/Users/Owner/MPLABXProjects/includes/libpic30.h:24:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'extern'

I've uploaded my source code file and libpic30.h (libpic30.h.txt).
This has my mind boggled. Please help.
#1

3 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9977
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: online
    Re: It was working, but now it's not! 2019/04/20 12:46:03 (permalink)
    +2 (2)
    You cannot pass a variable to __delay_ms(), it must be a constant.
    Change
            __delay_ms(Delay); // Wait
    to
            __delay_ms(500); // Wait


     
    Also, get rid of this pointless line
    void ____delay_ms(unsigned long time); // in libpic30.h

    (it doesn't hurt, but it's not doing anything useful.)
     
     
    #2
    RogerAF
    Super Member
    • Total Posts : 248
    • Reward points : 0
    • Joined: 2007/06/30 20:48:04
    • Location: 0
    • Status: offline
    Re: It was working, but now it's not! 2019/04/22 08:30:27 (permalink)
    0
     get rid of this pointless line...

    Thank you. I thought external functions had to be declared.
    Also, there turned out to be another version of the project on the start page. That one works correctly. (I tried adding that info as a reply after I posted the first time, but Microchip froze up and wouldn't let me reply to my own post (I guess).)
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 17237
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: It was working, but now it's not! 2019/04/22 09:36:03 (permalink)
    +1 (1)
    Your external functions need to be declared, not the compilers.
    Compiler functions are handled by including the proper header.
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5