CodeVision AVR: pointer type problem

OP #1513948
Rate this post
useful
not useful
Hi,

my CodeVision AVR is doing crazy things, but okay, more probable is that 
I don't see my mistake...
I get the following error message (latest CV-version 2.04.4a, for 
ATmega168P)
1
Error: D:\...\project_sercom.c(639), included from: project_0-1.c: function argument #1 of type 'char' is incompatible with required parameter of type 'char *'
1
// function call which the error refers to:
2
CRC_calc(*data_buf0, *datbuf0_cnt);
3

4
// the used global char array:
5
char data_buf0[DATA_BUF0_MAX];
6

7
// function:
8
void CRC_calc(char *data_buf, unsigned char *buf_cnt)
9
{
10
  unsigned char i = 0;
11
  unsigned char local_buf_cnt = 0;
12
  unsigned int ui_CRC = 0;
13
  char CRC_ASCII_byte[3] = { 0, 0, 0 };
14

15
  local_buf_cnt = *buf_cnt;
16

17
  // Calculate 16bit unsigned int CRC
18
  ui_CRC = ui_CRC ^ address;
19
  for ( i = 0; i < buf_cnt; i++ )
20
  {
21
    ui_CRC = ui_CRC ^ *(data_buf + i);
22
    if ( ( 0x0001 && ui_CRC ) == 1 ) ui_CRC = ( 0x7FFF & ( ui_CRC >> 1 ) ) ^ 0xA001;
23
    else ui_CRC = 0x7FFF & ( ui_CRC >> 1 );
24
  }
25

26
  // put CRC into 3 ASCIIs:
27
  CRC_ASCII_byte[0] = 0x40 | ( 0x000F & ( ui_CRC >> 12 ) );
28
  CRC_ASCII_byte[1] = 0x40 | ( 0x003F & ( ui_CRC >> 6 ) );
29
  CRC_ASCII_byte[2] = 0x40 | ( 0x003F & ui_CRC );
30

31
  // add the 3 CRC ASCIIs to buffer:
32
  for( i = 0; i < 3; i++ ) *(data_buf + local_buf_cnt + i) = CRC_ASCII_byte[i];
33
  *buf_cnt = local_buf_cnt + 3;
34
}

somewhere else in the code the pointers work perfectly, a string (char 
array) is copied to a data buffer. no problems there.

please help!

X

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now