C - syntax error C141. Can't figure out why 1 function does't work.

GoExtreme

Joined Mar 4, 2018
52
Hello,

I'm making a BitBang function for something similar to 1 wire. What ever I do I always get a syntax error on this function. This is part of bigger project and everything else works.
I made a separate project with just this function and still getting syntax error. I don't understand
I'm getting error C141 syntax error near 'data', ')', ')'

Code:
#include <SI_EFM8UB1_Register_Enums.h>                // SFR declarations

SI_SBIT (Pin, SFR_P1, 3);

void Data(uint8_t data);

void SiLabs_Startup (void)
{
// Disable the watchdog here
}

int main (void)
{
while (1)
{
Data(0x05);
}
}

void Data(uint8_t data)
{
uint8_t i;

for (i = 0; i < 8; i++)
{
if (data & 0x80)
{
Pin = 1;
}
else { Pin = 0;}

}

}

Papabravo

Joined Feb 24, 2006
14,702
I can't see where the error occurs in the listing.

GoExtreme

Joined Mar 4, 2018
52

Attachments

• 46.1 KB Views: 13

Papabravo

Joined Feb 24, 2006
14,702
There is still no indication of where the error occurs

GoExtreme

Joined Mar 4, 2018
52
@Papabravo the red lines. But that looks good right? I'm not crazy?

Kjeldgaard

Joined Apr 7, 2016
424
Is the compiler Case Sensitive?

Zeeus

Joined Apr 17, 2019
608
@Papabravo the red lines. But that looks good right? I'm not crazy?
been a while Zeeus programmed

if (data & 0x80)..That is correct??

maybe that part is the problem

Papabravo

Joined Feb 24, 2006
14,702

GoExtreme

Joined Mar 4, 2018
52
@Papabravo

What else you need? I uploaded the whole thing. It's for efm8 mcu using C51 COMPILER V9.53.0.0

@Zeeus I get same error even if I remove that part.

@Kjeldgaard I changed uint8_t data to D and same.

Zeeus

Joined Apr 17, 2019
608
@Papabravo

What else you need? I uploaded the whole thing. It's for efm8 mcu using C51 COMPILER V9.53.0.0

@Zeeus I get same error even if I remove that part.

@Kjeldgaard I changed uint8_t data to D and same.
Lat question from Zeeus and he's off...Papabravo and kjeldgaard will see you through

Pin is defined?

GoExtreme

Joined Mar 4, 2018
52
@Zeeus
Yes
SI_SBIT (Pin, SFR_P1, 3);

JohnInTX

Joined Jun 26, 2012
4,346
Is the function name 'Data' a reserved word? Maybe not to the compiler but to the underlying assembler? Several I am familiar with have issues with that sort of thing and DATA is used by many of them as a segment name.

Last edited:

GoExtreme

Joined Mar 4, 2018
52
@JohnInTX You got it! It's always the simple things. I did change the void name but never int data. Lesson learned.

Thank you all for input.

nsaspook

Joined Aug 27, 2009
7,758
Is the function name 'Data' a reserved word? Maybe not to the compiler but to the underlying assembler? Several I am familiar with have issues with that sort of thing and DATA is used by many of them as a segment name.
I've been burned by that one before. You are the MAN!