Issue in MPLAB X IDE using Delays.h Library

Author
ntrail
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2012/09/05 17:04:50
  • Location: 0
  • Status: offline
2012/09/05 17:10:57 (permalink)
0

Issue in MPLAB X IDE using Delays.h Library

Hello- 
 
I am new to the PIC world, and working with the MicroStick II to get started.  As part of my first activity, I wanted to convert the provided sample LED blinking code into an infinite loop with delays calls inbetween the toggle on vs off functions.  Unfortunately, I try to add to the #include <delays.h> library as the help file illustrates, but the IDE cannot locate it and thus I cannot use the delay commands.  Am I missing something here?.... any and all help in getting this working is very much appreciated....
 
Thanks,
Nick
 
Example While Loop
 
 
 while(1) {    //This loop determines the initial time between blinks.
            mPORTAToggleBits(BIT_0);  //Toggle light status "on". (Can be viewed in LATA SFR)
            Delay10TCYx(1);                     //Time "on" (1 = 10 clock cycles)
            mPORTAToggleBits(BIT_0);  //Toggle light status "off". (Can be viewed in LATA SFR)
            Delay10TCYx(1);                     //Time "off" (1 = 10 clock cycles)
 }
#1

3 Replies Related Threads

    sasa72
    Super Member
    • Total Posts : 418
    • Reward points : 0
    • Joined: 2011/08/09 05:17:18
    • Location: 0
    • Status: offline
    Re:Issue in MPLAB X IDE using Delays.h Library 2012/09/06 10:40:03 (permalink)
    0
    Main issue for all beginners in microcontroller world is variety of choices: many devices families, CPU cores, implemented modules, number of pins and associated modules, sharing, oscillators, SFR settings, compilers...
     
    All that should be know in order to produce even plan "Hello world", as is LED blinker.
     
    If you can provide all that information, that can be helpful to suggest you correct way for solving your problem. In your current fragment of the project code is unclear almost all crucial information. For example, 10 clock cycles may mean for example 2us, 10ms or more delay depending what oscillator source is used and specific PIC.
     
    Ports are usually multifunctional I/O. However, PORTA is usualy used for input, since ADC modules are connected to it, thus many modules connected to it must be switched off... Etc, there is many important steps to make depending what is used for the project.
     
     
    #2
    JMH08
    Super Member
    • Total Posts : 440
    • Reward points : 0
    • Joined: 2008/02/11 14:19:16
    • Location: 0
    • Status: offline
    Re:Issue in MPLAB X IDE using Delays.h Library 2012/09/07 14:55:15 (permalink)
    0
    If the IDE cannot locate delays.h then the project will not build. Does the project build? Please be advised that red dots in the source code does not necessarily mean the project won't build. If the project does build then your problem is something else. If it does not build, try adding the path to delays.h to the compiler include directories.
    #3
    vloki
    always on da run
    • Total Posts : 6570
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re:Issue in MPLAB X IDE using Delays.h Library 2012/09/08 01:00:53 (permalink)
    0
    ntrail
               mPORTAToggleBits(BIT_0);  //Toggle light status "on". (Can be viewed in LATA SFR)
    Another question:
    Why not "mLATAToggleBits(BIT_0) //Toggle light status "on". (Can be viewed in LATA SFR);" ???

    Posting images, links and code - workaround for restrictions.
    #4
    Jump to:
    © 2017 APG vNext Commercial Version 4.5