Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
If I understand what you mean, then your oscillator will have to be defined in order for the delay routine to know how many cycles makes up your required delay.
For example, out of the C30 help file:
Default Behavior: This function relies on a user-supplied definition of FCY to represent the instruction clock frequency. FCY must be defined before header file libpic30.h is included. The specified delay is converted to the equivalent number of instruction cycles and passed to __delay32(). If FCY is not defined, then __delay_ms() is declared external, causing the link to fail unless the user provides a function with that name.
Thanx Gobbledok for helping ....... but what i mean that if i increase or even decrease the frequency of the oscillator , do that affect the delay routine ???
How many different oscillator speeds will you be using?? If it will only be a couple (full-speed and power-saving, for example) then maybe just have a different delay routine for each speed.
Or maybe have a register that represents your oscillator speed which you update when you change your oscillator speed. Then your delay routine checks that register and chooses the correct delay based on that.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.