![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| i want to make a delay of, say 100uS using 1 Mhz oscilator, so i see a function like this can do the work, Code: void delay(unsigned char i)
{
unsigned char n;
unsigned int j;
for (n=1; n<i; n++)
{
for (j=1; j<1535; j++);
} anyone to come to my rescue? thanks, | |
| |
| | (permalink) | |
| Quote:
If you are using a PIC with a 1MHz crystal.? the internal cycle execution time will be 1MHz/4 ie: == 4uSec/execution cycle. I dont program in 'C', but the idea is the same in assembler. You count the total program execution cycles [bytes] around the loop, this gives the total delay period. Do this help.?
__________________ Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 22nd May 2008 at 09:12 AM. | ||
| |
| | (permalink) |
| You can run it in the simulator and use the stop watch to time it. Alternatively, you could include the delay routines supplied by Microchip. Mike. | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| c++ sleep function | danielsmusic | Chit-Chat | 4 | 11th August 2008 10:55 AM |
| Using ADC function of pic16f877 | mesamune80 | Robotics Chat | 14 | 15th February 2008 05:24 AM |
| Cool function | Analog | Chit-Chat | 7 | 5th March 2007 02:27 AM |
| Function Generator question: What is GATE function? | Cifrocco | General Electronics Chat | 8 | 14th April 2005 04:11 AM |
| Function Generator | Anonymous | Electronic Projects Design/Ideas/Reviews | 2 | 28th October 2002 07:43 PM |