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

scanf() 16F887

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



Joined: 02 May 2014
Posts: 5

View user's profile Send private message

scanf() 16F887
PostPosted: Fri May 02, 2014 9:33 am     Reply with quote

Hello,

I try to implement scanf() after reading http://www.ccsinfo.com/newsdesk_info.php?newsdesk_id=159, but after compiling generates an error Error#12 Undefined identifier -- scan.

Using MPLABx with ccs plug in 1.57.

I have included stdio.h.
Code:

#int_rda   //Interrupção RS485
void  RDA_isr()
{
     
    scanf ("%c %u %c", prefix, addr, act);
    //in_char = fgetc(rs485);
}

Can you give any help regarding this issue?

Thank You!
temtronic



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

View user's profile Send private message

PostPosted: Fri May 02, 2014 9:45 am     Reply with quote

Maybe a silly question but what version of the compiler are you using?


jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri May 02, 2014 10:35 am     Reply with quote

Further comments though, remember that scanf, is a multi character function. INT_RDA, implies _one_ character is waiting. You will hang code operation while the data is received to meet your scanf specification. Not good.
The example shows how to implement the buffering, using the new V5 buffer ability, and you should tell the RS232 setup to use the INT_RDA.
If your compiler is new enough, then I'd suspect one of the variables is not defined. Remember it wants the _address_ of the value you want to store.

Best Wishes
roger_cris



Joined: 02 May 2014
Posts: 5

View user's profile Send private message

PostPosted: Fri May 02, 2014 10:57 am     Reply with quote

temtronic wrote:
Maybe a silly question but what version of the compiler are you using?


jay


CCS MPLABx plug in V1.57.
roger_cris



Joined: 02 May 2014
Posts: 5

View user's profile Send private message

PostPosted: Fri May 02, 2014 11:00 am     Reply with quote

Ttelmah wrote:
Further comments though, remember that scanf, is a multi character function. INT_RDA, implies _one_ character is waiting. You will hang code operation while the data is received to meet your scanf specification. Not good.
The example shows how to implement the buffering, using the new V5 buffer ability, and you should tell the RS232 setup to use the INT_RDA.
If your compiler is new enough, then I'd suspect one of the variables is not defined. Remember it wants the _address_ of the value you want to store.

Best Wishes


I can't find online any information if the MPLABx plug in compiler supports that function.

Regarding the code in INT_RDA i will change it, because i believe it will not do the job Smile TKU Ttelmah
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri May 02, 2014 11:52 am     Reply with quote

scanf() is supported starting around CCS COMPILER version 5.012.

You are providing the MPLABX version which is not CCS software, it is by Microchip.

The CCS version is at the top of the .LST file generated by the compiler.
_________________
Google and Forum Search are some of your best tools!!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 02, 2014 2:18 pm     Reply with quote

Here is a list of ways to find the CCS compiler version:

1. Compile a test file, and look at the top of the .LST file, which will
be in your project folder. It will show the version. However, to get
the .LST file to be generated, the source file must compile with no errors.

2. Click on the Start button in Windows, then go to Programs, and then
find the entry for CCS, which will be called "PIC-C". Then click on the icon
for "Compiler Version". It will display a box which shows the compiler
version.

3. Open a Command Prompt window and go to c:\Program Files\Picc
and run this command line: CCSC.exe +v
This method should always work.
roger_cris



Joined: 02 May 2014
Posts: 5

View user's profile Send private message

PostPosted: Fri May 02, 2014 2:43 pm     Reply with quote

PCM programmer wrote:
Here is a list of ways to find the CCS compiler version:

1. Compile a test file, and look at the top of the .LST file, which will
be in your project folder. It will show the version. However, to get
the .LST file to be generated, the source file must compile with no errors.

2. Click on the Start button in Windows, then go to Programs, and then
find the entry for CCS, which will be called "PIC-C". Then click on the icon
for "Compiler Version". It will display a box which shows the compiler
version.

3. Open a Command Prompt window and go to c:\Program Files\Picc
and run this command line: CCSC.exe +v
This method should always work.


5.008, have to upgrade?
temtronic



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

View user's profile Send private message

PostPosted: Fri May 02, 2014 2:53 pm     Reply with quote

yes, you'll have to upgrade

or

cut your own 'scan(....)' function

be aware that 5.008 was 'young' and had a few 'problems'...


hth
jay
roger_cris



Joined: 02 May 2014
Posts: 5

View user's profile Send private message

PostPosted: Fri May 02, 2014 3:03 pm     Reply with quote

temtronic wrote:
yes, you'll have to upgrade

or

cut your own 'scan(....)' function

be aware that 5.008 was 'young' and had a few 'problems'...


hth
jay


Tk U All for the support!
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sat May 03, 2014 12:10 am     Reply with quote

As a comment though, some core parts of a scanf function have previously been published here.

Have a look at:
<http://www.ccsinfo.com/forum/viewtopic.php?t=20225>

This is a sscanf function, so in a real sense much better suited to receiving data. Use an interrupt driven serial buffer. Read the data into a string when a line feed is received, and use sscanf on this.

The comments on 5.008 definitely apply though.

Best Wishes
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