go away spammer

Author Topic: PROBLEM :New Tutorial : PWM on ATmega168  (Read 4000 times)

0 Members and 1 Guest are viewing this topic.

Offline zverukasTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
PROBLEM :New Tutorial : PWM on ATmega168
« on: October 12, 2010, 12:41:45 PM »
Hi, i can't compile it on gcc.
I always receive an error: "../pwm.c:250:23: error: "*" may not appear in macro parameter list"
on lines :
#define pwmSet9(ICR1 * val /255)   OCR1A=val     
#define pwmSet10(ICR1 * val /255)   OCR1B=val

also warnings : "../pwm.c:135: warning: implicit declaration of function 'sbi'"
on :
void pwmOn9(void) {
   /****************************/
   /* Pin 9 on*/
   /****************************/
//9 A on - set at Bottom, clear at compare match
   sbi(TCCR1A,7);
  cbi(TCCR1A,6);

any ideas ? :-\

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: PROBLEM :New Tutorial : PWM on ATmega168
« Reply #1 on: October 12, 2010, 12:51:54 PM »
Hi, i can't compile it on gcc.
I always receive an error: "../pwm.c:250:23: error: "*" may not appear in macro parameter list"
on lines :
#define pwmSet9(ICR1 * val /255)   OCR1A=val     
#define pwmSet10(ICR1 * val /255)   OCR1B=val
Yep - not surprised - that #define is full of errors. The original author of that tutorial was airman00. Hopefully you will get a response from him and he will fix the tutorial.


Quote
also warnings : "../pwm.c:135: warning: implicit declaration of function 'sbi'"
on :
void pwmOn9(void) {
   /****************************/
   /* Pin 9 on*/
   /****************************/
//9 A on - set at Bottom, clear at compare match
   sbi(TCCR1A,7);
  cbi(TCCR1A,6);

any ideas ? :-\

The cbi and sbi marcros aren't defined
Try placing this at the top of your program-
Code: [Select]
#ifndef cbi
    #define cbi(reg,bit)    reg &= ~(BV(bit))
#endif
#ifndef sbi
    #define sbi(reg,bit)    reg |= (BV(bit))
#endif
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline zverukasTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: PROBLEM :New Tutorial : PWM on ATmega168
« Reply #2 on: October 12, 2010, 01:46:25 PM »
hmm ::)

../pwm.c:142: warning: implicit declaration of function 'BV'

Offline KurtEck

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: PROBLEM :New Tutorial : PWM on ATmega168
« Reply #3 on: October 12, 2010, 01:54:43 PM »
My quick guess at this is BV is probably defined something like:

#define BV(bit) (1<<bit)

You can probably put this in an #ifndef like the other ones...

Kurt

 


Get Your Ad Here