View previous topic :: View next topic |
Author |
Message |
davidfsauri
Joined: 12 Aug 2019 Posts: 2 Location: Merida, Mexico
|
Error 51: Expecting Function Name |
Posted: Mon Aug 12, 2019 1:32 pm |
|
|
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: 19539
|
|
Posted: Mon Aug 12, 2019 1:37 pm |
|
|
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
|
Sorry |
Posted: Mon Aug 12, 2019 1:57 pm |
|
|
[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
|
Re: Sorry |
Posted: Mon Aug 12, 2019 2:02 pm |
|
|
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
|
|
Posted: Mon Aug 12, 2019 2:18 pm |
|
|
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
|
|
Posted: Mon Aug 12, 2019 5:31 pm |
|
|
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
|
|
Posted: Mon Aug 12, 2019 6:57 pm |
|
|
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: 19539
|
|
Posted: Tue Aug 13, 2019 12:18 am |
|
|
and he has in his code:
int lcd_putc;
A variable called lcd_putc.... |
|
|
|