Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

errors in codevisinavr for running hc05 bluetooth module with atmega8L

errors in codevisinavr for running hc05 bluetooth module with atmega8L

2016-07-04 by moh.hce_lio_pe@rocketmail.com

hello every one

i want to run hc05 bluetooth module with atmega8L by following codes in codevisionavr ,main project file is hc11.c and it has 2 header files named hc05.h and usart.h but i see some errors and warnings after selecting build all , codes are:

hc11.c

[code]

#include<io.h>
/*Includes io.h header file where all the Input/Output Registers and its Bits are defined for all AVR microcontrollers*/

#define F_CPU 8000000
/*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/

#include<delay.h>

/*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/

#include<hc05.h>

/*Includes hc05.h header file which defines different functions for HC-05 Bluetooth Module. HC-05 header file version is 1.1*/

void main(void)

{

delay_ms(500);

delay_ms(500);

/*Delay of 1s*/

usart_init();

/*USART initialization*/

hc_05_bluetooth_transmit_string("bluetooth tag");

/*Transmits a string to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0d);

/*Transmits Carriage return to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0a);

/*Transmits New Line to Bluetooth Module for new line*/

hc_05_bluetooth_transmit_string("bluetooth module");

/*Transmits a string to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0d);

/*Transmits Carriage return to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0a);

/*Transmits New Line to Bluetooth Module for new line*/

}

/*End of program*/

[/code]



hc05.h

[code]

#ifndef _HC05_H_

//#if HC05_H_

//#define _HC05_H_

#define _HC05_H_ 1

#include<io.h>

#include<delay.h>

#include<usart.h>

#include<string.h>

void main(void)

