mityeltu 0 Report post Posted April 22, 2016 I have run into this in the past, but I can't remember exectly what I did to fix it. I am finding that the delay_s(4) gives me exactly half the time I specified. I seem to remember that I fixed this by making sure the _XTAL_FREQ was properly defined and that the osccon register was properly set. I have both set for 8MHz. I also have made sure that the configuration bits are set correctly for internal oscillator. but I am still getting 2 seconds delay from the instruction above. Is there something else I need to do? hat have I missed? I'm using pic18f4620 if it makes any difference. Quote Share this post Link to post Share on other sites
mityeltu 0 Report post Posted April 22, 2016 Dangit. Never mind. found the problem. the pragma is not properly set for CLOCK_FREQ. I was using the _XTAL_FREQ as a defined constant in the code. I hate it when I do this. My bad. Quote Share this post Link to post Share on other sites