Hi,

I'm getting an error that says my defined constant is not a function. It's not supposed to be a function.

This is the error...

Tick.c:389:35: error: called object '200000000ul' is not a function

It points to...

#define TICKS_PER_SECOND    ((GetPeripheralClock()+128ull)/256ull)

GetPeripheralClock has the error. It comes from...

    #define GetSystemClock (200000000UL)
    #define GetInstructionClock (GetSystemClock/2)
    #define GetPeripheralClock (GetSystemClock)

Where is it deciding it is a function?

Probably the parentheses on line 1. Remove them and see if it compiles.

#define GetSystemClock 200000000UL

Same with line 3

#define GetPeripheralClock GetSystemClock

Rats! Didn't help. Looked like it might work though.
The whole function with the error is...

/*****************************************************************************
  Function:
    DWORD TickConvertToMilliseconds(DWORD dwTickValue)

  Summary:
    Converts a Tick value or difference to milliseconds.

  Description:
    This function converts a Tick value or difference to milliseconds.  For
    example, TickConvertToMilliseconds(32768) returns 1000 when a 32.768kHz
    clock with no prescaler drives the Tick module interrupt.

  Precondition:
    None

  Parameters:
    dwTickValue - Value to convert to milliseconds

  Returns:
    Input value expressed in milliseconds.

  Remarks:
    This function performs division on DWORDs, which is slow.  Avoid using
    it unless you absolutely must (such as displaying data to a user).  For
    timeout comparisons, compare the current value to a multiple or fraction
    of TICK_SECOND, which will be calculated only once at compile time.
  ***************************************************************************/
DWORD TickConvertToMilliseconds(DWORD dwTickValue)
{
        return (dwTickValue+(TICKS_PER_SECOND/2000ul))/((DWORD)(TICKS_PER_SECOND/1000ul));
}

#define TICKS_PER_SECOND ((GetPeripheralClock()+128ull)/256ull

The compiler sees GetPeripheralClock() as a function call -- remove the ()

#define TICKS_PER_SECOND ((GetPeripheralClock+128ull)/256ull

Oh Great! I just got the meaning of the remarks so I did a search and TickConvertToMilliseconds isn't used anywhere so I'm just going to comment this section out.
Sorry.
I still wonder where it decided to change it to a function though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.