MCUmall EPROM BIOS Chip Burner Forum
Home
|
Profile
|
Register
|
Active Topics
|
Members
|
Search
|
FAQ
Username:
Password:
Save Password
Forgot your Password?
All Forums
MCUmall Forums
Using the AVR JTAG ICE and AVRISP ISP programmer
Need help on AVR CodeVision
New Topic
Reply to Topic
Printer Friendly
Author
Topic
sohomcu
4 Posts
Posted - 09/20/2007 : 00:14:54
Dear all,
Would anyone please help to solve my problem on using CodeVision
C compiler.
I need to pass a variable parameter to the function delay_us( )
which only accept constant expression.
Is it possible?
Thanks a lot
Eddy Lau
Reply #1
ZLM
2937 Posts
Posted - 09/20/2007 : 07:18:37
Did you try cast the varible?
Example:
unsigned char delayInMs;
delay_us((const unsigned char) delayInMs);
Reply #2
sohomcu
4 Posts
Posted - 09/21/2007 : 02:15:02
I tried your suggestion but it produce an error of invalid
typecast.
Just can't understand why the function delay_ms( ) can accept variable as parameter but delay_us( ) cannot.
What's the purposeof making this limitation?
Reply #3
ZLM
2937 Posts
Posted - 09/21/2007 : 14:30:29
What is the delay_us() function prototype looks like?
Reply #4
sohomcu
4 Posts
Posted - 09/22/2007 : 23:36:17
the content of delay.h is as follows:
// CodeVisionAVR C Compiler
// (C) 1998-2000 Pavel Haiduc, HP InfoTech S.R.L.
#ifndef _DELAY_INCLUDED_
#define _DELAY_INCLUDED_
#pragma used+
void delay_us(unsigned int n);
void delay_ms(unsigned int n);
#pragma used-
#endif
I wonder whether this is compiler bug or not?
Who can tell me the answer?
Thanks
Reply #5
ZLM
2937 Posts
Posted - 09/23/2007 : 23:06:26
It looks fine but I do not know what is "#pragma used+" for.
How about remove those two #pragma lines?
Reply #6
sohomcu
4 Posts
Posted - 09/23/2007 : 23:34:50
I am sure the problem has nothing concerned with the two
#pragma lines.
Anyway, thanks for your kind concern to my problem.
Topic
New Topic
Reply to Topic
Printer Friendly
Jump To:
Select Forum
MCUmall Forums
General Discuss
Novice Place
True USB Willem Programmer (GQ-2X,3X,4X & GQ-4x4)
GQ-5X
Automobile engine ECU, Immo, Air bag chip tunning
Using The Enhanced/Dual power Willem Programmer
Open Source Project Willem Programmer Hardware
Wellon/WEILEI USB Programmer
TOP USB Programmer
EasyPRO/SmartPRO USB Programmer
PIC Programmer
Using the AVR JTAG ICE and AVRISP ISP programmer
--------------------
Home
Active Topics
Frequently Asked Questions
Member Information
Search Page
MCUmall EPROM BIOS Chip Burner Forum
© Copyright 2003 - 2009 Mcumall Electronics Inc.
Generated in 0.08 sec.
Snitz Forums 2000