CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Error 51: Expecting Function Name

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
davidfsauri



Joined: 12 Aug 2019
Posts: 2
Location: Merida, Mexico

View user's profile Send private message

Error 51: Expecting Function Name
PostPosted: Mon Aug 12, 2019 1:32 pm     Reply with quote

Hi, I've been trying to compile this code but I don't know what's wrong.
I have reviewed it a thousand times and have not yet been able to find
the solution. I hope you help me please.

+++++++++++++++++++++
The original poster removed his
own code due to embarrassment.

- Forum Moderator
+++++++++++++++++++++


Last edited by davidfsauri on Mon Aug 19, 2019 7:41 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Mon Aug 12, 2019 1:37 pm     Reply with quote

1) Use the code buttons when posting code. Otherwise it becomes very
hard for us to read.
2) It looks like you have almost all your code inside an interrupt handler.
Don't.
Interrupt handlers should be short and quick. No complicated maths,
no delays, etc. etc.
3) The actual error though is caused by lcd_putc. You have a variable called
'lcd_putc', no function of that name. You are then trying to use this in
printf, where a function name is expected.
davidfsauri



Joined: 12 Aug 2019
Posts: 2
Location: Merida, Mexico

View user's profile Send private message

Sorry
PostPosted: Mon Aug 12, 2019 1:57 pm     Reply with quote

[code]
I do not know why I can do to solve that, can you explain me that, please.

+++++++++++++++++++++
Again, the original poster removed his
own code due to embarrassment.

- Forum Moderator
+++++++++++++++++++++


Last edited by davidfsauri on Mon Aug 19, 2019 7:40 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Sorry
PostPosted: Mon Aug 12, 2019 2:02 pm     Reply with quote

davidfsauri wrote:

Error 51: Expecting Function Name

You get this error when you are missing the main() function.
In CCS, you must have a main() function.
javier.jimenez



Joined: 12 Aug 2019
Posts: 1

View user's profile Send private message

PostPosted: Mon Aug 12, 2019 2:18 pm     Reply with quote

Excuse Ttelmah
I have the similar problem with a code, and I don't understand what do you mean with "You are then trying to use this in printf, where a function name is expected", Could you help me?
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Aug 12, 2019 5:31 pm     Reply with quote

other problem...
Quote:
i = (i/120)*2800; // corriente del secundario del sensor

You've declared 'i' as 'int', which in CCS C is int8 or 8-bit, NOT 16-bit which I think you think it is.
The same holds true for other variables.

also
Quote:
#USE RS232(BAUD=9600, XMIT=3, RCV=2)

xmit=PIN_A3 not XMIT=3
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Aug 12, 2019 6:57 pm     Reply with quote

javier.jimenez wrote:

What do you mean with "You are then trying to use this in printf, where a
function name is expected", Could you help me?

Look at the CCS example file Ex_lcdth.c in the CCS Examples folder.
It shows this line:
Quote:
printf(lcd_putc,"\fCurrent Temp: %U F\nMin: %U Max: %U", current_temp,min_temp,max_temp);

This line sends the output of the printf function to the lcd_putc() function.
This feature is an extension of the C language provided by the CCS
compiler. It's useful. You can send the output of printf() to any function
that accepts a character as input, such as lcd_putc().

Note that the Ex_lcdth.c file includes the lcd.c driver in it. This file has
lcd_putc() defined in it:
Quote:
#include <16F887.h>
#use delay(crystal=20mhz)

#include <lcd.c>

Ttelmah means that he is missing the #include <lcd.c> line, so lcd_putc
is not defined.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Tue Aug 13, 2019 12:18 am     Reply with quote

and he has in his code:

int lcd_putc;

A variable called lcd_putc....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group