delay.c File Reference

Delay routines. Target: PIC16F876. More...

#include <app.h>
Include dependency graph for delay.c:

Go to the source code of this file.

Functions

void delay_10us (unsigned char x)
 
void delay_ms (long t)
 

Detailed Description

Delay routines. Target: PIC16F876.

This file is part of JADEKU Portable ADQ device for Routines Control.

Copyright (C) 2002-2009, Hernan Monserrat hemonserrat<at>gmail<dot>com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

This file is part of JADEKU Portable ADQ device for Routines Control.

Copyright (C) 2002-2009, Hernan Monserrat hemonserrat<at>gmail<dot>com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Note
Based on HiTech DELAY.C examples.

Note that there are range limits: x must not exceed 255 - for xtal frequencies > 12MHz the range for DelayUs is even smaller. To use DelayUs it is only necessary to include this file; to use DelayMs you must include delay.c in your project.

Set the crystal frequency in the CPP predefined symbols list in HPDPIC, or on the PICC commmand line, e.g. picc -DXTAL_FREQ=4MHZ

or picc -DXTAL_FREQ=100KHZ

Note that this is the crystal frequency, the CPU clock is divided by 4.

MAKE SURE this code is compiled with full optimization!!!

Definition in file delay.c.

Function Documentation

◆ delay_10us()

void delay_10us ( unsigned char  x)

Delays ejecution in mult. of 10us.

Parameters
x- number of 10us units to delay.

Definition at line 29 of file delay.c.

Here is the caller graph for this function:

◆ delay_ms()

void delay_ms ( long  t)

Delays ejecution in mult. of millisecs

Parameters
t- number of millisecs to delay.

Definition at line 40 of file delay.c.

Here is the call graph for this function:
Here is the caller graph for this function: