Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
// ADMIN - not sure why, but this interrupt is being called. I'm not sure what the PD0 pin is hooked up to on the Axon.// this is basically the cause of the reset.EMPTY_INTERRUPT(INT0_vect);
My download includes .a files for ATMega8, ATMega168, ATMega32 and ATMega640. For an ATMega2560 version it will take a few minutes but then a while to make an official release - or I'll just email it to you.
The EMPTY_INTERRUPT stuff was DEFINITELY there in early versions of the Axon lib and looked like a 'workaround' to unexpected interrupts that would otherwise reboot the device. It may have been in earlier versions of the TImer code that has since been re-written. I'll remove it from my lib.
New version imminent (next week or so) with some doc fixes and more examples and Blackfin, SPI, EEPROM and microSD card support
Having no I2C devices then I will be flying blind anyway.
Guess I need some voting/polling software for future features.
The problem you are seeing is caused by a "funny" I introduced in the last release (its already fixed but I haven't re-released yet). The problem came about when I added different sorts of uarts ie both hardware and software. The docs also need changing as 'uartSetBaudRate' should be replaced by 'uartInit'.So change your 'uartSetBaudRate' to 'uartInit' - else the program will hang on your first use of rprintf.You will still get the compiler warning (until I manage to do a new release) but the code should still run ok.There's also a bug in the documentation on page 57 where theinclude "servos"should obviously beinclude "servos.h"
jaime, I got the same error about 10 days ago. This email, from Webbot, describes how to fix it.QuoteThe problem you are seeing is caused by a "funny" I introduced in the last release (its already fixed but I haven't re-released yet). The problem came about when I added different sorts of uarts ie both hardware and software. The docs also need changing as 'uartSetBaudRate' should be replaced by 'uartInit'.So change your 'uartSetBaudRate' to 'uartInit' - else the program will hang on your first use of rprintf.You will still get the compiler warning (until I manage to do a new release) but the code should still run ok.There's also a bug in the documentation on page 57 where theinclude "servos"should obviously beinclude "servos.h"
#include "sys/fish_2560.h"#include "servoPWM.h"#include "a2d.h"// Define two light sensors connected to ADC channels 0 and 1// Define two servosSERVO left = MAKE_SERVO(FALSE, E6,1500, 500);SERVO right = MAKE_SERVO(TRUE , H6,1500, 500);// Create the list - remember to place an & at the// start of each servo nameSERVO_LIST servos[] = {&left,&right};// Create a driver for the list of servosSERVO_DRIVER bank1 = MAKE_SERVO_DRIVER(servos);// In my initialising code - pass the list of servos to controlvoid appInitHardware(void){// Initialise the servo controllerservoPWMInit(&bank1);// Give each servo a start value of 'stop'act_setSpeed(&left, 0);act_setSpeed(&right,0);}TICK_COUNT appInitSoftware(TICK_COUNT loopStart){return 0;}// This is the main loopTICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){int i;for(i=0;i<100;i++) { act_setSpeed(&left,50); act_setSpeed(&right,50); delay_ms(20); }for(i=0;i<100;i++) { act_setSpeed(&left,-50); act_setSpeed(&right,-50); delay_ms(20); }return 20000; // wait for 20ms to stop crazy oscillations}
cbi(PORTG, PG5); // disable pull-up resistor for v1e and earlier //sbi(PORTG, PG5); // enable pull-up resistor for v1f and later
// Define two servosSERVO left = MAKE_SERVO(FALSE, E5,1500, 500);SERVO right = MAKE_SERVO(TRUE , H5,1500, 500);
// Specify which board is being used.#include "sys/axon.h"#include "uart.h"#include "rprintf.h"#include "core.h"#include "servos.h"typedef void (*puart_sbyte)(unsigned char);SERVO servo = MAKE_SERVO(FALSE, E6, 1500, 500);SERVO_LIST servos[] = {&servo};SERVO_DRIVER bank1 = MAKE_SERVO_DRIVER(servos);void appInitHardware(void){ uartInit(UART1, 115200); rprintfInit((puart_sbyte)&uart1SendByte); servosInit(&bank1, TIMER1_COMPAREA);}TICK_COUNT appInitSoftware(TICK_COUNT loop_start){ act_setSpeed(&servo, DRIVE_SPEED_CENTER); return 0;}TICK_COUNT appControl(LOOP_COUNT loop_count, TICK_COUNT loop_start){ if (loop_count % 2 == 0) { act_setSpeed(&servo, DRIVE_SPEED_MAX); } else { act_setSpeed(&servo, DRIVE_SPEED_MIN); } statusLED_set(loop_count % 2); rprintf("Hello world...\n"); return 1000000;}
So the differences are that 'jaime' is using software servo control (which works) and 'admin' is using hardware PWM for the servos (doesn't work).Admin is using H6 which is also OC2B which is Timer2 channel B, and using E6 which is not a PWM output pin !Also Timer2 is only an 8 bit timer whereas hardware PWM for servos, as per manual, really requires a 16 bit timer.
Plan is to continue to release versions on sourceforge but to hold a 'last tested by SoR Admin' copy/link on this site.
servosInit(&bank1, TIMER1_COMPAREA);servosInit(&bank2, TIMER1_COMPAREA);
servosInit(&bank1, TIMER2_COMPAREA);servosInit(&bank2, TIMER2_COMPAREA);
servosInit(&bank1, TIMER1_COMPAREA);servosInit(&bank2, TIMER2_COMPAREA);
servosInit(&bank1, TIMER1_COMPAREA);servosInit(&bank2, TIMER1_COMPAREB);
That'll limit to 10 errors, but you can flash two numbers in succession for many more.
This error detection + flashing LED idea is interesting. For the Axon II, what if it actually displayed an error number on the display while flashing? That'll limit to 10 errors, but you can flash two numbers in succession for many more.
Thanks to Admin for continuing to test this to destruction !!
* Added 'fraction.h' - not documented as you need to understand Fabonacci sequences. Too long to describe !! But is used * by other lib functions to avoid floating point maths library.
Is this a response to me adding the math.h include in my code? Do I still need it?
And I'm sure you have a good reason for rprintfCharN, but I can't figure out how its useful . . .
rprintf("-------------------------\n");rprintf("| Menu Options: |\n");rprintf("-------------------------\n");
Also, since you have seen my code . . . Webbot, I think my hardware.h file method should be used in future versions. Its not a big deal for a robot with just a handful of external stuff, but becomes much more useful to declutter/organize code when you have 10+ servos and many sensors.
Quote from: Admin on September 02, 2009, 07:17:09 AMAnd I'm sure you have a good reason for rprintfCharN, but I can't figure out how its useful . . .No worries - one day you may find a purpose I have used it elsewhere in the lib as it reduces the amount of flash taken up by things like: Code: [Select]rprintf("-------------------------\n");rprintf("| Menu Options: |\n");rprintf("-------------------------\n");
The hardware.h file is a way you have used to make your own code look neater. Its isn't part of the library and changes for each project. My 'dev/*.h' files detail ALL of the processor hardware available - and your file maps the connected devices onto the processor hardware for a given project. So the best place to comment on it is in your 'Getting started with Webbot lib guide' - as your recommendation of one way of working.
i2cSetBitrate(100);
sbi(PORTD, PD0); // SCL pull-up sbi(PORTD, PD1); // SDA pull-up DDRD = 0b11110011; //configure ports for output
*Note that internal pull-ups shouldn't be used if you have external pull-ups already. The Axon doesn't come with external pull-ups.
The internal pullups are between 20k and 50k. So if you have external pullups like 4.7k then the effect of the internal pullups will be negligible. ie the the internal pullups can ALWAYS be turned on (which is what the next release will do).
So uhhhh what happens after v1.9? What version will it be called
Anyone else current using WebbotLib for anything interesting?
so I'm guessing 10,11,12 etc