![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Hi, i am using mikroC as compiler and i want to program pic18f4550 .whenever i try to use delay functions of mikroC it produces wrong delays.For example i wrote Delay_ms(10); it produces 1 seconed delay can anyone help me? my whole program is: void main() { TRISB=0; for(;; ){ PORTB=0x4F; Delay_us(10000); PORTB=0x00; Delay_us(10000); } } | |
| |
| | #2 |
|
I would assume that you need to tell the compiler the speed of your oscillator. Normally you would have something like, clock=20000000 or OSC=32768. Mike. | |
| |
| | #3 | |
| Quote:
For example, if you use PLL and your crystal is 10MHz the uC will run on 40MHz and not on 10MHz hence you have to enter 40000000 in that field and not 10000000. The delay_*() functions generate delay loop relating to this field so if you enter wrong value there, all delay* functions will create "wrong" delay. attached example pic
__________________ Bits From Bytes - the best RepRap kit out there now featuring RepRap V3 with full electronics redesign based on PIC32MX440F256H (English) MySQL Blog (Serbian) Elco Blog (Serbian) Use forum to ask questions, do not use PP Last edited by arhi; 7th November 2008 at 12:58 PM. | ||
| |
|
| Tags |
| delayms, mikroc, problem |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| mikroC problem | colin mac | Micro Controllers | 12 | 22nd July 2008 01:02 PM |
| mikroC lib troubble | Kryten | Micro Controllers | 17 | 28th May 2008 09:56 AM |
| mikroC demo version limits | ssylee | Micro Controllers | 8 | 19th October 2007 09:21 PM |
| Servo motor~~~~ problem~.....shaking problem!!!!! | Gundam82 | Robotics Chat | 10 | 4th October 2004 08:12 PM |