|
Posted by on October 9, 2006, 7:36 am
Hello,
I am not sure this will work for you or not. Remove the "uart.h"
in your source file and use the 0 instead of UART0 for the parameter
indicating which uart to use. This parameter is needed for uart2.c
(which is included as an included file in your source). The uart2.c or
uart2.h API supports 2 uarts on the ATmega that has 2 UARTs and
therefore the library expects additional parameter for specifying which
UART.
Regards,
-Pandit
Gootes wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Hi all!
> I'd like to use my ATmega8 as interface between USART and i2c (and for some
> other things too, but it's not important for my problem). When i write
> support for I2C in my code (i'm using Procyon AVRLib) everything is OK, but
> when i try to add support for UART, compiler (avr-gcc) says me Error.
> Here is my code:
> Code:
> #include "i2c.c" // i2c library
> #include "uart.h" // uart library
> // headers
> /*
> Here is defined some constants like i2c addresses
> */
> void inicializaceI2C() { // setting I2C
> i2cInit();
> i2cSetLocalDeviceAddr(0xA8, TRUE);
> }
> void inicializaceUart() { // setting UART
> uartInit();
> uartSetBaudRate(9600);
> }
> int main() {
> inicializaceI2C();
> inicializaceUart();
> while(1) { }
> return 0;
> }
> When i try to build it, AVRstudio says me, uart.h is in conflict with
> uart2.h (included by i2c.c). When I try compile this code without
> Code:
> #include "uart.h" // uart library
> avr studio says me:
> Code:
> error: too few arguments in function uartSetBaudRate
> When I try modify my code to using UART0, avr studio says me, uart0
> nonexists.
> Have you any idea how to use i2c and uart together on ATMega8 or should I
> use bigger AVR with 2 uarts?
> thank you for your reaction
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> iQIVAwUBRSevt7deRnHaI3I/AQKVMxAAjvFlTfEXmkFeNAUtQXwj6rhEyGmDFrai
> 9pfHh/3BQwuDuf21sG5OHTsMuKQvr5ooewGdsH0yC6GP23Hq2G6jmkCQxCHHN03p
> BieF1hrHcdBq84LMiod58UT8IDAnOdnuG//PRImlvgwzCw5LJqRnD3uEWhsOmvhC
> Lf2ckXnJjE7xS9tSKP+fJLylxiPjzmYO5MPpvOyONDj6N3Ufo3yDdG389tUT6EHc
> 3dP3lvcNxjcKWF3cfR5Z/iuCD+IPwN9dRNoM7rHzVzEiViopzdeRBzRxYlgjNpYr
> Jx7xGjWh2B6ZhD0iSXUlXBizY3bYY0ejqedTMUCr96wCLnyQyAyI1nk0XDsKcosM
> svtXJ4PwAKx5oLsgXjuXJioYrwjgLnVAwWtv63XiXvGL1VAZuvlDAGtT7T6Gnnxl
> mUzPcAfW3aUv3VYvQLJVgsK1PBhiRkYdBHMKYbAbiXce9mMv66CnuGShBJUfMxSf
> L9PqtT3T/+nPgczTAvJI102wKkLpAXCdNtAtVrSwxisvI3EG9zkmw83zbUQeViO8
> vz1xyIBQdJdDPoPapNVNDvxDfMbT5BaEsLKtKu1vMu42fpll9C9E3Z5txrst97fn
> GnHUN2GripUqEeXaXtcDl3Rb9DEs2lwyBctw3U4SmOFitk67yIom4ZoE/s/z0NR8
> qCZhkUvv/hw=
> =1tBl
> -----END PGP SIGNATURE-----
|
#include <avr/interrupt.h>