go away spammer

Author Topic: Program Compilation Error  (Read 3533 times)

0 Members and 1 Guest are viewing this topic.

Offline ukeshTopic starter

  • Full Member
  • ***
  • Posts: 107
  • Helpful? 0
Program Compilation Error
« on: August 06, 2009, 09:54:19 AM »
I'm writing a program to create an pulsing effect by using the led in axon mcu. The following, is the code in the control.c file.

Code: [Select]
void control(void)
{
ledpulse();
}
void ledpulse(void)
{
int i;
PWM_Init_timer1_LED(8);
PWM_timer1_On_LED();
while(1)
{
for(i=110;i<255;i++)
{
PWM_timer1_Set_LED(i);
delay_ms(10);//control pulse speed
}
for(i=255;i>110;i--)
{
PWM_timer1_Set_LED(i);
delay_ms(10);//control pulse speed
}
}
}

I have not changed anything in the Axon.c file. I've changed the target name in the makefile. I get the following error.

Offline wil.hamilton

  • Robot Overlord
  • ****
  • Posts: 207
  • Helpful? 6
  • rtfm
Re: Program Compilation Error
« Reply #1 on: August 06, 2009, 01:50:42 PM »
it looks like you didn't include a header file for the PWM functions, its saying that those aren't defined anywhere
use the google.  it's your friend.

Offline ukeshTopic starter

  • Full Member
  • ***
  • Posts: 107
  • Helpful? 0
Re: Program Compilation Error
« Reply #2 on: August 07, 2009, 05:24:40 AM »
it looks like you didn't include a header file for the PWM functions, its saying that those aren't defined anywhere
were can i find the header file for PWM functions? and where do i include the header file?

Offline wil.hamilton

  • Robot Overlord
  • ****
  • Posts: 207
  • Helpful? 6
  • rtfm
Re: Program Compilation Error
« Reply #3 on: August 07, 2009, 06:41:42 PM »
i dont know what file the axon one is in, but to include it you would do something like
Code: [Select]
#include "pwm_file_name.h"

this should go at the top of your code
use the google.  it's your friend.

Offline ukeshTopic starter

  • Full Member
  • ***
  • Posts: 107
  • Helpful? 0
Re: Program Compilation Error
« Reply #4 on: August 08, 2009, 06:21:32 AM »
i dont know what file the axon one is in, but to include it you would do something like
Code: [Select]
#include "pwm_file_name.h"

this should go at the top of your code

oh okie man, thanks.

can any users of axon guide me on finding the header file for pwm functions??

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Program Compilation Error
« Reply #5 on: August 09, 2009, 07:03:00 PM »

Offline ukeshTopic starter

  • Full Member
  • ***
  • Posts: 107
  • Helpful? 0
Re: Program Compilation Error
« Reply #6 on: August 10, 2009, 05:04:35 AM »
Its in timer640.c

http://www.societyofrobots.com/axon/axon_function_list.shtml#pwm
Do i need to add the header file timer640.h in the axon.c file ?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Program Compilation Error
« Reply #7 on: August 10, 2009, 06:40:40 AM »
Its in timer640.c

http://www.societyofrobots.com/axon/axon_function_list.shtml#pwm
Do i need to add the header file timer640.h in the axon.c file ?
It should already be there.

What code version are you using? This doesn't work on earlier code versions.

Offline ukeshTopic starter

  • Full Member
  • ***
  • Posts: 107
  • Helpful? 0
Re: Program Compilation Error
« Reply #8 on: August 10, 2009, 06:44:40 AM »
Its in timer640.c

http://www.societyofrobots.com/axon/axon_function_list.shtml#pwm
Do i need to add the header file timer640.h in the axon.c file ?
It should already be there.

What code version are you using? This doesn't work on earlier code versions.

no admin, i tried adding the header file timer640.h and still i get the same error. I'm using version 1.08.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Program Compilation Error
« Reply #9 on: August 10, 2009, 06:49:26 AM »
ok I'll look into it tonight

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Program Compilation Error
« Reply #10 on: August 10, 2009, 07:25:14 PM »
ok so it appears it got broken when the PWM file was entirely rewritten . . .

Until I fix it, just add this code at the top of control.c, right after the variables are called, and it should work. It compiled fine for me, but I didn't test to see if it worked.

Code: [Select]

#ifndef PWM10
// mega128 PWM bits
#define PWM10 WGM10
#define PWM11 WGM11
#endif

//OC1B  pin B6 (attached to green LED)
void PWM_Init_timer1_LED(u08 bitRes)
{
// enable timer2 as 8,9,10bit PWM
if(bitRes == 9)
{ // 9bit mode
sbi(TCCR1A,PWM11);
cbi(TCCR1A,PWM10);
}
else if( bitRes == 10 )
{ // 10bit mode
sbi(TCCR1A,PWM11);
sbi(TCCR1A,PWM10);
}
else
{ // default 8bit mode
cbi(TCCR1A,PWM11);
sbi(TCCR1A,PWM10);
}
// clear output compare values
OCR1B = 0;
}

//on commands
void PWM_timer1_On_LED(void)
{
sbi(TCCR1A,COM1B1);
cbi(TCCR1A,COM1B0);
}


//off commands
void PWM_timer1_Off_LED(void)
{
cbi(TCCR1A,COM1B1);
cbi(TCCR1A,COM1B0);
}

void PWM_timer1_Set_LED(u16 pwmDuty)
{OCR1B = pwmDuty;}


Offline ukeshTopic starter

  • Full Member
  • ***
  • Posts: 107
  • Helpful? 0
Re: Program Compilation Error
« Reply #11 on: August 11, 2009, 08:51:35 AM »
thnx admin! It worked.  ;D
Can you work on this pwm error as soon as possible? If u can, it would be nice ;)

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Program Compilation Error
« Reply #12 on: August 11, 2009, 11:44:25 AM »
thnx admin! It worked.  ;D
Can you work on this pwm error as soon as possible? If u can, it would be nice ;)

Well, since this quick hack fixes it, its now a low priority bug fix.

I'll make sure it works correctly with the next code version release.

 


Get Your Ad Here

data_list