Connect with us

hitech compiler delays

Discussion in 'Microcontrollers, Programming and IoT' started by juantravel, Nov 12, 2010.

Scroll to continue with content
  1. juantravel

    juantravel

    41
    0
    May 14, 2010
    I was working on getting the delay functions in the hi-tech c library to work. This is my code:

    Code:
    #include <htc.h>
    #define _XTAL_FREQ 4000000UL
    void main(void)
    {
     while(1)
    	{
         TRISIO = 0x00;
    	 GPIO = 0xff;
         _delay_ms(1000);
    	 GPIO = 0x00;
         _delay_ms(1000);
    	 }
    
    }
    The error I get is:


    I have read the manual over and over. I have tried changing the function name, even tried changing the _XTAL_FREQ to 4000000 even 4MHZ.

    If anyone has time to look at my code I will highly appreciate it. Im going to keep reading on it.

    Thanks , juantravel



    Got it working!! :) Too many 0's in the _XTAL_FREQ and it was calling error becuase the delay reached the limit.
     
    Last edited: Nov 12, 2010
  2. barathbushan

    barathbushan

    223
    0
    Sep 26, 2009
    the while loop looks ok , can you check the header file ??
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-