Society of Robots - Robot Forum

Software => Software => Topic started by: Aligator on January 13, 2011, 07:05:54 AM

Title: Undefined reference to 'AVcc_MV'
Post by: Aligator on January 13, 2011, 07:05:54 AM
Hi

I am using webbotlib and webbotlib project designer for the first time and have written my code. (it is not the best, it is my way of teaching myself to use webbotlib, as well as the majority of C)

I am writing code for a object avoiding robot, using a Sharp IR, 2 continuous rotation servos, 1 servo for scanning(that i am not using in the original program) and the MCU is a mega328.

my problem is i am getting the error "/a2d.h:210 undefined reference to "AVcc_MV' "

my code is a as follows

Code: [Select]
#include "hardware.h"
#include "servos.h"


int speed;
int distanceRead;

// Initialise the hardware
void appInitHardware(void) {
initHardware();
}


// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
return 0;
}

// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {

while(1);
{

if(distanceRead > 100)
{
act_setSpeed(&servo_left,50);
act_setSpeed(&servo_right,0);
}

else
{
act_setSpeed(&servo_left,50);
act_setSpeed(&servo_right,50);
}

delay_cycles(500);
}

return 0;

}

help as to what my problem might be and any suggestions when it comes to the writing of the program would be greatly appreciated.

thanks

Aligator
Title: Re: Undefined reference to 'AVcc_MV'
Post by: Joker94 on January 17, 2011, 07:24:36 PM
I received the same error not to long ago but was unable to find a solution, so that program is yet to be tested.
Title: Re: Undefined reference to 'AVcc_MV'
Post by: Webbot on January 19, 2011, 10:29:51 AM
The AVcc_MV should be present in the generated 'hardware.h' file. ie you should see something like the following somewhere in the file:-
Code: [Select]
// ----------- Define the ADC channels ----------
const uint8_t NUM_ADC_CHANNELS = 16;
const uint16_t PROGMEM AVcc_MV = 5000;

It represents the number of milliVolts present on the a2d reference voltage on the chip pin.

Project Designer gets this info from the Board design you are using. So when you created the Project did you base it on one of the supplied boards - or did you create your own board using Board Designer? If the second is true - then re-open your board design in Board Designer and make sure that in the top left of the window you have entered a voltage. If the first is true then which board did you base your project on?
Title: Re: Undefined reference to 'AVcc_MV'
Post by: Aligator on January 24, 2011, 09:23:30 PM
My board on the robot is a 328 based board with a 16Mhz crystal.

On the project designer i am using the a$50 robot board with 328 and i change the frequency in AVR studio in config options.

still have not had any luck. should i design my own board in board designer?
Title: Re: Undefined reference to 'AVcc_MV'
Post by: Webbot on January 25, 2011, 01:16:29 PM
Are the lines that I mentioned previously in the generated hardware.h file ?
Title: Re: Undefined reference to 'AVcc_MV'
Post by: Aligator on January 25, 2011, 10:12:08 PM
I got the first line but not the second consisting of

Code: [Select]
const uint16_t PROGMEM AVcc_MV = 5000;
What i did do was design my own board in the board designer and now it works just fine, the only problem i am having is my programming ability and getting used to the webbotlib functions.

Do you or any one else have any recommendations on good ways to develop my programming skills and help getting started with webbotlib?

thanks

Aligator
Title: Re: Undefined reference to 'AVcc_MV'
Post by: Webbot on January 26, 2011, 02:41:08 PM
Ok so problem sorted - now we need to fix your brain  :)

Other threads suggest links/books for general C programming - search within SoR or Google.

For WebbotLib - then read the manual  :D , especially the first few chapters, but post questions on SoR as it has the biggest community of WebbotLib users to answer your questions.