{

while(1){

char hc_05_buffer1[25], hc_05_buffer2[50];

char temp;

//unsigned char i;

void hc_05_bluetooth_transmit_byte(char data_byte);

char hc_05_bluetooth_receive_byte(void);

void hc_05_bluetooth_transmit_string(char *transmit_string);

void hc_05_bluetooth_transmit_command(char *transmit_string);

char *hc_05_bluetooth_receive_string(char *receive_string, unsigned char terminating_character);

unsigned char hc_05_bluetooth_at_command_mode_test(void);

unsigned char hc_05_bluetooth_device_name_change(char *device_name);

unsigned char hc_05_bluetooth_get_version(void);

unsigned char hc_05_bluetooth_change_baud_rate(long int baud_rate);

unsigned char hc_05_bluetooth_pin_change(char *new_pin);

void hc_05_bluetooth_transmit_byte(char data_byte)

{

usart_data_transmit(data_byte);

}

char hc_05_bluetooth_receive_byte(void)

{

return usart_data_receive();

}

void hc_05_bluetooth_transmit_string(char *transmit_string)

{

usart_string_transmit(transmit_string);

}

char *hc_05_bluetooth_receive_string(char *receive_string, unsigned char terminating_character)

{

unsigned char temp=0x00;

unsigned char i;

for( i=0;;i++)

{

*(receive_string+i)=usart_data_receive();

if(*(receive_string+i)==terminating_character)

break;

else

temp++;

}

*(receive_string+temp)='\0';

return receive_string;

}

unsigned char hc_05_bluetooth_at_command_mode_test(void)

{

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT");

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,0x0d);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_change_baud_rate(long int baud_rate)

{

UBRRL=12;

delay_ms(500);

if(baud_rate==4800)

{

usart_string_transmit("AT+UART=4800,0,0");

}

else if(baud_rate==9600)

{

usart_string_transmit("AT+UART=9600,0,0");

}

else if(baud_rate==19200)

{

usart_string_transmit("AT+UART=19200,0,0");

}

else if(baud_rate==38400)

{

usart_string_transmit("AT+UART=38400,0,0");

}

else if(baud_rate==57600)

{

usart_string_transmit("AT+UART=57600,0,0");

}

else if(baud_rate==115200)

{

usart_string_transmit("AT+UART=115200,0,0");

}

else if(baud_rate==230400)

{

usart_string_transmit("AT+UART=230400,0,0");

}

else if(baud_rate==460800)

{

usart_string_transmit("AT+UART=460800,0,0");

}

else if(baud_rate==921600)

{

usart_string_transmit("AT+UART=921600,0,0");

}

else if(baud_rate==1382400)

{

usart_string_transmit("AT+UART=1382400,0,0");

}

else

{

;

}

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_device_name_change(char *device_name)

{

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT+NAME=");

usart_string_transmit(device_name);

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_get_version(void)

{

unsigned char i=9,j=0;

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT+VERSION?");

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer2,13);

temp=usart_data_receive();

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

for(i=9;hc_05_buffer2[i]!=0;i++)

{

hc_05_buffer2[j]=hc_05_buffer2[i];

j++;

}

hc_05_buffer2[j]=0;

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_pin_change(char *new_pin)

{

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT+PSWD=");

usart_string_transmit(new_pin);

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

}

}

#endif

[/code]

usart.h

[code]

#ifndef _USART_H_

#define _USART_H_ 1

#include<io.h>

#include<delay.h>

#include<string.h>

/*#include

void main(int) {

set_sleep_mode(SLEEP_MODE_IDLE);

sei();

sleep_mode();}

//gcc -std=gnu99 usart.c

// unsigned char i; */

/*The function is declared to initialize the USART with following cinfiguration:-

USART mode - Asynchronous

Baud rate - 9600

Data bits - 8

Stop bit - 1

Parity - No parity.*/

void main(void){

while(1){

void usart_init();

/*The function is declared to transmit data.*/

void usart_data_transmit(unsigned char data );

/*The function is declared to receive data.*/

unsigned char usart_data_receive( void );

/*The function is declared to transmit string.*/

void usart_string_transmit(char *string);

/*The function is declared to receive string.*/

char *usart_string_receive(char *receive_string,unsigned char terminating_character);

/*Function defination*/

void usart_init()

{

UBRRH = 0;

UBRRL =51;

UCSRB|= (1<<RXEN)|(1<<TXEN);

UCSRC |= (1 << URSEL)|(3<<UCSZ0);

}

void usart_data_transmit(unsigned char data )

{

while ( !( UCSRA & (1<<UDRE)) )

;

UDR = data;

}

unsigned char usart_data_receive( void )

{

while ( !(UCSRA & (1<<RXC)) )

;

return UDR;

}

void usart_string_transmit(char *string)

{

while(*string)

{

usart_data_transmit(*string++);

}

}

char *usart_string_receive(char *receive_string,unsigned char

terminating_character)

{

unsigned char temp=0x00;

unsigned char i;

for(i=0;;i++)

{

*(receive_string+i)=usart_data_receive();

if(*(receive_string+i)==terminating_character)

break;

else

temp++;

}

*(receive_string+temp)='\0';

return receive_string;

}

}

}

#endif


[/code]


errors:
Error: C:\cvavreval\inc\usart.h(55), included from: hc05.h: declaration syntax error
Error: C:\cvavreval\inc\usart.h(98), included from: hc05.h: must declare first in block
Error: C:\cvavreval\inc\usart.h(105), included from: hc05.h: must declare first in block
Error: C:\cvavreval\inc\usart.h(109), included from: hc05.h: 'void' functions may not return a value
Error: C:\cvavreval\inc\usart.h(112), included from: hc05.h: must declare first in block
Error: C:\cvavreval\inc\usart.h(127), included from: hc05.h: undefined symbol 'usart_data_receive'
Error: C:\cvavreval\inc\usart.h(134), included from: hc05.h: 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(41): function 'main' has already been defined in file: 'C:\Users\MY MHCE\Desktop\New folder\project\hc11\hc11.c', line: 40
Error: C:\cvavreval\inc\hc05.h(46): declaration syntax error
Error: C:\cvavreval\inc\hc05.h(76): undefined symbol 'usart_data_receive'
Error: C:\cvavreval\inc\hc05.h(83): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(85): must declare first in block
Error: C:\cvavreval\inc\hc05.h(89): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(100): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(104): must declare first in block
Error: C:\cvavreval\inc\hc05.h(111): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(153): undefined symbol 'usart_data_transmit'
Error: C:\cvavreval\inc\hc05.h(164): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(168): must declare first in block
Error: C:\cvavreval\inc\hc05.h(173): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(187): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(192): must declare first in block
Error: C:\cvavreval\inc\hc05.h(198): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(217): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(221): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(225): must declare first in block
Error: C:\cvavreval\inc\hc05.h(230): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(244): 'void' functions may not return a value


warnings:
Warning: C:\cvavreval\inc\usart.h(102), included from: hc05.h: local variable 'data' is used before its value is set
Warning: C:\cvavreval\inc\usart.h(127), included from: hc05.h: local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\usart.h(133), included from: hc05.h: local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\usart.h(134), included from: hc05.h: local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(76): local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(82): local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(83): local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(109): local variable 'baud_rate' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(208): local variable 'hc_05_buffer2' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(210): local variable 'hc_05_buffer2' is used before its value is set

for solving errors i declared variables after header files but nothing changed in errors,and also i cut unsigned before variable and again same thing occured , some where i read that i should active gcc mode i do that by these codes:

#include

void main(int) {
set_sleep_mode(SLEEP_MODE_IDLE);
sei();
sleep_mode();
}



(also i took this code from the net)

and i did not see those errors but i saw just this error:
Error: C:\cvavreval\inc\usart.h(40), included from: hc05.h: invalid #include directive



that line 40 is:
void main(int) {



and i change it to : void main() or: void main(void)


but i saw again the same error,these codes are in c++ but as you know better than me codevisionavr is a c compiler and also I lernt c++ in university and do not know how to change it to c till be accepted by this compiler ,please learn me which code I should add in my codes , it is my class project and I could not change my compiler because my programmer just support this type,I really need your help!!!


Re: [AVR-Chat] errors in codevisinavr for running hc05 bluetooth module with atmega8L

2016-07-04 by Martin McKee

There are lots of things going wrong here. First, and foremost, you are declaring and defining functions within a function, which is a no-no. Beyond that, you are doing it in a function void main(void), which is defined elsewhere, AND, if that weren't enough, you are doing it in a header file. This will never work. You need to take several steps back. It's not a C or C++ question either. It simply won't work. I would suggest that you take a few steps back and get a simple project working. Then, start at the top of the error list and fix them in sequence. It's not unusual for an early error to cause several later errors. Take the first one. It's saying,
Error: C:\cvavreval\inc\usart.h(55), included from: hc05.h: declaration syntax error
I would guess that that line is,
void hc_05_bluetooth_transmit_byte(char data_byte);
or one of those close to it.

Why is it complaining? Well, because you can't declare a function inside another function. It is worth mentioning that GNU GCC allows you to do such things ( under certain circumstances ) but it is not standard C or C++ so Codevision is, rightly, complaining. Move the declaration outside to file scope in the .h file, and put the function definition in a separate .c file. There, you have properly formatted C code -- for that function. Do it with all of the functions. Now, check the list of errors. It will be smaller. Will they all be gone? I don't know. I haven't looked closely enough. If not, start at the top again.

As for the new error ( on line 40 in hc05.h ), look at the error again. It is saying that there's an invalid #include. The line you gave us isn't a #include. Look up two lines. What the heck is that supposed to be including? The compiler doesn't know either, the first thing it found was void main(void){ etc. Obviously it doesn't know what to do with that.


Just take it one error at a time, beginning at the beginning, and you'll get there. If you have other questions, just show us the error, and the line it is referring to ( or a few lines around it, ideally ). The whole block of code ( especially without line numbers! ) is just a bunch of noise. It'll be much easier for us to help you if you help us find where the compiler is complaining.

Cheers,
Martin Jay McKee
Show quoted textHide quoted text
On Mon, Jul 4, 2016 at 12:30 PM, moh.hce_lio_pe@rocketmail.com [AVR-Chat] <AVR-Chat@yahoogroups.com> wrote:

hello every one

i want to run hc05 bluetooth module with atmega8L by following codes in codevisionavr ,main project file is hc11.c and it has 2 header files named hc05.h and usart.h but i see some errors and warnings after selecting build all , codes are:

hc11.c

[code]

#include
/*Includes io.h header file where all the Input/Output Registers and its Bits are defined for all AVR microcontrollers*/

#define F_CPU 8000000
/*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/

#include

/*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/

#include

/*Includes hc05.h header file which defines different functions for HC-05 Bluetooth Module. HC-05 header file version is 1.1*/

void main(void)

{

delay_ms(500);

delay_ms(500);

/*Delay of 1s*/

usart_init();

/*USART initialization*/

hc_05_bluetooth_transmit_string("bluetooth tag");

/*Transmits a string to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0d);

/*Transmits Carriage return to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0a);

/*Transmits New Line to Bluetooth Module for new line*/

hc_05_bluetooth_transmit_string("bluetooth module";);

/*Transmits a string to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0d);

/*Transmits Carriage return to Bluetooth Module*/

hc_05_bluetooth_transmit_byte(0x0a);

/*Transmits New Line to Bluetooth Module for new line*/

}

/*End of program*/

[/code]



hc05.h

[code]

#ifndef _HC05_H_

//#if HC05_H_

//#define _HC05_H_

#define _HC05_H_ 1

#include

#include

#include

#include

void main(void)

{

while(1){

char hc_05_buffer1[25], hc_05_buffer2[50];

char temp;

//unsigned char i;

void hc_05_bluetooth_transmit_byte(char data_byte);

char hc_05_bluetooth_receive_byte(void);

void hc_05_bluetooth_transmit_string(char *transmit_string);

void hc_05_bluetooth_transmit_command(char *transmit_string);

char *hc_05_bluetooth_receive_string(char *receive_string, unsigned char terminating_character);

unsigned char hc_05_bluetooth_at_command_mode_test(void);

unsigned char hc_05_bluetooth_device_name_change(char *device_name);

unsigned char hc_05_bluetooth_get_version(void);

unsigned char hc_05_bluetooth_change_baud_rate(long int baud_rate);

unsigned char hc_05_bluetooth_pin_change(char *new_pin);

void hc_05_bluetooth_transmit_byte(char data_byte)

{

usart_data_transmit(data_byte);

}

char hc_05_bluetooth_receive_byte(void)

{

return usart_data_receive();

}

void hc_05_bluetooth_transmit_string(char *transmit_string)

{

usart_string_transmit(transmit_string);

}

char *hc_05_bluetooth_receive_string(char *receive_string, unsigned char terminating_character)

{

unsigned char temp=0x00;

unsigned char i;

for( i=0;;i++)

{

*(receive_string+i)=usart_data_receive();

if(*(receive_string+i)==terminating_character)

break;

else

temp++;

}

*(receive_string+temp)='\0';

return receive_string;

}

unsigned char hc_05_bluetooth_at_command_mode_test(void)

{

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT");

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,0x0d);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_change_baud_rate(long int baud_rate)

{

UBRRL=12;

delay_ms(500);

if(baud_rate==4800)

{

usart_string_transmit("AT+UART=4800,0,0");

}

else if(baud_rate==9600)

{

usart_string_transmit("AT+UART=9600,0,0");

}

else if(baud_rate==19200)

{

usart_string_transmit("AT+UART=19200,0,0");

}

else if(baud_rate==38400)

{

usart_string_transmit("AT+UART=38400,0,0");

}

else if(baud_rate==57600)

{

usart_string_transmit("AT+UART=57600,0,0");

}

else if(baud_rate==115200)

{

usart_string_transmit("AT+UART=115200,0,0");

}

else if(baud_rate==230400)

{

usart_string_transmit("AT+UART=230400,0,0");

}

else if(baud_rate==460800)

{

usart_string_transmit("AT+UART=460800,0,0");

}

else if(baud_rate==921600)

{

usart_string_transmit("AT+UART=921600,0,0");

}

else if(baud_rate==1382400)

{

usart_string_transmit("AT+UART=1382400,0,0");

}

else

{

;

}

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_device_name_change(char *device_name)

{

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT+NAME=");

usart_string_transmit(device_name);

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_get_version(void)

{

unsigned char i=9,j=0;

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT+VERSION?");

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer2,13);

temp=usart_data_receive();

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

for(i=9;hc_05_buffer2[i]!=0;i++)

{

hc_05_buffer2[j]=hc_05_buffer2[i];

j++;

}

hc_05_buffer2[j]=0;

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

unsigned char hc_05_bluetooth_pin_change(char *new_pin)

{

UBRRL=12;

delay_ms(500);

usart_string_transmit("AT+PSWD=");

usart_string_transmit(new_pin);

usart_data_transmit(0x0d);

usart_data_transmit(0x0a);

usart_string_receive(hc_05_buffer1,13);

temp=usart_data_receive();

if(!(strcmp(hc_05_buffer1,"OK")))

{

return 1;

}

else

{

return 0;

}

}

}

}

#endif

[/code]

usart.h

[code]

#ifndef _USART_H_

#define _USART_H_ 1

#include

#include

#include

/*#include

void main(int) {

set_sleep_mode(SLEEP_MODE_IDLE);

sei();

sleep_mode();}

//gcc -std=gnu99 usart.c

// unsigned char i; */

/*The function is declared to initialize the USART with following cinfiguration:-

USART mode - Asynchronous

Baud rate - 9600

Data bits - 8

Stop bit - 1

Parity - No parity.*/

void main(void){

while(1){

void usart_init();

/*The function is declared to transmit data.*/

void usart_data_transmit(unsigned char data );

/*The function is declared to receive data.*/

unsigned char usart_data_receive( void );

/*The function is declared to transmit string.*/

void usart_string_transmit(char *string);

/*The function is declared to receive string.*/

char *usart_string_receive(char *receive_string,unsigned char terminating_character);

/*Function defination*/

void usart_init()

{

UBRRH = 0;

UBRRL =51;

UCSRB|= (1<

UCSRC |= (1 << URSEL)|(3<

}

void usart_data_transmit(unsigned char data )

{

while ( !( UCSRA & (1<

;

UDR = data;

}

unsigned char usart_data_receive( void )

{

while ( !(UCSRA & (1<

;

return UDR;

}

void usart_string_transmit(char *string)

{

while(*string)

{

usart_data_transmit(*string++);

}

}

char *usart_string_receive(char *receive_string,unsigned char

terminating_character)

{

unsigned char temp=0x00;

unsigned char i;

for(i=0;;i++)

{

*(receive_string+i)=usart_data_receive();

if(*(receive_string+i)==terminating_character)

break;

else

temp++;

}

*(receive_string+temp)='\0';

return receive_string;

}

}

}

#endif


[/code]


errors:
Error: C:\cvavreval\inc\usart.h(55), included from: hc05.h: declaration syntax error
Error: C:\cvavreval\inc\usart.h(98), included from: hc05.h: must declare first in block
Error: C:\cvavreval\inc\usart.h(105), included from: hc05.h: must declare first in block
Error: C:\cvavreval\inc\usart.h(109), included from: hc05.h: 'void' functions may not return a value
Error: C:\cvavreval\inc\usart.h(112), included from: hc05.h: must declare first in block
Error: C:\cvavreval\inc\usart.h(127), included from: hc05.h: undefined symbol 'usart_data_receive'
Error: C:\cvavreval\inc\usart.h(134), included from: hc05.h: 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(41): function 'main' has already been defined in file: 'C:\Users\MY MHCE\Desktop\New folder\project\hc11\hc11.c', line: 40
Error: C:\cvavreval\inc\hc05.h(46): declaration syntax error
Error: C:\cvavreval\inc\hc05.h(76): undefined symbol 'usart_data_receive'
Error: C:\cvavreval\inc\hc05.h(83): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(85): must declare first in block
Error: C:\cvavreval\inc\hc05.h(89): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(100): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(104): must declare first in block
Error: C:\cvavreval\inc\hc05.h(111): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(153): undefined symbol 'usart_data_transmit'
Error: C:\cvavreval\inc\hc05.h(164): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(168): must declare first in block
Error: C:\cvavreval\inc\hc05.h(173): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(187): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(192): must declare first in block
Error: C:\cvavreval\inc\hc05.h(198): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(217): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(221): 'void' functions may not return a value
Error: C:\cvavreval\inc\hc05.h(225): must declare first in block
Error: C:\cvavreval\inc\hc05.h(230): undefined symbol 'usart_string_transmit'
Error: C:\cvavreval\inc\hc05.h(244): 'void' functions may not return a value


warnings:
Warning: C:\cvavreval\inc\usart.h(102), included from: hc05.h: local variable 'data' is used before its value is set
Warning: C:\cvavreval\inc\usart.h(127), included from: hc05.h: local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\usart.h(133), included from: hc05.h: local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\usart.h(134), included from: hc05.h: local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(76): local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(82): local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(83): local variable 'receive_string' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(109): local variable 'baud_rate' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(208): local variable 'hc_05_buffer2' is used before its value is set
Warning: C:\cvavreval\inc\hc05.h(210): local variable 'hc_05_buffer2' is used before its value is set

for solving errors i declared variables after header files but nothing changed in errors,and also i cut unsigned before variable and again same thing occured , some where i read that i should active gcc mode i do that by these codes:

#include

void main(int) {
set_sleep_mode(SLEEP_MODE_IDLE);
sei();
sleep_mode();
}



(also i took this code from the net)

and i did not see those errors but i saw just this error:
Error: C:\cvavreval\inc\usart.h(40), included from: hc05.h: invalid #include directive



that line 40 is:
void main(int) {



and i change it to : void main() or: void main(void)


but i saw again the same error,these codes are in c++ but as you know better than me codevisionavr is a c compiler and also I lernt c++ in university and do not know how to change it to c till be accepted by this compiler ,please learn me which code I should add in my codes , it is my class project and I could not change my compiler because my programmer just support this type,I really need your help!!!



Re: [AVR-Chat] errors in codevisinavr for running hc05 bluetooth module with atmega8L

2016-07-08 by moh.hce_lio_pe@rocketmail.com

i corrected my codes and i when i compiled it i saw just this error:
Error: C:\cvavreval\inc\usart.h(185), included from: hc05.h: invalid #include directive

line 185 of usart.h:
void usart_init();

then when i check syntax error i saw this error:
Error: C:\cvavreval\inc\usart.h(272): no matching #endif

line 272 of usart.h is:
#endif

please learn me how change my code.


Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.