Hello,
Im trying implement PWM on ATmega128L. But, it's still got errors and warnings.
when i compile my code i got this :
main.c:55: warning: excess elements in array initializer
main.c:55: warning: (near initialization for 'pwmcfg.pc_channels')
main.c:56: warning: excess elements in array initializer
main.c:56: warning: (near initialization for 'pwmcfg.pc_channels')
main.c:58: warning: excess elements in struct initializer
main.c:58: warning: (near initialization for 'pwmcfg')
main.c:59: warning: implicit declaration of function 'PWM_COMPUTE_FAST'
main.c:59: warning: excess elements in struct initializer
main.c:59: warning: (near initialization for 'pwmcfg')
main.c: In function 'main':
main.c:82: error: 'PWMD1' undeclared (first use in this function)
main.c:82: error: (Each undeclared identifier is reported only once
main.c:82: error: for each function it appears in.)
make: *** [main.o] Error 1
Build failed with 3 errors and 9 warnings...
And my question is :
Why PWMD1 undeclared?
Is it because pwmd1 in here not linked to pwm_lld.h?
i have check that the PWM driver in halconf.h is enabled.
I dont know the cause that invoke those errors and warnings.
Need some advices here.
Thanks.
Regards
PWM on AVR ATmega128L
- Giovanni
- Site Admin
- Posts: 14458
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: PWM on AVR ATmega128L
Did your add your pwm_lld.c to \os\hal\platforms\AVR\platform.mk?
If no, add it.
If yes, does it export a variable named PWMD1? does pwm_lld.h include a extern declaration for said variable?
Giovanni
If no, add it.
If yes, does it export a variable named PWMD1? does pwm_lld.h include a extern declaration for said variable?
Giovanni
Re: PWM on AVR ATmega128L
yes, already add it.
did you mean this
if so, then i already add it as well on External declarations pwm_lld.h.
and still invoke those errors..
did you mean this
Code: Select all
#if AVR_PWM_USE_TIM1 && !defined(__DOXYGEN__)
extern PWMDriver PWMD1;
#endif
if so, then i already add it as well on External declarations pwm_lld.h.
and still invoke those errors..
- Giovanni
- Site Admin
- Posts: 14458
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- Giovanni
- Site Admin
- Posts: 14458
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: PWM on AVR ATmega128L
Does your main.c include hal.h ?
I am running out of ideas, I can't imagine what you could possibly done wrong. Post your code, better if a directly compilable project.
I am running out of ideas, I can't imagine what you could possibly done wrong. Post your code, better if a directly compilable project.
Re: PWM on AVR ATmega128L
oh well, it turn out to be my mistake when foldering files..
but, now i got new error.
main.c:61: error: expected expression before '}' token
main.c:61: warning: left-hand operand of comma expression has no effect
make: *** [main.o] Error 1
Build failed with 1 errors and 1 warnings...
And here is my code in attachment below.
but, now i got new error.
main.c:61: error: expected expression before '}' token
main.c:61: warning: left-hand operand of comma expression has no effect
make: *** [main.o] Error 1
Build failed with 1 errors and 1 warnings...
And here is my code in attachment below.
- Attachments
-
- PWM.rar
- (249.95 KiB) Downloaded 352 times
- Giovanni
- Site Admin
- Posts: 14458
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: PWM on AVR ATmega128L
Your macros PWM_COMPUTE_FAST, PWM_COMPUTE_PHASE, PWM_COMPUTE_PHASEFREQ all have a missing ')'.
Giovanni
Giovanni
Who is online
Users browsing this forum: No registered users and 3 guests