Society of Robots - Robot Forum

Software => Software => Topic started by: Kirk on June 26, 2010, 09:59:05 PM

Title: Procyon AVRlib for ATmega328?
Post by: Kirk on June 26, 2010, 09:59:05 PM
Greetings,
It seems that Procyon AVRlib is dieing.  (the last update I found was 2006) Has anyone updated the uart.c for the ATmega328.  I am upgrading from the ATmega8 to the 328. 
There are some great utilities in this bit of code. I hope it lives on.
Thanks
Kirk
Title: Re: Procyon AVRlib for ATmega328?
Post by: Kirk on June 26, 2010, 11:09:55 PM
Well I have a partial solution.
after line 107
in uart.h add

   defined(__AVR_ATmega328P__)   || \

This compiles but I am getting a warning that I will be sorting out soon

Kirk
Title: Re: Procyon AVRlib for ATmega328?
Post by: Webbot on June 27, 2010, 06:54:49 AM
You could use WebbotLib  ;)
Title: Re: Procyon AVRlib for ATmega328?
Post by: Kirk on June 27, 2010, 11:58:09 AM
Well I did download it an look at it. It would require a near total rewrite of my bot's code :-(
Kirk
Title: Re: Procyon AVRlib for ATmega328?
Post by: Webbot on June 27, 2010, 05:20:01 PM
If you are coming from an ATMega8 then your code won't be that big/complex.

If you PM me the existing code then I reckon I could re-write it for WebbotLib and the ATMega328 fairly quickly (if its reasonably documented)

Once done then your code will become very portable across different processors and sensors.

Let me know if you are interested.
Title: Re: Procyon AVRlib for ATmega328?
Post by: Admin on June 29, 2010, 04:49:17 PM
I definitely recommend WebbotLib over AVRLib. It took me less than a day to convert my entire ERP code to it.

Its like using a round wheel vs a square wheel for your car . . .
Title: Re: Procyon AVRlib for ATmega328?
Post by: euchrid on August 26, 2010, 01:28:34 PM
Well I have a partial solution.
after line 107
in uart.h add

   defined(__AVR_ATmega328P__)   || \

This compiles but I am getting a warning that I will be sorting out soon

Kirk

Instead of adding the above (defined(__AVR_ATmega328P__)   || \), insert this at line 23 of uart.h:

#if defined(__AVR_ATmega328P__)
   #define UDR               UDR0
   #define UCR               UCSR0B
   #define RXCIE            RXCIE0
   #define TXCIE            TXCIE0
   #define RXC               RXC0
   #define TXC               TXC0
   #define RXEN            RXEN0
   #define TXEN            TXEN0
   #define UBRRL            UBRR0L
   #define UBRRH            UBRR0H
   #define SIG_UART_TRANS      USART_TX_vect
   #define SIG_UART_RECV      USART_RX_vect
   #define SIG_UART_DATA      SIG_USART_DATA
#endif

That should clear up the warnings, haven't tested it on hardware though.