Error AVR

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello !

I have a weird problem with lot of my code.

Yesterday the code work very well, didn't change anything.

This code is a simple example and i have an error with this one too.

#include 
#include 

// Standard Input/Output functions
#include 


void main(void)
{

int i; 
delay_ms(3000);


///////////////////// Port D initialization \\\\\\\\\\\\\\\\\\\\\\\\

PORTA=0x00;
DDRA=0x00;

PORTB=0x00;
DDRB=0xFF;

PORTC=0x00;
DDRC=0x00;

PORTD=0x00;
DDRD=0x00;


///////////////////////////////////////////////////////////////////

// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 9600
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x19;


////////////////////////// Pogramme \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
           
PORTB=~0xFF;
delay_ms(1000);
printf("U");
i=getchar();

if (i==0b00000110) 
  {
  PORTB=~0xF0;
  delay_ms(3000);
  }
else
  {
  PORTB=~0x01;
  delay_ms(3000);
  }
  
}

And that it's my error !

Error: C:\Users\DOUKI\Desktop\Projet 2011\Developpement AVR\uDrive\Udrive1.c(72): function argument #1 of type 'flash unsigned char [2]' is incompatible with required parameter of type 'const unsigned char *'

And one again i didn't touch anything since yesterday.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

And one again i didn't touch anything since yesterday.


Then why did you rebuild? :twisted:

Are you using the same compiler version?

Is this CodeVision? It compiles cleanly for me with 1.25.9 and 2.04.5.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yesterday it worked perfectly, and now all my code have this error.

You know when you write "int" it like that int bold text, but now when i write "int" or "char" it's not bold text.

And i use he same version of Codevision AVR, i didn't change anything.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok thank you

Problem solved, i have a wrong stdio.h file

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

And i use he same version of Codevision AVR, i didn't change anything.

Quote:

i have a wrong stdio.h file

It seems that something >>did<< change...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was not me, my brother use my computer and he restoring trash.
SO the stdio was in the trash.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You really should set up individual user accounts to prevent things like this from happening.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everyone! I know that it is very old topic, but it is most common to my issue. May be, it could help someone later.

 

I made a new project and copied full old code to new *.c file, then changed it a little. I really did Not touch anything in functions or const definition.

And I did not use <stdio.h> at all (but I tried to include it also - no profit).

 

Building my new code comes full of such errors:

function argument #1 of type 'const unsigned char [17]' is incompatible with required parameter of type 'flash unsigned char []'

 

I tried to open CodeWizard and generate *.c file, then I delete everything in that *.c file and fully copied my new code from project with errors.

Tadaaam! It was compiled without errors, but I really did not understand WTF happened with compiler and what a crazy error "const != flash" it gave without CodeWizard.

 

After some brain-f**king I've found that there are a setting named "Store Global Constants in FLASH Memory" in the Project -> Configure.

Checking this setting let the compiler work without "const != flash" errors.

 

Last Edited: Wed. Sep 27, 2017 - 07:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, the summary is that you created a new >>project<<, copied the >>code<< from the old project, but made no attempt to compare the project settings for the old and new projects.

 

Indeed, just on the "main" project panel there are probably a dozen or more configuration options that can make a great difference.  Add onto that the settings where you enter a number.

 

In the end, hardly a surprise.  And while this appears to be CodeVision, the same situation could well happen with e.g. Studio and the married GCC.
 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.