-3
// Created by lenovo on 8/27/2017.
//

#ifndef UART_UART_CFG_H
#define UART_UART_CFG_H

#define UART_BaudRate     1200   //9600UL
#define CLK               16
#define UART_Parity       NONE
#define UART_TX           EN_TX
#define UART_RX           EN_RX
#define UART_STARTBITS      1
#define UART_STOPBITS       1
#define UART_DATABITS   EightBits

#endif //UART_UART_CFG_H

enter image description here This is the error "called object is not a function or pointer" and this my private file that have all word's addresses inside the config file. The first file:

//
// Created by lenovo on 8/27/2017.
//

#ifndef UART_UART_PRIV_H
#define UART_UART_PRIV_H

/* Main PINS */
#define UCSRA *((volatile u8 *)0x2B)
#define UCSRB *((volatile u8 *)0x2A)
#define UCSRC *((volatile u8 *)0x40)
#define UBRRL *((volatile u8 *)0x29)
#define UBRRH *((volatile u8 *)0x40)
#define UDR   *((volatile u8 *)0x2C)
/* END Main PINS */
#define NONE        0x00
#define twoBit      0x08
#define oneBit      0x00
/* Bits */
#define fiveBits    0x00
#define SixBits     0x02
#define SevenBits   0x04
#define EightBits   0x06
/* End Bits */
#define DIS         0  // Disable
#define EN          1  // Enable

#define UART_9600   9600UL
#endif //UART_UART_PRIV_H

Private file that have some addresses for my Microcontroller ATmega16. Moreover, my config file is reference to private file; which have keys that defined in private. For example, in UART_Partit I wrote NONE and NONE address defined in private but it shows error

Lundin
  • 195,001
  • 40
  • 254
  • 396
  • I am willing to bet that the "output" tab in Atmel Studio carries the same error information and a lot more useful diagnostic information in a copy & pastable text form which would be preferable and more useful that posting an image of IDE filtered error text. – Clifford Sep 02 '17 at 18:06
  • done the image in the post – Mohanned Kandil Sep 04 '17 at 13:42
  • can u help me to solve this problem? – Mohanned Kandil Sep 04 '17 at 13:43
  • You have entirely missed my point. The error information is available as text - there is no need to post a _picture_ of your IDE; just post the text. In any event, the file/line number information in the error list do not appear to relate to the file shown - those errors cannot be generated for a macro definition, only where the macro is used. – Clifford Sep 04 '17 at 14:26

1 Answers1

0

You need to include your file with declarations.

#ifndef UART_UART_CFG_H
#define UART_UART_CFG_H

#include "uart_priv.h"

#define UART_BaudRate     1200   //9600UL
#define CLK               16
#define UART_Parity       NONE
#define UART_TX           EN_TX
#define UART_RX           EN_RX
#define UART_STARTBITS      1
#define UART_STOPBITS       1
#define UART_DATABITS   EightBits

#endif //UART_UART_CFG_H

and there are no EN_TX or EN_RX defines for these constants in your second file.

  • EN_TX and EN_RX are Macro in the main program to check if its EN_TX or EN_RX and do something in form like this #if and #endif – Mohanned Kandil Sep 03 '17 at 00:39
  • 1
    @MohannedKandil : Clearly however the definitions of EN_TX, EN_RX are not _visible_ at the point they (or their aliases UART_TX, UART_RX) are used are used. You need to post the raw build log (from the Output tab), not the IDE filtered messages - that hides useful diagnostic information. – Clifford Sep 04 '17 at 14:31